smeserver-koji/koji-setup/koji-deploy-nfs-server.sh
2023-11-16 14:59:21 +11:00

51 lines
1.0 KiB
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
if [[ -z $(dnf list installed | grep nfs-utils) ]] ; then
dnf install -y nfs-utils $QUIET
fi
# Export server directory to be mounted by clients - add script will add clients
echo $KOJI_DIR >> /etc/exports
# allow nfs usage in selinux and firewall
setsebool -P httpd_use_nfs=1
firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=mountd
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --reload
systemctl enable --now rpcbind
systemctl enable --now nfs-server