testing
This commit is contained in:
parent
5e6dc73ce5
commit
0218dd9023
49
debianzfs.sh
49
debianzfs.sh
@ -97,16 +97,6 @@ function create_root_pool () {
|
||||
rpool $2
|
||||
}
|
||||
|
||||
function mirror_grub () {
|
||||
DISK1=$(disk_by_id "$1")
|
||||
DISK2=$(disk_by_id "$2")
|
||||
umount /boot/efi
|
||||
dd if="${DISK1}-part2" of="${DISK2}-part2"
|
||||
efibootmgr -c -g -d "$DISK2" -p 2 \
|
||||
-L "debian-${3}" -l '\EFI\debian\grubx64.efi'
|
||||
mount /boot/efi
|
||||
}
|
||||
|
||||
function disk_by_id () {
|
||||
disk_check "$1"
|
||||
OUTPUT=$(find /dev/disk/by-id -lname "../../$(basename "$1")" | tail -n1)
|
||||
@ -117,6 +107,25 @@ function disk_by_id () {
|
||||
echo "$OUTPUT"
|
||||
}
|
||||
|
||||
function part_by_uuid () {
|
||||
OUTPUT=$(blkid -s UUID -o value "${1}-part${2}")
|
||||
if [ -z "$OUTPUT" ]; then
|
||||
echo "ERROR: No disk by-uuid label found for: ${1}-part${2}"
|
||||
exit 1
|
||||
fi
|
||||
echo "$OUTPUT"
|
||||
}
|
||||
|
||||
function mirror_grub () {
|
||||
DISK1=$(disk_by_id "$1")
|
||||
DISK2=$(disk_by_id "$2")
|
||||
umount /boot/efi
|
||||
dd if="${DISK1}-part2" of="${DISK2}-part2"
|
||||
efibootmgr -c -g -d "$DISK2" -p 2 \
|
||||
-L "debian-${3}" -l '\EFI\debian\grubx64.efi'
|
||||
mount /boot/efi
|
||||
}
|
||||
|
||||
################
|
||||
### Settings ###
|
||||
################
|
||||
@ -239,20 +248,28 @@ swapoff --all
|
||||
# 3. Partition your disk(s)
|
||||
# UEFI booting + boot pool + ZFS native encryption
|
||||
disk_format "$DISK"
|
||||
sleep 5
|
||||
DISK_BYID=$(disk_by_id "$DISK")
|
||||
DISK_PART2_BYUUID=$(part_by_uuid "$DISK_BYID" 2)
|
||||
DISK_PART3_BYUUID=$(part_by_uuid "$DISK_BYID" 3)
|
||||
DISK_PART4_BYUUID=$(part_by_uuid "$DISK_BYID" 4)
|
||||
if [ -n "$MIRROR" ]; then
|
||||
disk_format "$MIRROR"
|
||||
sleep 5
|
||||
MIRROR_BYID=$(disk_by_id "$MIRROR")
|
||||
MIRROR_PART2_BYUUID=$(part_by_uuid "$MIRROR_BYID" 2)
|
||||
MIRROR_PART3_BYUUID=$(part_by_uuid "$MIRROR_BYID" 3)
|
||||
MIRROR_PART4_BYUUID=$(part_by_uuid "$MIRROR_BYID" 4)
|
||||
fi
|
||||
|
||||
# 4. Create the boot pool
|
||||
# 5. Create the root pool
|
||||
if [ -z "$MIRROR" ]; then
|
||||
create_boot_pool "$ZFSROOT" "${DISK_BYID}-part3"
|
||||
create_root_pool "$ZFSROOT" "${DISK_BYID}-part4" "$RPOOLPW"
|
||||
create_boot_pool "$ZFSROOT" "$DISK_PART3_BYUUID"
|
||||
create_root_pool "$ZFSROOT" "$DISK_PART4_BYUUID" "$RPOOLPW"
|
||||
else
|
||||
create_boot_pool "$ZFSROOT" "mirror ${DISK_BYID}-part3 ${MIRROR_BYID}-part3"
|
||||
create_root_pool "$ZFSROOT" "mirror ${DISK_BYID}-part4 ${MIRROR_BYID}-part4" "$RPOOLPW"
|
||||
create_boot_pool "$ZFSROOT" "mirror $DISK_PART3_BYUUID $MIRROR_PART3_BYUUID"
|
||||
create_root_pool "$ZFSROOT" "mirror $DISK_PART4_BYUUID $MIRROR_PART4_BYUUID" "$RPOOLPW"
|
||||
fi
|
||||
|
||||
###################################
|
||||
@ -353,8 +370,8 @@ if [ -n "$MIRROR" ]; then
|
||||
#!/bin/bash
|
||||
# Post-install GRUB mirror helper script
|
||||
/usr/local/bin/debianzfs \
|
||||
-gm $(disk_by_id "$MIRROR") \
|
||||
$(disk_by_id "$DISK")
|
||||
-gm "$MIRROR_PART2_BYUUID" \
|
||||
"$DISK_PART2_BYUUID"
|
||||
GRUBMIRROR
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user