update to new rescue (#43)

updated to new rescue, added script for ubuntu 22
This commit is contained in:
terem42
2023-04-22 00:50:38 +02:00
committed by GitHub
parent e26d27f692
commit ad8f7627d8
6 changed files with 908 additions and 54 deletions

View File

@@ -495,13 +495,7 @@ done
echo "======= installing zfs on rescue system =========="
echo "zfs-dkms zfs-dkms/note-incompatible-licenses note true" | debconf-set-selections
apt-get install --yes software-properties-common
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8CF63AD3F06FC659
add-apt-repository 'deb http://ppa.launchpad.net/jonathonf/zfs/ubuntu focal main'
apt update
apt install --yes zfs-dkms zfsutils-linux
add-apt-repository -r 'deb http://ppa.launchpad.net/jonathonf/zfs/ubuntu focal main'
apt update
find /usr/local/sbin/ -type l -exec rm {} +
echo "y" | zfs
zfs --version
echo "======= partitioning the disk =========="
@@ -545,14 +539,14 @@ echo "======= create zfs pools and datasets =========="
# shellcheck disable=SC2086
zpool create \
$v_bpool_tweaks -O canmount=off -O devices=off \
-o cachefile=/etc/zfs/zpool.cache \
-o cachefile=/etc/zpool.cache \
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
# shellcheck disable=SC2086
echo -n "$v_passphrase" | zpool create \
$v_rpool_tweaks \
-o cachefile=/etc/zfs/zpool.cache \
-o cachefile=/etc/zpool.cache \
"${encryption_options[@]}" \
-O mountpoint=/ -R $c_zfs_mount_dir -f \
$v_rpool_name $pools_mirror_option "${rpool_disks_partitions[@]}"
@@ -718,7 +712,7 @@ if [[ $v_zfs_experimental == "1" ]]; then
chroot_execute "apt update"
chroot_execute "apt install -t zfs-debian-experimental --yes zfs-initramfs zfs-dkms zfsutils-linux"
else
chroot_execute "apt install --yes zfs-initramfs zfs-dkms zfsutils-linux"
chroot_execute "apt install -t bullseye-backports --yes zfs-initramfs zfs-dkms zfsutils-linux"
fi
chroot_execute 'cat << DKMS > /etc/dkms/zfs.conf
# override for /usr/src/zfs-*/dkms.conf:
@@ -743,7 +737,7 @@ chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
echo "======= setting up zfs cache =========="
cp /etc/zfs/zpool.cache /mnt/etc/zfs/zpool.cache
cp /etc/zpool.cache /mnt/etc/zfs/zpool.cache
echo "========setting up zfs module parameters========"
chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024)) >> /etc/modprobe.d/zfs.conf"
@@ -820,12 +814,14 @@ esac
configure_networking
ip route add 172.31.1.1/255.255.255.255 dev ens3
ip route add default via 172.31.1.1 dev ens3
ip route add 172.31.1.1/255.255.255.255 dev eth0
ip route add default via 172.31.1.1 dev eth0
CONF
chmod 755 "$c_zfs_mount_dir/usr/share/initramfs-tools/scripts/init-premount/static-route"
chmod 755 "$c_zfs_mount_dir/etc/network/interfaces"
echo "======= update initramfs =========="
chroot_execute "update-initramfs -u -k all"