2023-09-04 02:51:05 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
set -e
|
|
|
|
DEBUG=
|
|
|
|
SILENT="-s"
|
|
|
|
QUIET="-q"
|
|
|
|
for param in $1 $2 ; do
|
|
|
|
if [ $param ] ; then
|
|
|
|
case $param in
|
|
|
|
debug )
|
|
|
|
DEBUG="debug" ;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $DEBUG ] ; then
|
2023-09-04 08:49:28 +02:00
|
|
|
set -xe
|
2023-09-04 02:51:05 +02:00
|
|
|
SILENT=
|
|
|
|
QUIET="-v"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# load required parameters
|
|
|
|
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
|
|
|
if [ ! -f "$SCRIPT_DIR"/koji-parameters.sh ] ; then
|
|
|
|
echo "$SCRIPT_DIR/koji-parameters.sh NOT found - aborting"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
source "$SCRIPT_DIR"/koji-parameters.sh
|
|
|
|
|
|
|
|
# Install nfs-utils
|
|
|
|
dnf install -y nfs-utils $QUIET
|
|
|
|
|
|
|
|
KOJI_MOUNT_SERVICE="${KOJI_DIR:1}"
|
|
|
|
KOJI_MOUNT_SERVICE="${KOJI_MOUNT_SERVICE/\//-}".mount
|
|
|
|
mkdir -p /etc/systemd/system
|
|
|
|
cat > /etc/systemd/system/"$KOJI_MOUNT_SERVICE" <<- EOF
|
|
|
|
[Unit]
|
|
|
|
Description=Koji NFS Mount
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Mount]
|
|
|
|
What=$KOJI_HUB_FQDN:$KOJI_DIR
|
|
|
|
Where=$KOJI_DIR
|
|
|
|
Type=nfs
|
|
|
|
Options=defaults,ro
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
EOF
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl enable --now "$KOJI_MOUNT_SERVICE"
|