cifs -> nfs
This commit is contained in:
parent
3e82543b09
commit
e5ce643143
1 changed files with 15 additions and 13 deletions
28
setup.sh
28
setup.sh
|
@ -157,28 +157,30 @@ echo 'neofetch' >/etc/profile.d/90-neofetch.sh
|
|||
chmod +x /etc/profile.d/90-neofetch.sh
|
||||
|
||||
###############################################################################
|
||||
# CIFS mounts #
|
||||
# NFS mounts #
|
||||
###############################################################################
|
||||
CIFS_HOSTS=(jimmu keiko keitai)
|
||||
OPTS=(); for h in "${CIFS_HOSTS[@]}"; do OPTS+=("$h" "" OFF); done
|
||||
SEL_HOSTS=$(whiptail --title "CIFS Mounts" --checklist \
|
||||
NFS_HOSTS=(jimmu keiko keitai)
|
||||
OPTS=(); for h in "${NFS_HOSTS[@]}"; do OPTS+=("$h" "" OFF); done
|
||||
SEL_HOSTS=$(whiptail --title "NFS Mounts" --checklist \
|
||||
"Select NAS shares to mount under /media:" 15 60 6 \
|
||||
"${OPTS[@]}" 3>&1 1>&2 2>&3) || true
|
||||
|
||||
mkdir -p /media
|
||||
for host in "${CIFS_HOSTS[@]}"; do
|
||||
TEMPLATE="//${host}.wageshouse/Data /media/${host} cifs username=%s,password=%s,_netdev,vers=2.0 0 0"
|
||||
for host in "${NFS_HOSTS[@]}"; do
|
||||
TEMPLATE="${host}.wageshouse:/Data /media/${host} nfs4 _netdev,x-systemd.automount,noatime 0 0"
|
||||
if [[ $SEL_HOSTS == *\"$host\"* ]]; then
|
||||
U=$(whiptail --inputbox "[$host] CIFS username:" 8 50 3>&1 1>&2 2>&3) || exit 1
|
||||
P=$(whiptail --passwordbox "[$host] CIFS password:" 8 50 3>&1 1>&2 2>&3) || exit 1
|
||||
printf -v LINE "$TEMPLATE" "$U" "$P"
|
||||
mkdir -p "/media/$host"
|
||||
grep -q "${host}.wageshouse" /etc/fstab && sed -i "#${host}\.wageshouse#d" /etc/fstab
|
||||
echo "$LINE" >> /etc/fstab
|
||||
grep -q "${host}.wageshouse" /etc/fstab && \
|
||||
sed -i "#${host}\.wageshouse#d" /etc/fstab
|
||||
echo "$TEMPLATE" >> /etc/fstab
|
||||
else
|
||||
grep -q "${host}.wageshouse" /etc/fstab || printf "# $TEMPLATE\n" "username" "password" >> /etc/fstab
|
||||
grep -q "${host}.wageshouse" /etc/fstab || echo "# $TEMPLATE" >> /etc/fstab
|
||||
fi
|
||||
done
|
||||
if ! mount -a 2>>"$LOGFILE"; then msg "⚠️ Some CIFS mounts failed. Re-run the script to correct credentials."; fi
|
||||
|
||||
if ! mount -a 2>>"$LOGFILE"; then
|
||||
msg "⚠️ Some NFS mounts failed. Re-run the script to check configuration."
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
# Summary #
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue