test
sean 7 years ago
parent 9e4fc3b35c
commit b75109612f

@ -33,7 +33,12 @@ hostname=""; while [ -z "$hostname" ]; do hostname=`dialog --no-cancel --inputbo
nicdevices=""; for nic in $(ip -o link show | awk -F': ' '{print $2}' | grep -v '^lo'); do nicdevices="$nicdevices $nic off"; done
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`
admin=""; while [ -z "$admin" ]; do admin=`dialog --no-cancel --inputbox "Admin account/first user (with sudo capability)" 8 100 2>&1 >/dev/tty`; done
rootpassword=`dialog --no-cancel --title "Root password" --insecure --passwordbox "Enter root password" $height $width 2>&1 1>/dev/tty`
rootpassword=`dialog --no-cancel --title "Root password" --insecure --passwordbox "Enter root password" 10 30 2>&1 1>/dev/tty`
confirmpassword=`dialog --no-cancel --title "Root password confirmation" --insecure --passwordbox "Re-enter root password" 10 30 2>&1 1>/dev/tty`
if ! [ "$rootpassword" = "$confirmpassword" ]; then
echo "Password does not match confirmation - please retry the setup"
exit 10
fi
timezone=`dialog --no-cancel --title "Timezone" --inputbox "Enter time zone" $height $width "America/Los_Angeles" 2>&1 1>/dev/tty`
for disk in `echo "$disks"`; do
@ -89,7 +94,7 @@ fi
echo "Done."
echo ""
echo "Starting debian bootstrap - this can take some time..."
echo "Bootstrapping..."
#debootstrap bionic /mnt
errors=`debootstrap bionic /mnt 2>&1 1>/dev/null`
if ! [ "$?" = "0" ]; then
@ -149,7 +154,7 @@ done
echo "Done."
echo ""
echo "Setting up bpoo import service"
echo "Setting up boot pool import service..."
echo "[Unit]"> /mnt/etc/systemd/system/zfs-import-bpool.service
echo " DefaultDependencies=no" >> /mnt/etc/systemd/system/zfs-import-bpool.service
echo " Before=zfs-import-scan.service" >> /mnt/etc/systemd/system/zfs-import-bpool.service
@ -179,30 +184,46 @@ mount --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys
echo "Done."
echo ""
echo "Entering chroot..."
echo "#!/bin/bash" > /mnt/setup-chroot.sh
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
echo "echo \"\"" >> /mnt/setup-chroot.sh
echo "echo \"Mounting /proc/self/mounts...\"" >> /mnt/setup-chroot.sh
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 "apt update" >> /mnt/setup-chroot.sh
#echo "errors=`apt update 2\>\&1 1\>/dev/null`" >> /mnt/setup-chroot.sh
echo "echo \"Updating apt repositories on root pool...\"" >> /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 ' echo "Failed to update apt repositories on root pool - $errors"' >> /mnt/setup-chroot.sh
echo " exit 1">> /mnt/setup-chroot.sh
echo "fi">> /mnt/setup-chroot.sh
echo "echo \"Done.\"">> /mnt/setup-chroot.sh
echo "echo \"\"">> /mnt/setup-chroot.sh
echo "echo \"Setting locale...\"" >> /mnt/setup-chroot.sh
echo "locale-gen en_US.UTF-8" >> /mnt/setup-chroot.sh
echo 'errors=`locale-gen en_US.UTF-8 2>&1 1>/dev/null`' >> /mnt/setup-chroot.sh
echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh
echo ' echo "Failed to set the locale to en_US.UTF-8 - $errors"' >> /mnt/setup-chroot.sh
echo " exit 1">> /mnt/setup-chroot.sh
echo "fi">> /mnt/setup-chroot.sh
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
echo "echo \"\""
echo "echo \"Setting time zone...\""
echo "cp /usr/share/zoneinfo/$timezone /etc/localtime" >> /mnt/setup-chroot.sh
echo "apt install -y --no-install-recommends linux-image-generic" >> /mnt/setup-chroot.sh
echo "apt install -y vim bash screen tmux zfs-initramfs dosfstools openssh-server">> /mnt/setup-chroot.sh
echo "echo \"Done.\""
echo "echo \"\""
echo "echo \"Installing linux image, bash, screen, tmux, zfs, dosfstools, openssh...\""
echo 'errors=`apt install -y --no-install-recommends linux-image-generic 2>&1 1>/dev/null && apt install -y vim bash screen tmux zfs-initramfs dosfstools openssh-server 2>&1 1>/dev/null`' >> /mnt/setup-chroot.sh
echo 'if ! [ "$?" = "0" ]; then '>> /mnt/setup-chroot.sh
echo ' echo "Failed to install preliminary software - $errors"' >> /mnt/setup-chroot.sh
echo " exit 1">> /mnt/setup-chroot.sh
echo "fi">> /mnt/setup-chroot.sh
echo "echo \"Done.\"" >> /mnt/setup-chroot.sh
firstdisk=`echo "$disks" | top -n1`
firstdisk=`echo "$disks" | head -n1`
echo "mkdosfs -F 32 -s 1 -n EFI /dev/disk/by-id/${firstdisk}-part2" >> /mnt/setup-chroot.sh
echo "mkdir /boot/efi" >> /mnt/setup-chroot.sh
echo "echo PARTUUID=$(blkid -s PARTUUID -o value /dev/disk/by-id/${firstdisk}-part2) /boot/efi vfat nofail,x-systemd.device-timeout=0 0 1 >> /etc/fstab" >> /mnt/setup-chroot.sh

Loading…
Cancel
Save