2024-05-09 18:25:07 +02:00
|
|
|
#!/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
|
|
|
|
|
2024-05-09 20:51:48 +02:00
|
|
|
installed=false
|
2024-05-09 18:25:07 +02:00
|
|
|
if test ! -e "/host/etc/radvd.conf"; then
|
2024-05-09 20:42:03 +02:00
|
|
|
cp /etc/radvd.conf /host/etc/radvd.conf
|
2024-05-09 18:25:07 +02:00
|
|
|
echo "radvd-install: installed example /etc/radvd.conf"
|
|
|
|
installed=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test ! -e "$QUADLET_DIR/$QUADLET_FILENAME"; then
|
|
|
|
mkdir -p "$QUADLET_DIR"
|
2024-05-09 20:45:13 +02:00
|
|
|
sed -e "s,%IMAGE%,%{IMAGE},g" "$ORIGIN/container/quadlet/${QUADLET_FILENAME}.in" \
|
2024-05-09 18:25:07 +02:00
|
|
|
> "$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
|
|
|
|
|