mirror of
https://src.koozali.org/infra/smeserver-koji.git
synced 2024-11-28 11:51:15 +01:00
57 lines
1.0 KiB
Bash
57 lines
1.0 KiB
Bash
|
#!/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" ;;
|
||
|
* )
|
||
|
KOJI_BUILD_FQDN=$param ;;
|
||
|
esac
|
||
|
else
|
||
|
break
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
if [ $DEBUG ] ; then
|
||
|
set -x
|
||
|
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"
|