diff --git a/setup.sh b/setup.sh index 6300889..cd8ee85 100644 --- a/setup.sh +++ b/setup.sh @@ -2,7 +2,7 @@ echo "" echo "Updating local packages..." -errors=`apt-add-repository universe >/dev/null 2>/dev/null && apt update >/dev/null 2>/dev/null` +errors=`apt-add-repository universe >/dev/null 2>/dev/null && apt update 2>&1 >/dev/null` if [ "$?" = "0" ]; then echo "Done." else @@ -34,6 +34,7 @@ nicdevices=""; for nic in $(ip -o link show | awk -F': ' '{print $2}' | grep -v nics=`dialog --separate-output --no-cancel --no-items --title "Network devices for bridge" --checklist "Select the network devices to be bridged" $height $width ${window}$nicdevices 2>&1 1>/dev/tty` rootpassword=`dialog --no-cancel --title "Root password" --insecure --passwordbox "Enter root password" $height $width 2>&1 1>/dev/tty` timezone=`dialog --no-cancel --title "Timezone" --inputbox "Enter time zone" $height $width "America/Los_Angeles" 2>&1 1>/dev/tty` +admin=""; while [ -z "$admin" ]; do admin=`dialog --no-cancel --inputbox "Admin account/first user (with sudo capability)" 8 100 2>&1 >/dev/tty`; done for disk in `echo "$disks"`; do echo "" @@ -161,8 +162,9 @@ echo "ln -s /proc/self/mounts /etc/mtab" >> /mnt/setup-chroot.sh echo "echo \"Done.\"" >> /mnt/setup-chroot.sh echo "echo \"\"" >> /mnt/setup-chroot.sh echo "echo \"Updating apt repositories inside chroot...\"" >> /mnt/setup-chroot.sh -echo "errors=`apt update 2>&1 1>/dev/null`" >> /mnt/setup-chroot.sh -echo "if ! [ \"\$?\" = \"0\" ]; then ">> /mnt/setup-chroot.sh +echo "apt update" >> /mnt/setup-chroot.sh +#echo "errors=`apt update 2>&1 1>/dev/null`" >> /mnt/setup-chroot.sh +echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh echo " echo \"Failed to update apt repositories inside chroot - \$errors\"" >> /mnt/setup-chroot.sh echo " exit 1">> /mnt/setup-chroot.sh echo "fi">> /mnt/setup-chroot.sh @@ -230,11 +232,12 @@ echo "systemctl enable ssh">> /mnt/setup-chroot.sh # create parker user automated way -#zfs create rpool/home/YOURUSERNAME -# adduser YOURUSERNAME -# cp -a /etc/skel/.[!.]* /home/YOURUSERNAME -# chown -R YOURUSERNAME:YOURUSERNAME /home/YOURUSERNAME -# usermod -a -G adm,cdrom,dip,lpadmin,plugdev,sambashare,sudo YOURUSERNAME +echo "zfs create rpool/home/$admin" >> /mnt/setup-chroot.sh +echo "adduser $admin" >> /mnt/setup-chroot.sh +echo "cp -a /etc/skel/.[!.]* /home/$admin" >> /mnt/setup-chroot.sh +echo "chown -R ${admin}:${admin} /home/$admin" >> /mnt/setup-chroot.sh +echo "usermod -a -G adm,cdrom,dip,lpadmin,plugdev,sambashare,sudo $admin" >> /mnt/setup-chroot.sh +echo "echo '${admin}:${rootpassword}' | chpasswd" >> /mnt/setup-chroot.sh #create swap space, too if necessary @@ -252,7 +255,8 @@ echo "systemctl enable ssh">> /mnt/setup-chroot.sh chmod +x /mnt/setup-chroot.sh echo "Done." -chroot /mnt /setup-chroot.sh --login +chroot /mnt /setup-chroot.sh +#--login #echo "" #echo "Clearing chroot configuration script..."