raid10 replace docs, various fixes
[automated-distro-installer] / myfai-chboot-local
index d16f3b14961bb6cc9163f1a428496d7b86ade3cc..b2df864f129e32cbb2a1fdc5202192c115956b5d 100755 (executable)
@@ -60,12 +60,18 @@ if modprobe nfsd &>/dev/null; then
     root_arg="$my_ip:/srv/fai/nfsroot:vers=3"
     # fai-setup without -e sets the ip to the local_ip/local_network, eg 192.168.1.3/24
     # I restrict it to one ip as simple but imperfect access control.
-    sed -ri --follow-symlinks '\%^/srv/fai/%d' /etc/exports
-    cat >>/etc/exports <<EOF
+
+    # we may chattr +i /etc/exports if we dun want it modified
+    # for example, if we made these exports more widely available
+    # while doing multiple installs or a recovery.
+    if [[ -w /etc/exports ]]; then
+        sed -ri --follow-symlinks '\%^/srv/fai/%d' /etc/exports
+        cat >>/etc/exports <<EOF
 /srv/fai/config $ip(async,ro,no_subtree_check)
 /srv/fai/nfsroot $ip(async,ro,no_subtree_check,no_root_squash)
 EOF
-    exportfs -ra
+        exportfs -ra
+    fi
     systemctl start nfs-server # assumes recent os
 else
     std_arg="-u http://faiserver:8080/config.tar.gz"