mirror of
https://src.koozali.org/infra/smeserver-koji.git
synced 2024-11-28 19:57:59 +01:00
55 lines
1007 B
Bash
Executable File
55 lines
1007 B
Bash
Executable File
#!/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
|
|
set -xe
|
|
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"
|