radvd-container: remove podman label install/uninstall

This commit is contained in:
Jeff Mahoney 2024-08-23 15:55:53 -04:00
parent b2a0ee4963
commit d6bdf80fdb
4 changed files with 2 additions and 96 deletions

View File

@ -11,10 +11,7 @@ LABEL org.opensuse.reference="registry.opensuse.org/home/jeff_mahoney/containers
# endlabelprefix
RUN zypper --non-interactive install -y radvd
VOLUME /etc/radvd
ENV RADVD_OPTIONS="-C /etc/radvd.conf --logmethod stderr"
COPY ./container /container
CMD /container/scripts/entrypoint.sh
LABEL INSTALL="/usr/bin/podman run --env IMAGE=IMAGE --rm --privileged --pid host -v /:/host -v /run:/run:rslave -v /sys/fs:/sys/fs:ro IMAGE /container/scripts/label-install"
LABEL UNINSTALL="/usr/bin/podman run --rm --privileged --pid host -v /run:/run:rslave -v /:/host:shared IMAGE /container/scripts/label-uninstall"
LABEL RUN="/usr/bin/podman run --replace --name NAME IMAGE --env RADVD_OPTIONS=RADVD_OPTIONS -v /etc/radvd.conf:/etc/radvd.conf:ro /container/scripts/entrypoint.sh"
CMD /usr/sbin/radvd ${RADVD_OPTIONS}

View File

@ -1,8 +0,0 @@
#!/bin/bash -eu
# shortcut for podman runlabel calls
if [ $(basename "$1") = 'label-install' ] || [ $(basename "$1") = 'label-uninstall' ]; then
exec "$@"
fi
exec /usr/sbin/radvd --nodaemon ${RADVD_OPTIONS}

View File

@ -1,56 +0,0 @@
#!/bin/bash -eu
# This is the install script for radvd when run in a privileged
# container.
#
# The host file system must be mounted at /host
cd /
PATH="/usr/bin:/usr/sbin"
MISSING_PACKAGES=0
: "${HOST:=/host}"
: "${ORIGIN:=}"
QUADLET_DIR="$HOST/etc/containers/systemd"
QUADLET_FILENAME="radvd.container"
if [ ! -d $HOST/etc ] || [ ! -d $HOST/proc ] || [ ! -d $HOST/run ]; then
echo "radvd-install: host file system is not mounted at $HOST"
exit 1
fi
if test ! -w "/host/etc"; then
echo "radvd-install: this container cannot be installed by a non-root user."
exit 1
fi
installed=false
if test ! -e "/host/etc/radvd.conf"; then
random() {
od -An -d -N2 /dev/urandom
}
prefix=`printf "fd%02x:%04x:%04x:0001::/64\n" $(($(random) % 256)) $(random) $(random)`
sed -e "s,prefix fd.*/64,prefix $prefix," $ORIGIN/etc/radvd.conf > $HOST/etc/radvd.conf
echo "radvd-install: created /etc/radvd.conf with ULA prefix $prefix"
installed=true
fi
if test ! -e "$QUADLET_DIR/$QUADLET_FILENAME"; then
mkdir -p "$QUADLET_DIR"
sed -e "s,%IMAGE%,${IMAGE},g" "$ORIGIN/container/quadlet/${QUADLET_FILENAME}.in" \
> "$QUADLET_DIR/${QUADLET_FILENAME}"
echo "radvd-install: installed $QUADLET_FILENAME quadlet"
chroot "$HOST" systemctl daemon-reload
installed=true
fi
if test "$installed" = "true"; then
echo radvd container installed, to start it:
else
echo radvd container was already installed, to start it
fi
echo systemctl enable --now radvd

View File

@ -1,27 +0,0 @@
#!/bin/bash -eu
# This is the uninstall script for radvd when run in a privileged
# container.
#
# The host file system must be mounted at /host
cd /
PATH="/usr/bin:/usr/sbin"
MISSING_PACKAGES=0
: "${HOST:=/host}"
: "${ORIGIN:=}"
QUADLET_DIR="$HOST/etc/containers/systemd"
QUADLET_FILENAME="radvd.container"
if [ ! -d $HOST/etc ] || [ ! -d $HOST/proc ] || [ ! -d $HOST/run ]; then
echo "radvd-install: host file system is not mounted at $HOST"
exit 1
fi
chroot systemctl disable --now radvd
rm -f "$HOST/etc/radvd.conf"
rm -f "$QUADLET_DIR/$QUADLET_FILENAME"
chroot "$HOST" systemctl daemon-reload