From d4d0debe308514dfb7d0537650c656378965bf02 Mon Sep 17 00:00:00 2001 From: sean Date: Mon, 8 Jul 2019 17:48:59 -0700 Subject: [PATCH] mods --- setup.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/setup.sh b/setup.sh index e69de29..d71f438 100644 --- a/setup.sh +++ b/setup.sh @@ -0,0 +1,39 @@ +#! /bin/bash + +# fresh update on apt in Ubuntu +echo "Updating and upgrading local packages..." +apt-add-repository universe && apt update >/dev/null 2>/dev/null && apt upgrade -y >/dev/null 2>/dev/null +if [ "$?" = "0" ]; then + echo "Done.\n" +else + echo "Failed to add universal repository, update apt repository, or upgrade - possibly bad network connection" + exit 1 +fi + +echo "Installing required setup configuration utilities..." +apt install -y dialog net-tools gdisk zfs-initramfs debootstrap >/dev/null 2>/dev/null +if [ "$?" = "0" ]; then + echo "Done.\n" +else + echo "Failed to install net-tools, gdisk, zfs-initramfs, or debootstrap" + exit 2 +fi + +#calculate width and height of console +width=`tput cols` +height=`tput lines` + +# set line separator +IFS=$'\n' + +devices=""; for device in $(ls /dev/disk/by-id | grep -v part); do devices="$devices $device off"; done +disks=`dialog --separate-output --no-collapse --no-items --title "Root devices" --checklist "Select boot drives" $height $width ${window}$devices 2>&1 1>/dev/tty` + +for disk in "$disks"; do + # remove echo for testing + echo "Partitioning disk $disk..." + echo "sgdisk --zap-all /dev/disk/by-id/$disk >/dev/null 2>/dev/null" + echo "sgdisk -n2:1M:+512M -t2:EF00 /dev/disk/by-id/$disk >/dev/null 2>/dev/null" + echo "sgdisk -n3:0:+512M -t3:BF01 /dev/disk/by-id/$disk >/dev/null 2>/dev/null" + echo "Done." +done \ No newline at end of file