Skip to content

Commit

Permalink
cluster-setup: Handle faulty user input for NFS exports
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Bacon committed Jan 13, 2021
1 parent 9735a6f commit bf1fb59
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Common/Sys-scripts/cluster-init-node
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ FreeBSD)
ssh -t $node env ASSUME_ALWAYS_YES=yes \
pkg upgrade -y
ssh -t $node env ASSUME_ALWAYS_YES=yes \
pkg install -y subversion rsync ca_root_nss iftop bash
pkg install -y spcm subversion rsync ca_root_nss iftop bash

printf "Syncing ports "
if [ -e /usr/ports ]; then
Expand All @@ -182,7 +182,6 @@ FreeBSD)
ssh -t $node portsnap fetch extract
fi

ssh $node pkg install -y spcm
ssh $node auto-append-line powerd 'powerd_enable="YES"' /etc/rc.conf $0

# Pull ssh keys from node
Expand Down
14 changes: 13 additions & 1 deletion FreeBSD/Sys-scripts/cluster-setup
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,18 @@ EOM
read share

if [ 0$share != 0 ]; then
if [ ! -e $share ]; then
printf "$share does not exist. Create directory? y/[n] "
read create
if [ 0$create = 0y ]; then
mkdir -p $share
else
continue
fi
elif [ ! -d $share ]; then
printf "$share exists but is not a directory.\n"
continue
fi
mount_flags="-maproot=root -network $subnet -mask $NETMASK"
read -p "Allow mounting any subdirectory of $share? [y]/n " alldirs
if [ 0$alldirs != 0n ]; then
Expand All @@ -327,7 +339,7 @@ EOM
zfs get sharenfs
else
printf "Updating /etc/exports...\n"
auto-append-line "$share\t$mount_flags" /etc/exports $0
auto-append-line "$share $mount_flags" /etc/exports $0
auto-nfs-restart
fi
fi
Expand Down

0 comments on commit bf1fb59

Please sign in to comment.