Update setup.sh

This commit is contained in:
Jordan Wages 2025-07-25 18:42:37 -05:00
parent 070e651f45
commit 9c24ea31f1

View file

@ -86,24 +86,6 @@ sed -i "s/$OLD_HOST/$NEW_HOST/g" /etc/hosts
hostnamectl set-hostname "$NEW_HOST"
msg "Hostname set to $NEW_HOST"
###############################################################################
# SSH keys for root #
###############################################################################
install -d -m 700 /root/.ssh
chmod 700 /root/.ssh
test -n "$DEFAULT_SSH_KEY" && {
grep -qxF "$DEFAULT_SSH_KEY" /root/.ssh/authorized_keys 2>/dev/null || \
echo "$DEFAULT_SSH_KEY" >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
msg "Default SSH key added for root"
}
if confirm "Add additional SSH public key for root?"; then
KEY=$(whiptail --title "SSH Key (root)" --inputbox "Paste your public key for root:" 12 70 3>&1 1>&2 2>&3) || die "Cancelled"
grep -qxF "$KEY" /root/.ssh/authorized_keys 2>/dev/null || echo "$KEY" >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
msg "Additional SSH key added for root"
fi
###############################################################################
# SSH keys for user jordanwages #
###############################################################################
@ -163,7 +145,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 ! (systemctl daemon-reload && mount -a) 2>>"$LOGFILE"; then msg "⚠️ Some CIFS mounts failed. Re-run the script to correct credentials."; fi
###############################################################################
# Summary #