From 45b20879eb281bacaaa6083e5d1486d4987abd5b Mon Sep 17 00:00:00 2001 From: sean Date: Tue, 9 Jul 2019 14:46:10 -0700 Subject: [PATCH] tweaks --- setup-chroot.sh | 3 +++ setup.sh | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 setup-chroot.sh diff --git a/setup-chroot.sh b/setup-chroot.sh new file mode 100644 index 0000000..6f6cd21 --- /dev/null +++ b/setup-chroot.sh @@ -0,0 +1,3 @@ +#! /bin/bash +echo "chroot!!!" +exit 0 \ No newline at end of file diff --git a/setup.sh b/setup.sh index a94c8c9..750228b 100644 --- a/setup.sh +++ b/setup.sh @@ -156,11 +156,40 @@ for nic in `echo "$nicdevices"`; do echo " - ${nic}" >> /mnt/etc/netplan/bridge.yaml done echo "Done." + +echo "" +echo "Mounting chroot mounts..." +mount --rbind /dev /mnt/dev +mount --rbind /proc /mnt/proc +mount --rbind /sys /mnt/sys +echo "Done." + +echo "" +echo "Downloading chroot configuration script..." +wget -qO - https://code.totosearch.org/Sean/ServerSetup/raw/branch/master/setup-chroot.sh > /mnt/setup-chroot.sh +echo "Done." +chroot /mnt /setup-chroot.sh --login + +echo "" +echo "Clearing chroot configuration script..." +rm /mnt/setup-chroot.sh +echo "Done." + +echo "" +echo "Unmounting chroot mounts..." +mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | xargs -i{} umount -lf {} +echo "Done." + +echo "" +echo "Exporting zpools..." +errors=`zpool export -a 2>&1 1>/dev/null` +if ! [ "$?" = "0" ]; then + echo "Couldn't export mounted zpools - $errors" + exit 8 +fi +echo "Done." + exit 0 -# mount --rbind /dev /mnt/dev -# mount --rbind /proc /mnt/proc -# mount --rbind /sys /mnt/sys -# chroot /mnt /bin/bash --login # ln -s /proc/self/mounts /etc/mtab # apt update