parent
8164df6fd4
commit
d4d0debe30
@ -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
|
||||
Loading…
Reference in new issue