From c9438d6b1bfd7cfa5085880ea230d8f699bbd3ca Mon Sep 17 00:00:00 2001 From: "b.waal" Date: Mon, 25 Sep 2023 02:06:36 +0200 Subject: [PATCH] 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. --- Installer.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Installer.sh b/Installer.sh index fea0968..d9a5ddf 100644 --- a/Installer.sh +++ b/Installer.sh @@ -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 \ No newline at end of file