more aramo/jammy updates
[automated-distro-installer] / faiserver-disable
old mode 100644 (file)
new mode 100755 (executable)
index 93819cc..0a9ad8d
@@ -6,7 +6,7 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 usage() {
     cat <<EOF
 Usage: ${0##*/}
-Disable the fai nfs server.
+Disable the fai nfs server exports
 EOF
     exit $1
 }
@@ -15,4 +15,13 @@ if [[ $1 ]]; then
     usage 1
 fi
 
-ssh root@$(chost faiserver) "sed -ri --follow-symlinks '\%^/srv/fai/d' /etc/exports; exportfs -ra"
+ssh root@$(chost faiserver) bash <<'EOF'
+set -eE -o pipefail
+if modprobe nfsd &>/dev/null; then
+  sed -ri --follow-symlinks '\%^/srv/fai/%d' /etc/exports
+  exportfs -ra
+else
+  rm -f /etc/apache2/sites-enabled/faiserver.conf
+  systemctl reload apache2
+fi
+EOF