testing
This commit is contained in:
parent
4c5663b28b
commit
7811cdb945
77
debianzfs.sh
77
debianzfs.sh
@ -158,8 +158,8 @@ deb http://deb.debian.org/debian bullseye-updates main contrib
|
|||||||
deb-src http://deb.debian.org/debian bullseye-updates main contrib
|
deb-src http://deb.debian.org/debian bullseye-updates main contrib
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Copy env under ZFSROOT
|
# Copy DISK var under ZFSROOT
|
||||||
env > "$ZFSROOT/var/tmp/zfsenv"
|
echo "DISK=\$DISK" > "$ZFSROOT/var/tmp/zfsenv"
|
||||||
|
|
||||||
# Bind the virtual filesystems from the LiveCD environment to the new system
|
# Bind the virtual filesystems from the LiveCD environment to the new system
|
||||||
mount --make-private --rbind /dev /mnt/dev
|
mount --make-private --rbind /dev /mnt/dev
|
||||||
@ -167,10 +167,79 @@ mount --make-private --rbind /proc /mnt/proc
|
|||||||
mount --make-private --rbind /sys /mnt/sys
|
mount --make-private --rbind /sys /mnt/sys
|
||||||
|
|
||||||
# Chroot
|
# Chroot
|
||||||
cat << EOF | chroot /mnt bash --login
|
cat << CHROOTEND | chroot /mnt bash --login
|
||||||
|
# Setup
|
||||||
|
set -ex
|
||||||
. /var/tmp/zfsenv
|
. /var/tmp/zfsenv
|
||||||
unset CDPATH
|
unset CDPATH
|
||||||
cd
|
cd
|
||||||
|
|
||||||
|
# Configure a basic system environment
|
||||||
|
ln -s /proc/self/mounts /etc/mtab
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get upgrade -y
|
apt-get upgrade -y
|
||||||
EOF
|
apt-get install -y console-setup locales
|
||||||
|
dpkg-reconfigure locales tzdata keyboard-configuration console-setup
|
||||||
|
apt-get install -y dpkg-dev linux-headers-generic linux-image-generic
|
||||||
|
apt-get install -y zfs-initramfs
|
||||||
|
echo REMAKE_INITRD=yes > /etc/dkms/zfs.conf
|
||||||
|
|
||||||
|
# Install Grub for UEFI
|
||||||
|
apt-get install -y dosfstools
|
||||||
|
echo REMAKE_INITRD=yes > /etc/dkms/zfs.conf
|
||||||
|
mkdosfs -F 32 -s 1 -n EFI "${DISK}2"
|
||||||
|
mkdir /boot/efi
|
||||||
|
echo "${DISK}2" /boot/efi vfat defaults 0 0 >> /etc/fstab
|
||||||
|
mount /boot/efi
|
||||||
|
apt-get install -y grub-efi-amd64 shim-signed
|
||||||
|
apt-get purge -y os-prober
|
||||||
|
passwd
|
||||||
|
|
||||||
|
# Add bpool import service
|
||||||
|
cat <<- BPOOL > /etc/systemd/system/zfs-import-bpool.service
|
||||||
|
[Unit]
|
||||||
|
DefaultDependencies=no
|
||||||
|
Before=zfs-import-scan.service
|
||||||
|
Before=zfs-import-cache.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/sbin/zpool import -N -o cachefile=none bpool
|
||||||
|
# Work-around to preserve zpool cache:
|
||||||
|
ExecStartPre=-/bin/mv /etc/zfs/zpool.cache /etc/zfs/preboot_zpool.cache
|
||||||
|
ExecStartPost=-/bin/mv /etc/zfs/preboot_zpool.cache /etc/zfs/zpool.cache
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=zfs-import.target
|
||||||
|
BPOOL
|
||||||
|
|
||||||
|
# Enable importing bpool service
|
||||||
|
systemctl enable zfs-import-bpool.service
|
||||||
|
|
||||||
|
# Mount a tmpfs to /tmp
|
||||||
|
systemctl enable tmp.mount
|
||||||
|
cp /usr/share/systemd/tmp.mount /etc/systemd/system/
|
||||||
|
|
||||||
|
# Verify that the ZFS boot filesystem is recognized
|
||||||
|
grub-probe /boot
|
||||||
|
|
||||||
|
# Refresh the initrd files
|
||||||
|
update-initramfs -c -k all
|
||||||
|
|
||||||
|
# Workaround GRUB's missing zpool-features support
|
||||||
|
cat /etc/default/grub
|
||||||
|
|
||||||
|
# Update the boot configuration
|
||||||
|
update-grub
|
||||||
|
|
||||||
|
# Install GRUB to the ESP
|
||||||
|
grub-install --target=x86_64-efi --efi-directory=/boot/efi \
|
||||||
|
--bootloader-id=debian --recheck --no-floppy
|
||||||
|
|
||||||
|
# Fix filesystem mount ordering
|
||||||
|
mkdir /etc/zfs/zfs-list.cache
|
||||||
|
touch /etc/zfs/zfs-list.cache/bpool
|
||||||
|
touch /etc/zfs/zfs-list.cache/rpool
|
||||||
|
|
||||||
|
CHROOTEND
|
Loading…
x
Reference in New Issue
Block a user