Update setup.sh
This commit is contained in:
parent
567d33ff7d
commit
2d713d5f9a
1 changed files with 5 additions and 6 deletions
11
setup.sh
11
setup.sh
|
@ -11,16 +11,15 @@ set -euo pipefail
|
|||
DEFAULT_SSH_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCoxUu/nC1C03LvxIhCMzyMu7CAfIp9+Rbt4vmx8q3ER1EPP2K53fnjUmOijC4YY2jgPHHXEoTgC6Rlcrl3eYFoqbhRc4nweN6Z3LXRghmfNXVmMRSouXEMWhxhPjk9r+w9+3E9+6p9X9YtQu+u76ArWcY9MgvD6Awvo66hSFgkzeXzgCcKkTdMkSOUwuHfm8Ja9TzSIUfnB6SAiKWLIejDntYJHSKoqsSzsovYRUc/W+al09MfIMWwN9vJwk7WM7O3E+YPL5Zcpmr4jaoFULf6hWtgn688nDU+4V0POIzRNnk4EPH5qo+AmSL7MwQ0Bh7z5EgiAJiAryrT/GnU41w7 rsa-key-20240415"
|
||||
|
||||
###############################################################################
|
||||
# Early root escalation
|
||||
# Ensure running as root #
|
||||
###############################################################################
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
if command -v whiptail &>/dev/null; then
|
||||
PW=$(whiptail --passwordbox "Root privileges required.\nEnter root password:" 10 60 3>&1 1>&2 2>&3) || exit 1
|
||||
exec su root -c "bash -s -- \"$@\"" <<<"$PW"
|
||||
whiptail --title "Error" --msgbox "This script must be run as root." 10 60
|
||||
else
|
||||
echo "Root privileges required; re-running under su..."
|
||||
exec su -c "bash -s -- \"$@\"" root
|
||||
echo "Error: This script must be run as root." >&2
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
|
@ -164,7 +163,7 @@ for host in "${CIFS_HOSTS[@]}"; do
|
|||
grep -q "${host}.wageshouse" /etc/fstab || printf "# $TEMPLATE\n" "username" "password" >> /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 CIFS mounts failed. Re-run the script to correct credentials."; fi
|
||||
|
||||
###############################################################################
|
||||
# Summary #
|
||||
|
|
Loading…
Reference in a new issue