Compare commits
	
		
			12 Commits
		
	
	
		
			cef71d557a
			...
			testing
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						9977148dd6
	
				 | 
					
					
						|||
| 
						
						
							
						
						df45e39d42
	
				 | 
					
					
						|||
| 
						
						
							
						
						7ea2454c70
	
				 | 
					
					
						|||
| 
						
						
							
						
						43fe76b841
	
				 | 
					
					
						|||
| 
						
						
							
						
						ead7a9f24e
	
				 | 
					
					
						|||
| 
						
						
							
						
						5e6dc73ce5
	
				 | 
					
					
						|||
| 
						
						
							
						
						c4cf616f7b
	
				 | 
					
					
						|||
| 
						
						
							
						
						aaa74697a5
	
				 | 
					
					
						|||
| 
						
						
							
						
						babc015294
	
				 | 
					
					
						|||
| 
						
						
							
						
						087070a3d4
	
				 | 
					
					
						|||
| 
						
						
							
						
						0d99930fa7
	
				 | 
					
					
						|||
| 
						
						
							
						
						e96a557d9a
	
				 | 
					
					
						
@@ -45,7 +45,7 @@ build {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  provisioner "shell" {
 | 
					  provisioner "shell" {
 | 
				
			||||||
     inline = ["sudo /tmp/debianzfs.sh -p changeme -P letmeinzfs! /dev/vda debianzfs"]
 | 
					     inline = ["sudo /tmp/debianzfs.sh -i -s0 -p changeme -P letmeinzfs! /dev/vda debianzfs"]
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										164
									
								
								debianzfs.sh
									
									
									
									
									
								
							
							
						
						
									
										164
									
								
								debianzfs.sh
									
									
									
									
									
								
							@@ -7,18 +7,31 @@
 | 
				
			|||||||
### Functions ###
 | 
					### Functions ###
 | 
				
			||||||
#################
 | 
					#################
 | 
				
			||||||
function usage () {
 | 
					function usage () {
 | 
				
			||||||
  echo "Usage: ./$(basename "$0") [-mpPr] <DISK> <HOSTNAME>"
 | 
						echo "Usage: $(basename "$0") [-ghimpPrs] <DISK> [HOSTNAME]"
 | 
				
			||||||
 | 
						echo -e "\t-g\n\t\tMirror GRUB after the installation. Requires: -m"
 | 
				
			||||||
 | 
						echo -e "\n\t-h\n\t\tThe help menu, i.e., the menu you're seeing now."
 | 
				
			||||||
 | 
						echo -e "\n\t-i\n\t\tIgnore the check for the /dev/disk/by-id/* format. You'll likely want: -s"
 | 
				
			||||||
 | 
						echo -e "\n\t-m <MIRROR>\n\t\tSet the MIRROR disk for a ZFS mirror installation."
 | 
				
			||||||
 | 
						echo -e "\n\t-p <PASSWORD>\n\t\tSet the password for root. Caution: saves to file temporarily."
 | 
				
			||||||
 | 
						echo -e "\n\t-P <PASSWWORD>\n\t\tSet the password for encrypting the root zpool."
 | 
				
			||||||
 | 
						echo -e "\n\t-r <ZFSROOT>\n\t\tSet the path for the new ZFS chroot. Defaults to /mnt"
 | 
				
			||||||
 | 
						echo -e "\n\t-s <PARTSUFFIX>\n\t\tSet the partition suffix for disks, defaults to: -part"
 | 
				
			||||||
 | 
						echo -e "\t\tSet to a zero '0' to remove the suffix entirely, i.e., -s0"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function disk_check () {
 | 
					function disk_check () {
 | 
				
			||||||
  DISK_TYPE=$(file "$1" | awk '{ print $2$3 }')
 | 
						local DISK="$1"
 | 
				
			||||||
 | 
						local DISK_TYPE
 | 
				
			||||||
 | 
						[ -L "$DISK" ] && DISK=$(readlink -f "$DISK")
 | 
				
			||||||
 | 
						DISK_TYPE=$(file "$DISK" | awk '{ print $2$3 }')
 | 
				
			||||||
	if [ "$DISK_TYPE" != "blockspecial" ]; then
 | 
						if [ "$DISK_TYPE" != "blockspecial" ]; then
 | 
				
			||||||
    echo "ERROR: Disk '$1' is not a block device"
 | 
							echo "ERROR: Disk '$DISK' is not a block device"
 | 
				
			||||||
		exit 1
 | 
							exit 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function disk_status () {
 | 
					function disk_status () {
 | 
				
			||||||
 | 
						local OUTPUT
 | 
				
			||||||
	OUTPUT=$(wipefs "$1")
 | 
						OUTPUT=$(wipefs "$1")
 | 
				
			||||||
	if [ -n "$OUTPUT" ]; then
 | 
						if [ -n "$OUTPUT" ]; then
 | 
				
			||||||
		echo "ERROR: $1 is not empty"
 | 
							echo "ERROR: $1 is not empty"
 | 
				
			||||||
@@ -28,6 +41,8 @@ function disk_status () {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function password_prompt () {
 | 
					function password_prompt () {
 | 
				
			||||||
 | 
						local password
 | 
				
			||||||
 | 
						local password_confirm
 | 
				
			||||||
	unset PASSWORD_PROMPT_RESULT
 | 
						unset PASSWORD_PROMPT_RESULT
 | 
				
			||||||
	while true; do
 | 
						while true; do
 | 
				
			||||||
		read -r -s -p "${1}: " password
 | 
							read -r -s -p "${1}: " password
 | 
				
			||||||
@@ -56,6 +71,7 @@ function disk_format () {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function create_boot_pool () {
 | 
					function create_boot_pool () {
 | 
				
			||||||
 | 
						# shellcheck disable=SC2086
 | 
				
			||||||
	zpool create -f \
 | 
						zpool create -f \
 | 
				
			||||||
		-o ashift=12 \
 | 
							-o ashift=12 \
 | 
				
			||||||
		-o autotrim=on -d \
 | 
							-o autotrim=on -d \
 | 
				
			||||||
@@ -79,10 +95,11 @@ function create_boot_pool () {
 | 
				
			|||||||
		-O normalization=formD \
 | 
							-O normalization=formD \
 | 
				
			||||||
		-O relatime=on \
 | 
							-O relatime=on \
 | 
				
			||||||
		-O canmount=off -O mountpoint=/boot -R "$1" \
 | 
							-O canmount=off -O mountpoint=/boot -R "$1" \
 | 
				
			||||||
		bpool "$2"
 | 
							bpool $2
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function create_root_pool () {
 | 
					function create_root_pool () {
 | 
				
			||||||
 | 
						# shellcheck disable=SC2086
 | 
				
			||||||
	echo "$3" | zpool create -f \
 | 
						echo "$3" | zpool create -f \
 | 
				
			||||||
		-o ashift=12 \
 | 
							-o ashift=12 \
 | 
				
			||||||
		-o autotrim=on \
 | 
							-o autotrim=on \
 | 
				
			||||||
@@ -92,7 +109,41 @@ function create_root_pool () {
 | 
				
			|||||||
		-O normalization=formD \
 | 
							-O normalization=formD \
 | 
				
			||||||
		-O relatime=on \
 | 
							-O relatime=on \
 | 
				
			||||||
		-O canmount=off -O mountpoint=/ -R "$1" \
 | 
							-O canmount=off -O mountpoint=/ -R "$1" \
 | 
				
			||||||
		rpool "$2"
 | 
							rpool $2
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function part_path () {
 | 
				
			||||||
 | 
						local DISK="$1"
 | 
				
			||||||
 | 
						local PART="$2"
 | 
				
			||||||
 | 
						[ "$(disk_check "$DISK")" == 1 ] && exit 1
 | 
				
			||||||
 | 
						if [ "${DISK:0:7}" == "/dev/sd" ]; then
 | 
				
			||||||
 | 
							DISK_PART="${DISK}${PART}"
 | 
				
			||||||
 | 
						elif [ "${DISK:0:9}" == "/dev/nvme" ]; then
 | 
				
			||||||
 | 
							DISK_PART="${DISK}p${PART}"
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							echo "ERROR: Disk not recognized"
 | 
				
			||||||
 | 
							exit 1
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						[ "$(disk_check "$DISK_PART")" == 1 ] && exit 1
 | 
				
			||||||
 | 
						echo "$DISK_PART"
 | 
				
			||||||
 | 
						exit 0
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function mirror_grub () {
 | 
				
			||||||
 | 
						umount /boot/efi
 | 
				
			||||||
 | 
						dd if="$1" of="$2"
 | 
				
			||||||
 | 
						efibootmgr -c -g -d "$2" -p 2 \
 | 
				
			||||||
 | 
							-L "debian-${3}" -l '\EFI\debian\grubx64.efi'
 | 
				
			||||||
 | 
						mount /boot/efi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function disk_byid_check () {
 | 
				
			||||||
 | 
						local BYID="/dev/disk/by-id/"
 | 
				
			||||||
 | 
						if [ ! "${1:0:${#BYID}}" == "$BYID" ]; then
 | 
				
			||||||
 | 
							echo "ERROR: DISK needs to be ${BYID}* format"
 | 
				
			||||||
 | 
							exit 1
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################
 | 
					################
 | 
				
			||||||
@@ -103,12 +154,15 @@ export DEBIAN_FRONTEND=noninteractive
 | 
				
			|||||||
CODENAME="bullseye"
 | 
					CODENAME="bullseye"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Options
 | 
					# Options
 | 
				
			||||||
while getopts ':m:p:P:r:' OPTION; do
 | 
					while getopts ':ghim:p:P:r:s:' OPTION; do
 | 
				
			||||||
	case "$OPTION" in
 | 
						case "$OPTION" in
 | 
				
			||||||
 | 
							g) GRUB_MIRROR="true";;
 | 
				
			||||||
 | 
							i) IGNORE_BYID="true";;
 | 
				
			||||||
		m) MIRROR="$OPTARG";;
 | 
							m) MIRROR="$OPTARG";;
 | 
				
			||||||
		p) ROOTPW="$OPTARG";;
 | 
							p) ROOTPW="$OPTARG";;
 | 
				
			||||||
		P) RPOOLPW="$OPTARG";;
 | 
							P) RPOOLPW="$OPTARG";;
 | 
				
			||||||
		r) ZFSROOT="$OPTARG";;
 | 
							r) ZFSROOT="$OPTARG";;
 | 
				
			||||||
 | 
							s) PARTSUFFIX="$OPTARG";;
 | 
				
			||||||
		?)
 | 
							?)
 | 
				
			||||||
			usage
 | 
								usage
 | 
				
			||||||
			exit 1;;
 | 
								exit 1;;
 | 
				
			||||||
@@ -120,9 +174,35 @@ shift "$((OPTIND -1))"
 | 
				
			|||||||
DISK=$1
 | 
					DISK=$1
 | 
				
			||||||
ZFSHOST=$2
 | 
					ZFSHOST=$2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Post-boot grub mirror?
 | 
				
			||||||
 | 
					if [ "$GRUB_MIRROR" == "true" ]; then
 | 
				
			||||||
 | 
						while true; do
 | 
				
			||||||
 | 
							echo -e "ORIGINAL GRUB: $DISK\nMIRROR TO: $MIRROR"
 | 
				
			||||||
 | 
							read -r -p "Would you like to mirror GRUB? [y/N]: " yn
 | 
				
			||||||
 | 
							case $yn in
 | 
				
			||||||
 | 
								[Yy]*)
 | 
				
			||||||
 | 
									disk_check "$DISK"
 | 
				
			||||||
 | 
									disk_check "$MIRROR"
 | 
				
			||||||
 | 
									[ -z "$IGNORE_BYID" ] && disk_byid_check "$DISK"
 | 
				
			||||||
 | 
									[ -z "$IGNORE_BYID" ] && disk_byid_check "$MIRROR"
 | 
				
			||||||
 | 
									mirror_grub "$DISK" "$MIRROR" 2
 | 
				
			||||||
 | 
									exit 0;;
 | 
				
			||||||
 | 
								?)
 | 
				
			||||||
 | 
									echo "ABORTED: User did not confirm mirroring"
 | 
				
			||||||
 | 
									exit 1;;
 | 
				
			||||||
 | 
							esac
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Verify variables
 | 
					# Verify variables
 | 
				
			||||||
[ -z "$ZFSROOT" ] && ZFSROOT="/mnt"
 | 
					[ -z "$ZFSROOT" ] && ZFSROOT="/mnt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ -z "$PARTSUFFIX" ]; then
 | 
				
			||||||
 | 
						PARTSUFFIX="-part"
 | 
				
			||||||
 | 
					elif [ "$PARTSUFFIX" == "0" ]; then
 | 
				
			||||||
 | 
						PARTSUFFIX=""
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -z "$DISK" ]; then
 | 
					if [ -z "$DISK" ]; then
 | 
				
			||||||
	echo "ERROR: DISK not set"
 | 
						echo "ERROR: DISK not set"
 | 
				
			||||||
	usage
 | 
						usage
 | 
				
			||||||
@@ -148,22 +228,27 @@ if [ -z "$RPOOLPW" ]; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$DEBUG" == "true" ]; then
 | 
					if [ "$DEBUG" == "true" ]; then
 | 
				
			||||||
  echo "CODENAME=${CODENAME}"
 | 
						echo "CODENAME='${CODENAME}'"
 | 
				
			||||||
  echo "DISK=${DISK}"
 | 
						echo "DISK='${DISK}'"
 | 
				
			||||||
  echo "ZFSHOST=${ZFSHOST}"
 | 
						echo "ZFSHOST='${ZFSHOST}'"
 | 
				
			||||||
  echo "ZFSROOT=${ZFSROOT}"
 | 
						echo "ZFSROOT='${ZFSROOT}'"
 | 
				
			||||||
  echo "MIRROR=${MIRROR}"
 | 
						echo "MIRROR='${MIRROR}'"
 | 
				
			||||||
  echo "ROOTPW=${ROOTPW}"
 | 
						echo "ROOTPW='${ROOTPW}'"
 | 
				
			||||||
  echo "RPOOLPW=${RPOOLPW}"
 | 
						echo "RPOOLPW='${RPOOLPW}'"
 | 
				
			||||||
 | 
						echo "PARTSUFFIX='${PARTSUFFIX}'"
 | 
				
			||||||
 | 
						echo "GRUB_MIRROR='${GRUB_MIRROR}'"
 | 
				
			||||||
 | 
						echo "IGNORE_BYID='${IGNORE_BYID}'"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Are the DISK paths block devices? AND
 | 
					# Are the DISK paths block devices? AND
 | 
				
			||||||
# Are the DISK pathes empty devices? i.e., no filesystem signatures
 | 
					# Are the DISK pathes empty devices? i.e., no filesystem signatures
 | 
				
			||||||
disk_check "$DISK"
 | 
					disk_check "$DISK"
 | 
				
			||||||
disk_status "$DISK"
 | 
					disk_status "$DISK"
 | 
				
			||||||
 | 
					[ -z "$IGNORE_BYID" ] && disk_byid_check "$DISK"
 | 
				
			||||||
if [ -n "$MIRROR" ]; then
 | 
					if [ -n "$MIRROR" ]; then
 | 
				
			||||||
	disk_check "$MIRROR"
 | 
						disk_check "$MIRROR"
 | 
				
			||||||
	disk_status "$MIRROR"
 | 
						disk_status "$MIRROR"
 | 
				
			||||||
 | 
						[ -z "$IGNORE_BYID" ] && disk_byid_check "$MIRROR"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
###############################################
 | 
					###############################################
 | 
				
			||||||
@@ -171,7 +256,7 @@ fi
 | 
				
			|||||||
###############################################
 | 
					###############################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Display commands
 | 
					# Display commands
 | 
				
			||||||
set -x
 | 
					set -xe
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 1. Boot the Debian GNU/Linux Live CD... done
 | 
					# 1. Boot the Debian GNU/Linux Live CD... done
 | 
				
			||||||
# 2. Setup and update the repositories
 | 
					# 2. Setup and update the repositories
 | 
				
			||||||
@@ -199,19 +284,26 @@ swapoff --all
 | 
				
			|||||||
# UEFI booting + boot pool + ZFS native encryption
 | 
					# UEFI booting + boot pool + ZFS native encryption
 | 
				
			||||||
disk_format "$DISK"
 | 
					disk_format "$DISK"
 | 
				
			||||||
[ -n "$MIRROR" ] && disk_format "$MIRROR"
 | 
					[ -n "$MIRROR" ] && disk_format "$MIRROR"
 | 
				
			||||||
 | 
					sleep 5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 4. Create the boot pool
 | 
					# Check for partitions 3 and 4
 | 
				
			||||||
if [ -z "$MIRROR" ]; then
 | 
					disk_check "${DISK}${PARTSUFFIX}3"
 | 
				
			||||||
  create_boot_pool "$ZFSROOT" "${DISK}3"
 | 
					disk_check "${DISK}${PARTSUFFIX}4"
 | 
				
			||||||
else
 | 
					if [ -n "$MIRROR" ]; then
 | 
				
			||||||
  create_boot_pool "$ZFSROOT" "mirror ${DISK}3 ${MIRROR}3"
 | 
						disk_check "${DISK}${PARTSUFFIX}3"
 | 
				
			||||||
 | 
						disk_check "${DISK}${PARTSUFFIX}4"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 4. Create the boot pool
 | 
				
			||||||
# 5. Create the root pool
 | 
					# 5. Create the root pool
 | 
				
			||||||
if [ -z "$MIRROR" ]; then
 | 
					if [ -z "$MIRROR" ]; then
 | 
				
			||||||
  create_root_pool "$ZFSROOT" "${DISK}4" "$RPOOLPW"
 | 
						create_boot_pool "$ZFSROOT" "${DISK}${PARTSUFFIX}3"
 | 
				
			||||||
 | 
						create_root_pool "$ZFSROOT" "${DISK}${PARTSUFFIX}4" "$RPOOLPW"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  create_root_pool "$ZFSROOT" "mirror ${DISK}4 ${MIRROR}4" "$RPOOLPW"
 | 
						create_boot_pool "$ZFSROOT" \
 | 
				
			||||||
 | 
							"mirror ${DISK}${PARTSUFFIX}3 ${MIRROR}${PARTSUFFIX}3"
 | 
				
			||||||
 | 
						create_root_pool "$ZFSROOT" \
 | 
				
			||||||
 | 
							"mirror ${DISK}${PARTSUFFIX}4 ${MIRROR}${PARTSUFFIX}4" "$RPOOLPW"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
###################################
 | 
					###################################
 | 
				
			||||||
@@ -299,23 +391,33 @@ deb http://deb.debian.org/debian ${CODENAME}-updates main contrib
 | 
				
			|||||||
deb-src http://deb.debian.org/debian ${CODENAME}-updates main contrib
 | 
					deb-src http://deb.debian.org/debian ${CODENAME}-updates main contrib
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 4. Bind the virtual filesystems from the LiveCD environment to the new system and chroot into it
 | 
					# Copy self and GRUB mirror helper script into chroot
 | 
				
			||||||
# Copy DISK/MIRROR vars under ZFSROOT
 | 
					if [ -n "$MIRROR" ]; then
 | 
				
			||||||
echo -e "DISK=${DISK}\nROOTPW=${ROOTPW}" > "$ZFSROOT/var/tmp/zfsenv"
 | 
						cp "$0" "$ZFSROOT/usr/local/bin/debianzfs"
 | 
				
			||||||
 | 
						chmod +x "$ZFSROOT/usr/local/bin/debianzfs"
 | 
				
			||||||
 | 
						HELPER_SCRIPT="/root/MIRROR_GRUB_POSTINSTALL.sh"
 | 
				
			||||||
 | 
						cat <<-GRUBMIRROR > "${ZFSROOT}${HELPER_SCRIPT}"
 | 
				
			||||||
 | 
						#!/bin/bash
 | 
				
			||||||
 | 
						# Post-install GRUB mirror helper script
 | 
				
			||||||
 | 
						/usr/local/bin/debianzfs \
 | 
				
			||||||
 | 
							-gm ${MIRROR}${PARTSUFFIX}2 \
 | 
				
			||||||
 | 
							${DISK}${PARTSUFFIX}2
 | 
				
			||||||
 | 
						GRUBMIRROR
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Bind
 | 
					# 4. Bind the virtual filesystems from the LiveCD environment to the new system and chroot into it
 | 
				
			||||||
mount --make-private --rbind /dev /mnt/dev
 | 
					mount --make-private --rbind /dev /mnt/dev
 | 
				
			||||||
mount --make-private --rbind /proc /mnt/proc
 | 
					mount --make-private --rbind /proc /mnt/proc
 | 
				
			||||||
mount --make-private --rbind /sys /mnt/sys
 | 
					mount --make-private --rbind /sys /mnt/sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Chroot
 | 
					# Copy DISK/MIRROR vars under ZFSROOT and chroot
 | 
				
			||||||
 | 
					echo -e "DISK=\"$DISK\"\nPARTSUFFIX=\"${PARTSUFFIX}\"\nROOTPW=\"${ROOTPW}\"" > "$ZFSROOT/var/tmp/zfsenv"
 | 
				
			||||||
cat << CHROOT | chroot /mnt bash --login
 | 
					cat << CHROOT | chroot /mnt bash --login
 | 
				
			||||||
# Setup
 | 
					# Setup
 | 
				
			||||||
export DEBIAN_FRONTEND=noninteractive
 | 
					export DEBIAN_FRONTEND=noninteractive
 | 
				
			||||||
export LC_CTYPE=en_US.UTF-8
 | 
					 | 
				
			||||||
export LC_ALL=en_US.UTF-8
 | 
					 | 
				
			||||||
set -ex
 | 
					set -ex
 | 
				
			||||||
. /var/tmp/zfsenv
 | 
					. /var/tmp/zfsenv
 | 
				
			||||||
 | 
					rm -f /var/tmp/zfsenv
 | 
				
			||||||
unset CDPATH
 | 
					unset CDPATH
 | 
				
			||||||
cd
 | 
					cd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -336,9 +438,9 @@ echo REMAKE_INITRD=yes > /etc/dkms/zfs.conf
 | 
				
			|||||||
# Install GRUB for UEFI booting
 | 
					# Install GRUB for UEFI booting
 | 
				
			||||||
apt-get install -y dosfstools
 | 
					apt-get install -y dosfstools
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mkdosfs -F 32 -s 1 -n EFI "\${DISK}2"
 | 
					mkdosfs -F 32 -s 1 -n EFI "\${DISK}\${PARTSUFFIX}2"
 | 
				
			||||||
mkdir /boot/efi
 | 
					mkdir /boot/efi
 | 
				
			||||||
BLKID_BOOT="/dev/disk/by-uuid/\$(blkid -s UUID -o value \${DISK}2)"
 | 
					BLKID_BOOT="/dev/disk/by-uuid/\$(blkid -s UUID -o value \${DISK}\${PARTSUFFIX}2)"
 | 
				
			||||||
echo "\${BLKID_BOOT} /boot/efi vfat defaults 0 0" >> /etc/fstab
 | 
					echo "\${BLKID_BOOT} /boot/efi vfat defaults 0 0" >> /etc/fstab
 | 
				
			||||||
mount /boot/efi
 | 
					mount /boot/efi
 | 
				
			||||||
apt-get install -y grub-efi-amd64 shim-signed
 | 
					apt-get install -y grub-efi-amd64 shim-signed
 | 
				
			||||||
@@ -437,4 +539,6 @@ mount | grep -v zfs | tac | awk '/\/mnt/ {print $3}' | \
 | 
				
			|||||||
# 4. If this fails for rpool, mounting it on boot will fail and you will need to
 | 
					# 4. If this fails for rpool, mounting it on boot will fail and you will need to
 | 
				
			||||||
#    zpool import -f rpool, then exit in the initamfs prompt
 | 
					#    zpool import -f rpool, then exit in the initamfs prompt
 | 
				
			||||||
zpool export -a || exit 0
 | 
					zpool export -a || exit 0
 | 
				
			||||||
 | 
					[ -n "$HELPER_SCRIPT" ] && \
 | 
				
			||||||
 | 
						echo "NOTICE: A GRUB mirror helper script was placed at $HELPER_SCRIPT"
 | 
				
			||||||
exit 0
 | 
					exit 0
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user