test
sean 7 years ago
parent 5e83fbf3d2
commit a02cf785e5

@ -28,29 +28,32 @@ window=$((height - 5))
# set line separator # set line separator
devices=""; for device in $(ls /dev/disk/by-id | grep -v part); do devices="$devices $device off"; done devices=""; for device in $(ls /dev/disk/by-id | grep -v part); do devices="$devices $device off"; done
disks=`dialog --separate-output --no-cancel --no-items --title "Root devices" --checklist "Select boot drives" $height $width ${window}$devices 2>&1 1>/dev/tty` disks=`dialog --separate-output --no-cancel --no-items --title "Root devices" --checklist "Select boot drives" $height $width ${window}$devices 2>&1 1>/dev/tty`
raidtype=`dialog --no-items --no-cancel --title "Root pool ZFS RAID" --radiolist "Select root pool ZFS RAID type" 11 35 4 raidz off raidz2 off mirror off none off 2>&1 1>/dev/tty`
hostname=""; while [ -z "$hostname" ]; do hostname=`dialog --no-cancel --inputbox "Host name/Server name" 8 100 2>&1 >/dev/tty`; done hostname=""; while [ -z "$hostname" ]; do hostname=`dialog --no-cancel --inputbox "Host name/Server name" 8 100 2>&1 >/dev/tty`; done
nicdevices=""; for nic in $(ip -o link show | awk -F': ' '{print $2}' | grep -v '^lo'); do nicdevices="$nicdevices $nic off"; done 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` 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`
for disk in "$disks"; do IFS=$'\n'
for disk in `echo $disks`; do
# remove echo for testing # remove echo for testing
echo "Partitioning disk $disk..." echo "Partitioning disk $disk..."
# collect the return values, check them for errors and display them # collect the return values, check them for errors and display them
echo "sgdisk --zap-all /dev/disk/by-id/$disk >/dev/null 2>&1" errors=`sgdisk --zap-all /dev/disk/by-id/$disk >/dev/null 2>&1 && sgdisk -n2:1M:+512M -t2:EF00 /dev/disk/by-id/$disk >/dev/null 2>&1 && sgdisk -n3:0:+512M -t3:BF01 /dev/disk/by-id/$disk >/dev/null 2>&1 && sgdisk -n4:0:0 -t4:BF01 /dev/disk/by-id/$disk >/dev/null 2>&1`
echo "sgdisk -n2:1M:+512M -t2:EF00 /dev/disk/by-id/$disk >/dev/null 2>&1" if ! [ "$?" = "0" ]; then
echo "sgdisk -n3:0:+512M -t3:BF01 /dev/disk/by-id/$disk >/dev/null 2>&1" echo "Failed to partition disk $disk - $errors"
echo "sgdisk -n4:0:0 -t4:BF01 /dev/disk/by-id/$disk >/dev/null 2>&1" exit 3
fi
echo "Done." echo "Done."
done done
# create boot mirror list # create boot mirror list
bootmirror=""; for disk in "$disks": do bootmirror="$bootmirror /dev/disk/by-id/${disk}-part3"; done bootmirror=""; for disk in "$disks": do bootmirror="$bootmirror /dev/disk/by-id/${disk}-part3"; done
rootraidz=""; for disk in "$disks"; do rootraidz="$rootraidz /dev/disk/by-id/${disk}-part4"; done rootraidz=""; for disk in "$disks"; do rootraidz="$rootraidz /dev/disk/by-id/${disk}-part4"; done
echo "zpool create -f -o ashift=12 -d -o feature@async_destroy=enable -o feature@bookmarks=enabled -o feature@embedded_data=enabled -o feature@empty_bpobj=enabled -o feature@enabled_txg=enabled -o feature@extensible_dataset=enabled -o feature@filesystem_limits=enabled -o feature@hole_birth=enabled -o feature@large_blocks=enabled -o feature@lz4_compress=enabled -o feature@spacemap_histogram=enabled -o feature@userobj_accounting=enabled -O acltype=posixacl -O canmount=off -O compression=lz4 -O devices=off -O normalization=formD -O relatime=on -O xattr=sa -O mountpoint=/ -R /mnt bpool mirror$bootmirror" echo "zpool create -f -o ashift=12 -d -o feature@async_destroy=enable -o feature@bookmarks=enabled -o feature@embedded_data=enabled -o feature@empty_bpobj=enabled -o feature@enabled_txg=enabled -o feature@extensible_dataset=enabled -o feature@filesystem_limits=enabled -o feature@hole_birth=enabled -o feature@large_blocks=enabled -o feature@lz4_compress=enabled -o feature@spacemap_histogram=enabled -o feature@userobj_accounting=enabled -O acltype=posixacl -O canmount=off -O compression=lz4 -O devices=off -O normalization=formD -O relatime=on -O xattr=sa -O mountpoint=/ -R /mnt bpool mirror$bootmirror"
raidtype=`dialog --no-items --no-cancel --title "Root pool ZFS RAID" --radiolist "Select root pool ZFS RAID type" 11 35 4 raidz off raidz2 off mirror off none off 2>&1 1>/dev/tty`
if [ "$raidtype" = "none" ]; then if [ "$raidtype" = "none" ]; then
raidtype="" raidtype=""
else else

Loading…
Cancel
Save