Update Installer.sh

Added dialog questions for username and hostname.
Storing username in system.
Added downloading of AddHost.sh tool to /opt/

Debian:
Setting up configured hostname.
Seting up timezone to Amsterdam.
Removing default MOTD.
Adding custom MOTD.
This commit is contained in:
b.waal 2023-09-25 02:06:36 +02:00
parent dc10e395db
commit c9438d6b1b

View File

@ -39,6 +39,12 @@ fi
# Menu #
##----------##
NAME=$(whiptail --nocancel --inputbox "What is your name?" 8 39 John --title "Welcome" 3>&1 1>&2 2>&3)
HOSTNAME=$(whiptail --nocancel --inputbox "What is the name of this machine?\n(only az-AZ 0-9 characters are allowed)" 8 43 PiHole --title "Welcome $NAME!" 3>&1 1>&2 2>&3)
HOSTNAME=$(echo $HOST | tr -dc '[:alnum:]\n\r')
if [[ $dist == "Alpine" ]]; then
if (whiptail --title "Setup" --yesno "Use an APT-Cacher?" 8 78); then
CACHE=$(whiptail --inputbox "What is the IP address for APT-Cacher?" 8 78 192.168.1.102 --title "Setup" 3>&1 1>&2 2>&3)
@ -117,7 +123,11 @@ if [[ $dist == "Alpine" ]]; then
fi
if [[ $dist == "Debian" ]]; then
hostnamectl set-hostname $HOSTNAME
timedatectl set-timezone Europe/Amsterdam
IP=`hostname -I` && IP=$(echo $IP | cut -d' ' -f2,3)
rm /etc/motd
rm /etc/update-motd.d/10-uname
fi
mkdir -p /etc/pihole
@ -245,9 +255,25 @@ if [[ $L2R == "true" ]]; then
fi
##--------------##
# Store Vars #
##--------------##
echo $NAME > /etc/username
#echo $OPTIONS >> /etc/installedmodules
#sed -i 's/\s\+/\n/g' /etc/installedmodules
#sed -i 's/\"//g' /etc/installedmodules
##-------------##
# Finishing #
##-------------##
wget $GIT/$BRANCH/Tools/AddHost.sh -O /opt/AddHost.sh
if [[ $dist == "Debian" ]]; then
wget $GIT/$BRANCH/MOTD/greetings.sh -O /etc/profile.d/greeting.sh
fi
whiptail --title "Done!" --msgbox "Pi-Hole is now available on http://$IP/admin\n\nPress OK to continue." 10 78
exit