From ed60d2c4fa5ed06ebe0281fd5eb306146bc60638 Mon Sep 17 00:00:00 2001 From: sean Date: Tue, 23 Jul 2019 16:53:33 -0700 Subject: [PATCH] tweaks --- setup.sh | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/setup.sh b/setup.sh index f5509e3..c26a34b 100644 --- a/setup.sh +++ b/setup.sh @@ -12,7 +12,7 @@ fi echo "" echo "Installing required setup configuration utilities..." -errors=$(apt install -y net-tools gdisk zfs-initramfs debootstrap >/dev/null 2>/dev/null) +errors=$(apt install -y dialog net-tools gdisk zfs-initramfs debootstrap >/dev/null 2>/dev/null) if [ "$?" = "0" ]; then echo "Done." else @@ -27,7 +27,7 @@ window=$((height - 5)) # gather input at the start devices=""; for device in $(ls /dev/disk/by-id | grep -v part); do devices="$devices $device off"; done -disks=`whiptail --separate-output --no-cancel --no-items --title "Root devices" --checklist "Select root OS disks:" $height $width ${window}$devices 2>&1 1>/dev/tty` +disks=`dialog --separate-output --no-cancel --no-items --title "Root devices" --checklist "Select root OS disks:" $height $width ${window}$devices 2>&1 1>/dev/tty` diskcount=`echo "$disks" | wc -l` diskoptions="12 35 5 raidz off raidz2 off raidz3 off mirror off none off" if [ "$diskcount" = "0" ] ; then echo "No disks found to use for boot device"; exit 112; fi @@ -39,41 +39,41 @@ if [ "$diskcount" = "5" ]; then diskoptions="12 35 5 raidz off raidz2 off raidz3 if [ "$diskcount" = "6" ]; then diskoptions="12 35 5 raidz off raidz2 off raidz3 off mirror off none off"; fi if [ "$diskcount" -gt "6" ]; then diskoptions="11 35 4 raidz2 off raidz3 off mirror off none off"; fi if [ "$diskcount" -gt "11" ]; then diskoptions="10 35 3 raidz3 off mirror off none off"; fi -raidtype=`whiptail --no-items --no-cancel --title "Root pool ZFS RAID" --radiolist "Select root pool ZFS RAID type:" $diskoptions 2>&1 1>/dev/tty` -hostname=""; while [ -z "$hostname" ]; do hostname=`whiptail --no-cancel --inputbox "Hostname:" 8 40 2>&1 >/dev/tty`; done -domainname=""; while [ -z "$domainname" ]; do domainname=`whiptail --no-cancel --inputbox "Domain name root (for fully qualified domain, e.g. company.com):" 8 40 2>&1 >/dev/tty`; done +raidtype=`dialog --no-items --no-cancel --title "Root pool ZFS RAID" --radiolist "Select root pool ZFS RAID type:" $diskoptions 2>&1 1>/dev/tty` +hostname=""; while [ -z "$hostname" ]; do hostname=`dialog --no-cancel --inputbox "Hostname:" 8 40 2>&1 >/dev/tty`; done +domainname=""; while [ -z "$domainname" ]; do domainname=`dialog --no-cancel --inputbox "Domain name root (for fully qualified domain, e.g. company.com):" 8 40 2>&1 >/dev/tty`; done fqdn="${hostname}.${domainname}" nicdevices=""; for nic in $(ip -o link show | awk -F': ' '{print $2}' | grep -v '^lo'); do nicdevices="$nicdevices $nic off"; done -nics=`whiptail --separate-output --no-cancel --no-items --title "Bridged network devices" --checklist "Select the network devices to be bridged to br0:" $height $width ${window}$nicdevices 2>&1 1>/dev/tty` -networktype=`whiptail --no-items --no-cancel --title "Network type" --radiolist "Select the network type:" 9 40 2 dhcp off static off 2>&1 1>/dev/tty` +nics=`dialog --separate-output --no-cancel --no-items --title "Bridged network devices" --checklist "Select the network devices to be bridged to br0:" $height $width ${window}$nicdevices 2>&1 1>/dev/tty` +networktype=`dialog --no-items --no-cancel --title "Network type" --radiolist "Select the network type:" 9 40 2 dhcp off static off 2>&1 1>/dev/tty` if [ "$networktype" = "static" ]; then - address=""; while [ -z "$address" ]; do address=`whiptail --no-cancel --inputbox "IP Address:" 8 40 2>&1 >/dev/tty`; done - subnet=""; while [ -z "$subnet" ]; do subnet=`whiptail --no-cancel --inputbox "Subnet mask:" 8 40 2>&1 >/dev/tty`; done - gateway=""; while [ -z "$gateway" ]; do gateway=`whiptail --no-cancel --inputbox "Gateway:" 8 40 2>&1 >/dev/tty`; done - dns1=""; while [ -z "$dns1" ]; do dns1=`whiptail --no-cancel --inputbox "Primary DNS server:" 8 40 2>&1 >/dev/tty`; done - dns2=`whiptail --no-cancel --inputbox "Secondary DNS server:" 8 40 2>&1 >/dev/tty` + address=""; while [ -z "$address" ]; do address=`dialog --no-cancel --inputbox "IP Address:" 8 40 2>&1 >/dev/tty`; done + subnet=""; while [ -z "$subnet" ]; do subnet=`dialog --no-cancel --inputbox "Subnet mask:" 8 40 2>&1 >/dev/tty`; done + gateway=""; while [ -z "$gateway" ]; do gateway=`dialog --no-cancel --inputbox "Gateway:" 8 40 2>&1 >/dev/tty`; done + dns1=""; while [ -z "$dns1" ]; do dns1=`dialog --no-cancel --inputbox "Primary DNS server:" 8 40 2>&1 >/dev/tty`; done + dns2=`dialog --no-cancel --inputbox "Secondary DNS server:" 8 40 2>&1 >/dev/tty` fi -admin=""; while [ -z "$admin" ]; do admin=`whiptail --no-cancel --inputbox "Admin user:" 8 40 2>&1 >/dev/tty`; done +admin=""; while [ -z "$admin" ]; do admin=`dialog --no-cancel --inputbox "Admin user:" 8 40 2>&1 >/dev/tty`; done rootpassword="" while [ "$rootpassword" = "" ]; do - rootpassword=`whiptail --no-cancel --title "Root password" --insecure --passwordbox "Enter root password:" 8 40 2>&1 1>/dev/tty` - confirmpassword=`whiptail --no-cancel --title "Root password confirmation" --insecure --passwordbox "Re-enter root password:" 8 40 2>&1 1>/dev/tty` + rootpassword=`dialog --no-cancel --title "Root password" --insecure --passwordbox "Enter root password:" 8 40 2>&1 1>/dev/tty` + confirmpassword=`dialog --no-cancel --title "Root password confirmation" --insecure --passwordbox "Re-enter root password:" 8 40 2>&1 1>/dev/tty` if ! [ "$rootpassword" = "$confirmpassword" ]; then echo "Password does not match confirmation - please retry the setup" rootpassword="" fi done -admins=`whiptail --no-items --no-cancel --title "Root pool ZFS RAID" --inputbox "List administrator e-mail addresses separated by comma:" 10 40 2>&1 1>/dev/tty` +admins=`dialog --no-items --no-cancel --title "Root pool ZFS RAID" --inputbox "List administrator e-mail addresses separated by comma:" 10 40 2>&1 1>/dev/tty` a=""; for x in `timedatectl list-timezones`; do a="$a $x" ; done -smtp=""; while [ -z "$smtp" ]; do smtp=`whiptail --no-cancel --inputbox "Outoing e-mail SMTP proxy server:" 8 40 2>&1 >/dev/tty`; done -email=""; while [ -z "$email" ]; do email=`whiptail --no-cancel --inputbox "Outgoing mail username:" 8 40 2>&1 >/dev/tty`; done +smtp=""; while [ -z "$smtp" ]; do smtp=`dialog --no-cancel --inputbox "Outoing e-mail SMTP proxy server:" 8 40 2>&1 >/dev/tty`; done +email=""; while [ -z "$email" ]; do email=`dialog --no-cancel --inputbox "Outgoing mail username:" 8 40 2>&1 >/dev/tty`; done emailpassword="" while [ "$emailpassword" = "" ]; do - emailpassword=`whiptail --no-cancel --title "Outgoing e-mail SMTP mail password" --insecure --passwordbox "Enter outgoing e-mail SMTP password:" 8 40 2>&1 1>/dev/tty` - confirmpassword=`whiptail --no-cancel --title "Outgoing e-mail SMTP mail password" --insecure --passwordbox "Re-enter outgoing e-mail SMTP password:" 8 40 2>&1 1>/dev/tty` + emailpassword=`dialog --no-cancel --title "Outgoing e-mail SMTP mail password" --insecure --passwordbox "Enter outgoing e-mail SMTP password:" 8 40 2>&1 1>/dev/tty` + confirmpassword=`dialog --no-cancel --title "Outgoing e-mail SMTP mail password" --insecure --passwordbox "Re-enter outgoing e-mail SMTP password:" 8 40 2>&1 1>/dev/tty` if ! [ "$emailpassword" = "$confirmpassword" ]; then echo "Password does not match confirmation - please retry the setup" emailpassword="" @@ -81,9 +81,9 @@ while [ "$emailpassword" = "" ]; do done -timezone=`whiptail --no-items --no-cancel --menu "Select time zone:" $height 40 ${window}${a} 2>&1 1>/dev/tty` +timezone=`dialog --no-items --no-cancel --menu "Select time zone:" $height 40 ${window}${a} 2>&1 1>/dev/tty` #timedatectl list-timezones -#timezone=`whiptail --no-cancel --title "Timezone" --inputbox "Time zone:" 8 40 "America/Los_Angeles" 2>&1 1>/dev/tty` +#timezone=`dialog --no-cancel --title "Timezone" --inputbox "Time zone:" 8 40 "America/Los_Angeles" 2>&1 1>/dev/tty` for disk in `echo "$disks"`; do echo ""