mirror of
https://github.com/terem42/zfs-hetzner-vm.git
synced 2025-12-23 07:18:37 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8858afa4a3 | ||
|
|
d11cae2671 | ||
|
|
373f77fa73 | ||
|
|
587d3a1f4f | ||
|
|
556157ed33 | ||
|
|
56e36a0987 | ||
|
|
d5b4bf3034 | ||
|
|
f79b735143 | ||
|
|
dc23d826e3 | ||
|
|
3b9724e6af | ||
|
|
23ec2c0e89 | ||
|
|
00ed04d44e | ||
|
|
27bb8d8302 | ||
|
|
6c015b895d | ||
|
|
b40c5e0699 | ||
|
|
0053d63360 |
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://github.com/terem42/zfs-hetzner-vm/actions/workflows/shellcheck.yml)
|
||||
|
||||
Scripts to install Debian 11, 10 or Ubuntu 18 LTS, 20 LTS, 22 LTS with ZFS root on Hetzner root servers (virtual and dedicated).<br/>
|
||||
Scripts to install Debian 10, 11, 12 or Ubuntu 18 LTS, 20 LTS, 22 LTS with ZFS root on Hetzner root servers (virtual and dedicated).<br/>
|
||||
__WARNING:__ all data on the disk will be destroyed.
|
||||
|
||||
## How to use:
|
||||
|
||||
@@ -138,20 +138,20 @@ function check_prerequisites {
|
||||
|
||||
function initial_load_debian_zed_cache {
|
||||
chroot_execute "mkdir /etc/zfs/zfs-list.cache"
|
||||
chroot_execute "touch /etc/zfs/zfs-list.cache/rpool"
|
||||
chroot_execute "touch /etc/zfs/zfs-list.cache/$v_rpool_name"
|
||||
chroot_execute "ln -sf /usr/lib/zfs-linux/zed.d/history_event-zfs-list-cacher.sh /etc/zfs/zed.d/"
|
||||
|
||||
chroot_execute "zed -F &"
|
||||
|
||||
local success=0
|
||||
|
||||
if [[ ! -e /mnt/etc/zfs/zfs-list.cache/rpool ]] || [[ -e /mnt/etc/zfs/zfs-list.cache/rpool && (( $(find /mnt/etc/zfs/zfs-list.cache/rpool -type f -printf '%s' 2> /dev/null) == 0 )) ]]; then
|
||||
chroot_execute "zfs set canmount=noauto rpool"
|
||||
if [[ ! -e "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" ]] || [[ -e "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" && (( $(find "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" -type f -printf '%s' 2> /dev/null) == 0 )) ]]; then
|
||||
chroot_execute "zfs set canmount=noauto $v_rpool_name"
|
||||
|
||||
SECONDS=0
|
||||
|
||||
while (( SECONDS++ <= 300 )); do
|
||||
if [[ -e /mnt/etc/zfs/zfs-list.cache/rpool ]] && (( $(find /mnt/etc/zfs/zfs-list.cache/rpool -type f -printf '%s' 2> /dev/null) > 0 )); then
|
||||
while (( SECONDS++ <= 120 )); do
|
||||
if [[ -e "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" ]] && (( $(find "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" -type f -printf '%s' 2> /dev/null) > 0 )); then
|
||||
success=1
|
||||
break
|
||||
else
|
||||
@@ -169,7 +169,7 @@ function initial_load_debian_zed_cache {
|
||||
|
||||
chroot_execute "pkill zed"
|
||||
|
||||
sed -Ei 's|/mnt/?|/|g' /mnt/etc/zfs/zfs-list.cache/rpool
|
||||
sed -Ei "s|/$c_zfs_mount_dir/?|/|g" "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name"
|
||||
}
|
||||
|
||||
function find_suitable_disks {
|
||||
@@ -399,7 +399,7 @@ function determine_kernel_variant {
|
||||
}
|
||||
|
||||
function chroot_execute {
|
||||
chroot $c_zfs_mount_dir bash -c "$1"
|
||||
chroot $c_zfs_mount_dir bash -c "DEBIAN_FRONTEND=noninteractive $1"
|
||||
}
|
||||
|
||||
function unmount_and_export_fs {
|
||||
@@ -750,12 +750,14 @@ chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024))
|
||||
|
||||
echo "======= setting up grub =========="
|
||||
chroot_execute "echo 'grub-pc grub-pc/install_devices_empty boolean true' | debconf-set-selections"
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-pc"
|
||||
chroot_execute "grub-install ${v_selected_disks[0]}"
|
||||
chroot_execute "apt install --yes grub-pc"
|
||||
for disk in ${v_selected_disks[@]}; do
|
||||
chroot_execute "grub-install $disk"
|
||||
done
|
||||
|
||||
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/debian\"|g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/debian\"|g' /etc/default/grub"
|
||||
|
||||
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
||||
@@ -769,7 +771,8 @@ if [[ $v_encrypt_rpool == "1" ]]; then
|
||||
echo "=========set up dropbear=============="
|
||||
|
||||
chroot_execute "apt install --yes dropbear-initramfs"
|
||||
|
||||
|
||||
mkdir -p "$c_zfs_mount_dir/etc/dropbear-initramfs"
|
||||
cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear-initramfs/authorized_keys"
|
||||
|
||||
cp "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp"
|
||||
@@ -796,7 +799,7 @@ CONF
|
||||
|
||||
echo "========running packages upgrade==========="
|
||||
chroot_execute "apt upgrade --yes"
|
||||
chroot_execute "apt autoremove --yes"
|
||||
chroot_execute "apt purge cryptsetup* --yes"
|
||||
|
||||
echo "===========add static route to initramfs via hook to add default routes for Hetzner due to Debian/Ubuntu initramfs DHCP bug ========="
|
||||
mkdir -p "$c_zfs_mount_dir/usr/share/initramfs-tools/scripts/init-premount"
|
||||
@@ -829,7 +832,7 @@ auto lo
|
||||
iface lo inet loopback
|
||||
iface lo inet6 loopback
|
||||
|
||||
auto eth0
|
||||
allow-hotplug eth0
|
||||
iface eth0 inet dhcp
|
||||
iface eth0 inet6 dhcp
|
||||
CONF
|
||||
@@ -844,7 +847,7 @@ chroot_execute "update-grub"
|
||||
|
||||
echo "======= setting up zed =========="
|
||||
if [[ $v_zfs_experimental == "1" ]]; then
|
||||
chroot_execute "zfs set canmount=noauto rpool"
|
||||
chroot_execute "zfs set canmount=noauto $v_rpool_name"
|
||||
else
|
||||
initial_load_debian_zed_cache
|
||||
fi
|
||||
|
||||
@@ -139,20 +139,20 @@ function check_prerequisites {
|
||||
|
||||
function initial_load_debian_zed_cache {
|
||||
chroot_execute "mkdir /etc/zfs/zfs-list.cache"
|
||||
chroot_execute "touch /etc/zfs/zfs-list.cache/rpool"
|
||||
chroot_execute "touch /etc/zfs/zfs-list.cache/$v_rpool_name"
|
||||
chroot_execute "ln -sf /usr/lib/zfs-linux/zed.d/history_event-zfs-list-cacher.sh /etc/zfs/zed.d/"
|
||||
|
||||
chroot_execute "zed -F &"
|
||||
|
||||
local success=0
|
||||
|
||||
if [[ ! -e /mnt/etc/zfs/zfs-list.cache/rpool ]] || [[ -e /mnt/etc/zfs/zfs-list.cache/rpool && (( $(find /mnt/etc/zfs/zfs-list.cache/rpool -type f -printf '%s' 2> /dev/null) == 0 )) ]]; then
|
||||
chroot_execute "zfs set canmount=noauto rpool"
|
||||
if [[ ! -e "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" ]] || [[ -e "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" && (( $(find "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" -type f -printf '%s' 2> /dev/null) == 0 )) ]]; then
|
||||
chroot_execute "zfs set canmount=noauto $v_rpool_name"
|
||||
|
||||
SECONDS=0
|
||||
|
||||
while (( SECONDS++ <= 120 )); do
|
||||
if [[ -e /mnt/etc/zfs/zfs-list.cache/rpool ]] && (( $(find /mnt/etc/zfs/zfs-list.cache/rpool -type f -printf '%s' 2> /dev/null) > 0 )); then
|
||||
if [[ -e "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" ]] && (( $(find "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" -type f -printf '%s' 2> /dev/null) > 0 )); then
|
||||
success=1
|
||||
break
|
||||
else
|
||||
@@ -170,7 +170,7 @@ function initial_load_debian_zed_cache {
|
||||
|
||||
chroot_execute "pkill zed"
|
||||
|
||||
sed -Ei 's|/mnt/?|/|g' /mnt/etc/zfs/zfs-list.cache/rpool
|
||||
sed -Ei "s|/$c_zfs_mount_dir/?|/|g" "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name"
|
||||
}
|
||||
|
||||
function find_suitable_disks {
|
||||
@@ -400,7 +400,7 @@ function determine_kernel_variant {
|
||||
}
|
||||
|
||||
function chroot_execute {
|
||||
chroot $c_zfs_mount_dir bash -c "$1"
|
||||
chroot $c_zfs_mount_dir bash -c "DEBIAN_FRONTEND=noninteractive $1"
|
||||
}
|
||||
|
||||
function unmount_and_export_fs {
|
||||
@@ -754,13 +754,15 @@ chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024))
|
||||
|
||||
echo "======= setting up grub =========="
|
||||
chroot_execute "echo 'grub-pc grub-pc/install_devices_empty boolean true' | debconf-set-selections"
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-legacy"
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-pc"
|
||||
chroot_execute "grub-install --recheck ${v_selected_disks[0]}"
|
||||
chroot_execute "apt install --yes grub-legacy"
|
||||
chroot_execute "apt install --yes grub-pc"
|
||||
for disk in ${v_selected_disks[@]}; do
|
||||
chroot_execute "grub-install --recheck $disk"
|
||||
done
|
||||
|
||||
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/debian\"|g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/debian\"|g' /etc/default/grub"
|
||||
|
||||
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
||||
@@ -774,21 +776,22 @@ if [[ $v_encrypt_rpool == "1" ]]; then
|
||||
echo "=========set up dropbear=============="
|
||||
|
||||
chroot_execute "apt install --yes dropbear-initramfs"
|
||||
|
||||
cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear-initramfs/authorized_keys"
|
||||
|
||||
mkdir -p "$c_zfs_mount_dir/etc/dropbear/initramfs"
|
||||
cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear/initramfs/authorized_keys"
|
||||
|
||||
cp "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp"
|
||||
chroot_execute "ssh-keygen -p -i -m pem -N '' -f /etc/ssh/ssh_host_rsa_key_temp"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key_temp /etc/dropbear-initramfs/dropbear_rsa_host_key"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key_temp /etc/dropbear/initramfs/dropbear_rsa_host_key"
|
||||
rm -rf "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp"
|
||||
|
||||
cp "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
chroot_execute "ssh-keygen -p -i -m pem -N '' -f /etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key_temp /etc/dropbear-initramfs/dropbear_ecdsa_host_key"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key_temp /etc/dropbear/initramfs/dropbear_ecdsa_host_key"
|
||||
chroot_execute "rm -rf /etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
rm -rf "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
|
||||
rm -rf "$c_zfs_mount_dir/etc/dropbear-initramfs/dropbear_dss_host_key"
|
||||
rm -rf "$c_zfs_mount_dir/etc/dropbear/initramfs/dropbear_dss_host_key"
|
||||
fi
|
||||
|
||||
echo "============setup root prompt============"
|
||||
@@ -801,6 +804,7 @@ CONF
|
||||
|
||||
echo "========running packages upgrade==========="
|
||||
chroot_execute "apt upgrade --yes"
|
||||
chroot_execute "apt purge cryptsetup* --yes"
|
||||
|
||||
echo "===========add static route to initramfs via hook to add default routes for Hetzner due to Debian/Ubuntu initramfs DHCP bug ========="
|
||||
mkdir -p "$c_zfs_mount_dir/usr/share/initramfs-tools/scripts/init-premount"
|
||||
@@ -840,7 +844,7 @@ chroot_execute "update-grub"
|
||||
|
||||
echo "======= setting up zed =========="
|
||||
if [[ $v_zfs_experimental == "1" ]]; then
|
||||
chroot_execute "zfs set canmount=noauto rpool"
|
||||
chroot_execute "zfs set canmount=noauto $v_rpool_name"
|
||||
else
|
||||
initial_load_debian_zed_cache
|
||||
fi
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
: <<'end_header_info'
|
||||
(c) Andrey Prokopenko job@terem.fr
|
||||
fully automatic script to install Debian 11 with ZFS root on Hetzner VPS
|
||||
fully automatic script to install Debian 12 with ZFS root on Hetzner VPS
|
||||
WARNING: all data on the disk will be destroyed
|
||||
How to use: add SSH key to the rescue console, set it OS to linux64, then press "mount rescue and power cycle" button
|
||||
Next, connect via SSH to console, and run the script
|
||||
@@ -49,6 +49,7 @@ c_log_dir=$(dirname "$(mktemp)")/zfs-hetzner-vm
|
||||
c_install_log=$c_log_dir/install.log
|
||||
c_lsb_release_log=$c_log_dir/lsb_release.log
|
||||
c_disks_log=$c_log_dir/disks.log
|
||||
c_efimode_enabled="$(if [[ -d /sys/firmware/efi/efivars ]]; then echo 1; else echo 0; fi)"
|
||||
|
||||
function activate_debug {
|
||||
mkdir -p "$c_log_dir"
|
||||
@@ -107,7 +108,7 @@ function display_intro_banner {
|
||||
print_step_info_header
|
||||
|
||||
local dialog_message='Hello!
|
||||
This script will prepare the ZFS pools, then install and configure minimal Debian 11 with ZFS root on Hetzner hosting VPS instance
|
||||
This script will prepare the ZFS pools, then install and configure minimal Debian 12 with ZFS root on Hetzner hosting VPS instance
|
||||
The script with minimal changes may be used on any other hosting provider supporting KVM virtualization and offering Debian-based rescue system.
|
||||
In order to stop the procedure, hit Esc twice during dialogs (excluding yes/no ones), or Ctrl+C while any operation is running.
|
||||
'
|
||||
@@ -139,20 +140,20 @@ function check_prerequisites {
|
||||
|
||||
function initial_load_debian_zed_cache {
|
||||
chroot_execute "mkdir /etc/zfs/zfs-list.cache"
|
||||
chroot_execute "touch /etc/zfs/zfs-list.cache/rpool"
|
||||
chroot_execute "touch /etc/zfs/zfs-list.cache/$v_rpool_name"
|
||||
chroot_execute "ln -sf /usr/lib/zfs-linux/zed.d/history_event-zfs-list-cacher.sh /etc/zfs/zed.d/"
|
||||
|
||||
chroot_execute "zed -F &"
|
||||
|
||||
local success=0
|
||||
|
||||
if [[ ! -e /mnt/etc/zfs/zfs-list.cache/rpool ]] || [[ -e /mnt/etc/zfs/zfs-list.cache/rpool && (( $(find /mnt/etc/zfs/zfs-list.cache/rpool -type f -printf '%s' 2> /dev/null) == 0 )) ]]; then
|
||||
chroot_execute "zfs set canmount=noauto rpool"
|
||||
if [[ ! -e "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" ]] || [[ -e "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" && (( $(find "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" -type f -printf '%s' 2> /dev/null) == 0 )) ]]; then
|
||||
chroot_execute "zfs set canmount=noauto $v_rpool_name"
|
||||
|
||||
SECONDS=0
|
||||
|
||||
while (( SECONDS++ <= 120 )); do
|
||||
if [[ -e /mnt/etc/zfs/zfs-list.cache/rpool ]] && (( $(find /mnt/etc/zfs/zfs-list.cache/rpool -type f -printf '%s' 2> /dev/null) > 0 )); then
|
||||
if [[ -e "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" ]] && (( $(find "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name" -type f -printf '%s' 2> /dev/null) > 0 )); then
|
||||
success=1
|
||||
break
|
||||
else
|
||||
@@ -170,7 +171,7 @@ function initial_load_debian_zed_cache {
|
||||
|
||||
chroot_execute "pkill zed"
|
||||
|
||||
sed -Ei 's|/mnt/?|/|g' /mnt/etc/zfs/zfs-list.cache/rpool
|
||||
sed -Ei "s|/$c_zfs_mount_dir/?|/|g" "$c_zfs_mount_dir/etc/zfs/zfs-list.cache/$v_rpool_name"
|
||||
}
|
||||
|
||||
function find_suitable_disks {
|
||||
@@ -400,7 +401,7 @@ function determine_kernel_variant {
|
||||
}
|
||||
|
||||
function chroot_execute {
|
||||
chroot $c_zfs_mount_dir bash -c "$1"
|
||||
chroot $c_zfs_mount_dir bash -c "DEBIAN_FRONTEND=noninteractive $1"
|
||||
}
|
||||
|
||||
function unmount_and_export_fs {
|
||||
@@ -522,7 +523,11 @@ echo "======= partitioning the disk =========="
|
||||
|
||||
for selected_disk in "${v_selected_disks[@]}"; do
|
||||
wipefs --all --force "$selected_disk"
|
||||
sgdisk -a1 -n1:24K:+1000K -t1:EF02 "$selected_disk"
|
||||
if (( c_efimode_enabled == 1 )); then
|
||||
sgdisk -a1 -n1:24K:+1G -t1:EF00 "$selected_disk" # EFI partition
|
||||
else
|
||||
sgdisk -a1 -n1:24K:+1000K -t1:EF02 "$selected_disk"
|
||||
fi
|
||||
sgdisk -n2:0:+2G -t2:BF01 "$selected_disk" # Boot pool
|
||||
sgdisk -n3:0:"$tail_space_parameter" -t3:BF01 "$selected_disk" # Root pool
|
||||
done
|
||||
@@ -553,8 +558,8 @@ echo "======= create zfs pools and datasets =========="
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
zpool create \
|
||||
$v_bpool_tweaks -O canmount=off -O devices=off \
|
||||
-o cachefile=/etc/zpool.cache \
|
||||
-o compatibility=grub2 \
|
||||
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
|
||||
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
|
||||
|
||||
@@ -606,6 +611,16 @@ if [[ $v_swap_size -gt 0 ]]; then
|
||||
mkswap -f "/dev/zvol/$v_rpool_name/swap"
|
||||
fi
|
||||
|
||||
if (( c_efimode_enabled == 1 )); then
|
||||
echo "======= create filesystem on EFI partition(s) =========="
|
||||
|
||||
for selected_disk in "${v_selected_disks[@]}"; do
|
||||
mkfs.fat -F32 "${selected_disk}-part1"
|
||||
done
|
||||
mkdir -p "$c_zfs_mount_dir/boot/efi"
|
||||
mount "${v_selected_disks[0]}-part1" "$c_zfs_mount_dir/boot/efi"
|
||||
fi
|
||||
|
||||
echo "======= setting up initial system packages =========="
|
||||
debootstrap --arch=amd64 bookworm "$c_zfs_mount_dir" "$c_deb_packages_repo"
|
||||
|
||||
@@ -630,7 +645,7 @@ CONF
|
||||
|
||||
ip6addr_prefix=$(ip -6 a s | grep -E "inet6.+global" | sed -nE 's/.+inet6\s(([0-9a-z]{1,4}:){4,4}).+/\1/p' | head -n 1)
|
||||
|
||||
cat <<CONF > /mnt/etc/systemd/network/10-eth0.network
|
||||
cat <<CONF > "$c_zfs_mount_dir/etc/systemd/network/10-eth0.network"
|
||||
[Match]
|
||||
Name=eth0
|
||||
|
||||
@@ -694,7 +709,6 @@ console-setup console-setup/fontsize-text47 select 8x16
|
||||
console-setup console-setup/codesetcode string Lat15
|
||||
tzdata tzdata/Areas select Europe
|
||||
tzdata tzdata/Zones/Europe select Vienna
|
||||
grub-pc grub-pc/install_devices_empty boolean true
|
||||
CONF'
|
||||
|
||||
chroot_execute "dpkg-reconfigure locales -f noninteractive"
|
||||
@@ -746,20 +760,32 @@ chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
|
||||
|
||||
echo "======= setting up zfs cache =========="
|
||||
|
||||
cp /etc/zpool.cache /mnt/etc/zfs/zpool.cache
|
||||
cp /etc/zpool.cache "$c_zfs_mount_dir/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"
|
||||
|
||||
echo "======= setting up grub =========="
|
||||
chroot_execute "echo 'grub-pc grub-pc/install_devices_empty boolean true' | debconf-set-selections"
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-legacy"
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-pc"
|
||||
chroot_execute "grub-install --recheck ${v_selected_disks[0]}"
|
||||
if (( c_efimode_enabled == 1 )); then
|
||||
chroot_execute "apt install --yes grub-efi-amd64"
|
||||
else
|
||||
chroot_execute "echo 'grub-pc grub-pc/install_devices_empty boolean true' | debconf-set-selections"
|
||||
chroot_execute "apt install --yes grub-legacy"
|
||||
chroot_execute "apt install --yes grub-pc"
|
||||
fi
|
||||
|
||||
if (( c_efimode_enabled == 1 )); then
|
||||
#chroot_execute grub-probe /boot
|
||||
chroot_execute grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck
|
||||
else
|
||||
for disk in ${v_selected_disks[@]}; do
|
||||
chroot_execute "grub-install --recheck $disk"
|
||||
done
|
||||
fi
|
||||
|
||||
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/debian\"|g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/debian\"|g' /etc/default/grub"
|
||||
|
||||
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
||||
@@ -773,21 +799,22 @@ if [[ $v_encrypt_rpool == "1" ]]; then
|
||||
echo "=========set up dropbear=============="
|
||||
|
||||
chroot_execute "apt install --yes dropbear-initramfs"
|
||||
|
||||
cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear-initramfs/authorized_keys"
|
||||
|
||||
mkdir -p "$c_zfs_mount_dir/etc/dropbear/initramfs"
|
||||
cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear/initramfs/authorized_keys"
|
||||
|
||||
cp "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp"
|
||||
chroot_execute "ssh-keygen -p -i -m pem -N '' -f /etc/ssh/ssh_host_rsa_key_temp"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key_temp /etc/dropbear-initramfs/dropbear_rsa_host_key"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key_temp /etc/dropbear/initramfs/dropbear_rsa_host_key"
|
||||
rm -rf "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp"
|
||||
|
||||
cp "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
chroot_execute "ssh-keygen -p -i -m pem -N '' -f /etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key_temp /etc/dropbear-initramfs/dropbear_ecdsa_host_key"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key_temp /etc/dropbear/initramfs/dropbear_ecdsa_host_key"
|
||||
chroot_execute "rm -rf /etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
rm -rf "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
|
||||
rm -rf "$c_zfs_mount_dir/etc/dropbear-initramfs/dropbear_dss_host_key"
|
||||
rm -rf "$c_zfs_mount_dir/etc/dropbear/initramfs/dropbear_dss_host_key"
|
||||
fi
|
||||
|
||||
echo "============setup root prompt============"
|
||||
@@ -804,7 +831,7 @@ cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/root/.ssh/authorized_keys"
|
||||
|
||||
echo "========running packages upgrade and autoremove==========="
|
||||
chroot_execute "apt upgrade --yes"
|
||||
chroot_execute "apt autoremove --yes"
|
||||
chroot_execute "apt purge cryptsetup* --yes"
|
||||
|
||||
echo "===========add static route to initramfs via hook to add default routes for Hetzner due to Debian/Ubuntu initramfs DHCP bug ========="
|
||||
mkdir -p "$c_zfs_mount_dir/usr/share/initramfs-tools/scripts/init-premount"
|
||||
@@ -839,17 +866,23 @@ chmod 755 "$c_zfs_mount_dir/etc/network/interfaces"
|
||||
echo "======= update initramfs =========="
|
||||
chroot_execute "update-initramfs -u -k all"
|
||||
|
||||
chroot_execute "apt remove cryptsetup* --yes"
|
||||
|
||||
echo "======= update grub =========="
|
||||
chroot_execute "update-grub"
|
||||
|
||||
echo "======= setting up zed =========="
|
||||
if [[ $v_zfs_experimental == "1" ]]; then
|
||||
chroot_execute "zfs set canmount=noauto rpool"
|
||||
chroot_execute "zfs set canmount=noauto $v_rpool_name"
|
||||
else
|
||||
initial_load_debian_zed_cache
|
||||
fi
|
||||
|
||||
echo "======= setting mountpoints =========="
|
||||
if (( c_efimode_enabled == 1 )); then
|
||||
umount "$c_zfs_mount_dir/boot/efi"
|
||||
fi
|
||||
|
||||
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/debian"
|
||||
chroot_execute "echo $v_bpool_name/BOOT/debian /boot zfs nodev,relatime,x-systemd.requires=zfs-mount.service,x-systemd.device-timeout=10 0 0 > /etc/fstab"
|
||||
|
||||
|
||||
@@ -366,7 +366,7 @@ function determine_kernel_variant {
|
||||
}
|
||||
|
||||
function chroot_execute {
|
||||
chroot $c_zfs_mount_dir bash -c "$1"
|
||||
chroot $c_zfs_mount_dir bash -c "DEBIAN_FRONTEND=noninteractive $1"
|
||||
}
|
||||
|
||||
function unmount_and_export_fs {
|
||||
@@ -685,10 +685,10 @@ chroot_execute "rm -f /etc/localtime /etc/timezone"
|
||||
chroot_execute "dpkg-reconfigure tzdata -f noninteractive "
|
||||
|
||||
echo "======= installing latest kernel============="
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes linux-headers${v_kernel_variant}-hwe-18.04 linux-image${v_kernel_variant}-hwe-18.04"
|
||||
chroot_execute "apt install --yes linux-headers${v_kernel_variant}-hwe-18.04 linux-image${v_kernel_variant}-hwe-18.04"
|
||||
if [[ $v_kernel_variant == "-virtual" ]]; then
|
||||
# linux-image-extra is only available for virtual hosts
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes linux-image-extra-virtual-hwe-18.04"
|
||||
chroot_execute "apt install --yes linux-image-extra-virtual-hwe-18.04"
|
||||
fi
|
||||
|
||||
echo "======= installing aux packages =========="
|
||||
@@ -736,12 +736,14 @@ chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024))
|
||||
|
||||
echo "======= setting up grub =========="
|
||||
chroot_execute "echo 'grub-pc grub-pc/install_devices_empty boolean true' | debconf-set-selections"
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-pc"
|
||||
chroot_execute "grub-install ${v_selected_disks[0]}"
|
||||
chroot_execute "apt install --yes grub-pc"
|
||||
for disk in ${v_selected_disks[@]}; do
|
||||
chroot_execute "grub-install $disk"
|
||||
done
|
||||
|
||||
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/ubuntu\"|g' /etc/default/grub"
|
||||
|
||||
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
||||
@@ -769,18 +771,6 @@ if [[ $v_encrypt_rpool == "1" ]]; then
|
||||
rm -rf "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
|
||||
rm -rf "$c_zfs_mount_dir/etc/dropbear-initramfs/dropbear_dss_host_key"
|
||||
|
||||
cd "$c_zfs_mount_dir/root"
|
||||
wget http://ftp.de.debian.org/debian/pool/main/libt/libtommath/libtommath1_1.1.0-3_amd64.deb
|
||||
wget http://ftp.de.debian.org/debian/pool/main/d/dropbear/dropbear-bin_2018.76-5_amd64.deb
|
||||
wget http://ftp.de.debian.org/debian/pool/main/d/dropbear/dropbear-initramfs_2018.76-5_all.deb
|
||||
|
||||
chroot_execute "dpkg -i /root/libtommath1_1.1.0-3_amd64.deb"
|
||||
chroot_execute "dpkg -i /root/dropbear-bin_2018.76-5_amd64.deb"
|
||||
chroot_execute "dpkg -i /root/dropbear-initramfs_2018.76-5_all.deb"
|
||||
|
||||
rm $c_zfs_mount_dir/root/*.deb
|
||||
cd /root
|
||||
fi
|
||||
|
||||
echo "============setup root prompt============"
|
||||
@@ -793,6 +783,7 @@ CONF
|
||||
|
||||
echo "========running packages upgrade==========="
|
||||
chroot_execute "apt upgrade --yes"
|
||||
chroot_execute "apt purge cryptsetup* --yes"
|
||||
|
||||
echo "===========add static route to initramfs via hook to add default routes due to Ubuntu initramfs DHCP bug ========="
|
||||
mkdir -p "$c_zfs_mount_dir/usr/share/initramfs-tools/scripts/init-premount"
|
||||
@@ -816,8 +807,8 @@ 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"
|
||||
@@ -830,7 +821,7 @@ chroot_execute "update-grub"
|
||||
|
||||
echo "======= setting up zed =========="
|
||||
|
||||
chroot_execute "zfs set canmount=noauto rpool"
|
||||
chroot_execute "zfs set canmount=noauto $v_rpool_name"
|
||||
|
||||
echo "======= setting mountpoints =========="
|
||||
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu"
|
||||
|
||||
@@ -366,7 +366,7 @@ function determine_kernel_variant {
|
||||
}
|
||||
|
||||
function chroot_execute {
|
||||
chroot $c_zfs_mount_dir bash -c "$1"
|
||||
chroot $c_zfs_mount_dir bash -c "DEBIAN_FRONTEND=noninteractive $1"
|
||||
}
|
||||
|
||||
function unmount_and_export_fs {
|
||||
@@ -685,10 +685,10 @@ chroot_execute "rm -f /etc/localtime /etc/timezone"
|
||||
chroot_execute "dpkg-reconfigure tzdata -f noninteractive "
|
||||
|
||||
echo "======= installing latest kernel============="
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes linux-headers${v_kernel_variant} linux-image${v_kernel_variant}"
|
||||
chroot_execute "apt install --yes linux-headers${v_kernel_variant} linux-image${v_kernel_variant}"
|
||||
if [[ $v_kernel_variant == "-virtual" ]]; then
|
||||
# linux-image-extra is only available for virtual hosts
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes linux-image-extra-virtual"
|
||||
chroot_execute "apt install --yes linux-image-extra-virtual"
|
||||
fi
|
||||
|
||||
|
||||
@@ -737,12 +737,14 @@ chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024))
|
||||
|
||||
echo "======= setting up grub =========="
|
||||
chroot_execute "echo 'grub-pc grub-pc/install_devices_empty boolean true' | debconf-set-selections"
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-pc"
|
||||
chroot_execute "grub-install ${v_selected_disks[0]}"
|
||||
chroot_execute "apt install --yes grub-pc"
|
||||
for disk in ${v_selected_disks[@]}; do
|
||||
chroot_execute "grub-install $disk"
|
||||
done
|
||||
|
||||
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/ubuntu\"|g' /etc/default/grub"
|
||||
|
||||
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
||||
@@ -755,7 +757,7 @@ done
|
||||
if [[ $v_encrypt_rpool == "1" ]]; then
|
||||
echo "=========set up dropbear=============="
|
||||
chroot_execute "apt install --yes dropbear-initramfs"
|
||||
|
||||
|
||||
cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear-initramfs/authorized_keys"
|
||||
|
||||
cp "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp"
|
||||
@@ -794,6 +796,7 @@ CONF
|
||||
|
||||
echo "========running packages upgrade==========="
|
||||
chroot_execute "apt upgrade --yes"
|
||||
chroot_execute "apt purge cryptsetup* --yes"
|
||||
|
||||
echo "===========add static route to initramfs via hook to add default routes due to Ubuntu initramfs DHCP bug ========="
|
||||
mkdir -p "$c_zfs_mount_dir/usr/share/initramfs-tools/scripts/init-premount"
|
||||
@@ -831,7 +834,7 @@ chroot_execute "update-grub"
|
||||
|
||||
echo "======= setting up zed =========="
|
||||
|
||||
chroot_execute "zfs set canmount=noauto rpool"
|
||||
chroot_execute "zfs set canmount=noauto $v_rpool_name"
|
||||
|
||||
echo "======= setting mountpoints =========="
|
||||
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu"
|
||||
|
||||
@@ -366,7 +366,7 @@ function determine_kernel_variant {
|
||||
}
|
||||
|
||||
function chroot_execute {
|
||||
chroot $c_zfs_mount_dir bash -c "$1"
|
||||
chroot $c_zfs_mount_dir bash -c "DEBIAN_FRONTEND=noninteractive $1"
|
||||
}
|
||||
|
||||
function unmount_and_export_fs {
|
||||
@@ -685,10 +685,10 @@ chroot_execute "rm -f /etc/localtime /etc/timezone"
|
||||
chroot_execute "dpkg-reconfigure tzdata -f noninteractive "
|
||||
|
||||
echo "======= installing latest kernel============="
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes linux-headers${v_kernel_variant} linux-image${v_kernel_variant}"
|
||||
chroot_execute "apt install --yes linux-headers${v_kernel_variant} linux-image${v_kernel_variant}"
|
||||
if [[ $v_kernel_variant == "-virtual" ]]; then
|
||||
# linux-image-extra is only available for virtual hosts
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes linux-image-extra-virtual"
|
||||
chroot_execute "apt install --yes linux-image-extra-virtual"
|
||||
fi
|
||||
|
||||
|
||||
@@ -737,12 +737,14 @@ chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024))
|
||||
|
||||
echo "======= setting up grub =========="
|
||||
chroot_execute "echo 'grub-pc grub-pc/install_devices_empty boolean true' | debconf-set-selections"
|
||||
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes grub-pc"
|
||||
chroot_execute "grub-install ${v_selected_disks[0]}"
|
||||
chroot_execute "apt install --yes grub-pc"
|
||||
for disk in ${v_selected_disks[@]}; do
|
||||
chroot_execute "grub-install $disk"
|
||||
done
|
||||
|
||||
chroot_execute "sed -i 's/#GRUB_TERMINAL=console/GRUB_TERMINAL=console/g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0\"|' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=rpool/ROOT/ubuntu\"|g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's|GRUB_CMDLINE_LINUX=\"\"|GRUB_CMDLINE_LINUX=\"root=ZFS=$v_rpool_name/ROOT/ubuntu\"|g' /etc/default/grub"
|
||||
|
||||
chroot_execute "sed -i 's/quiet//g' /etc/default/grub"
|
||||
chroot_execute "sed -i 's/splash//g' /etc/default/grub"
|
||||
@@ -755,33 +757,22 @@ done
|
||||
if [[ $v_encrypt_rpool == "1" ]]; then
|
||||
echo "=========set up dropbear=============="
|
||||
chroot_execute "apt install --yes dropbear-initramfs"
|
||||
|
||||
cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear-initramfs/authorized_keys"
|
||||
|
||||
mkdir -p "$c_zfs_mount_dir/etc/dropbear/initramfs"
|
||||
cp /root/.ssh/authorized_keys "$c_zfs_mount_dir/etc/dropbear/initramfs/authorized_keys"
|
||||
|
||||
cp "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp"
|
||||
chroot_execute "ssh-keygen -p -i -m pem -N '' -f /etc/ssh/ssh_host_rsa_key_temp"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key_temp /etc/dropbear-initramfs/dropbear_rsa_host_key"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key_temp /etc/dropbear/initramfs/dropbear_rsa_host_key"
|
||||
rm -rf "$c_zfs_mount_dir/etc/ssh/ssh_host_rsa_key_temp"
|
||||
|
||||
cp "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key" "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
chroot_execute "ssh-keygen -p -i -m pem -N '' -f /etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key_temp /etc/dropbear-initramfs/dropbear_ecdsa_host_key"
|
||||
chroot_execute "/usr/lib/dropbear/dropbearconvert openssh dropbear /etc/ssh/ssh_host_ecdsa_key_temp /etc/dropbear/initramfs/dropbear_ecdsa_host_key"
|
||||
chroot_execute "rm -rf /etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
rm -rf "$c_zfs_mount_dir/etc/ssh/ssh_host_ecdsa_key_temp"
|
||||
|
||||
rm -rf "$c_zfs_mount_dir/etc/dropbear-initramfs/dropbear_dss_host_key"
|
||||
|
||||
cd "$c_zfs_mount_dir/root"
|
||||
wget http://ftp.de.debian.org/debian/pool/main/libt/libtommath/libtommath1_1.2.0-6_amd64.deb
|
||||
wget http://ftp.de.debian.org/debian/pool/main/d/dropbear/dropbear-bin_2020.81-3_amd64.deb
|
||||
wget http://ftp.de.debian.org/debian/pool/main/d/dropbear/dropbear-initramfs_2020.81-3_all.deb
|
||||
|
||||
chroot_execute "dpkg -i /root/libtommath1_1.2.0-6_amd64.deb"
|
||||
chroot_execute "dpkg -i /root/dropbear-bin_2020.81-3_amd64.deb"
|
||||
chroot_execute "dpkg -i /root/dropbear-initramfs_2020.81-3_all.deb"
|
||||
|
||||
rm $c_zfs_mount_dir/root/*.deb
|
||||
cd /root
|
||||
rm -rf "$c_zfs_mount_dir/etc/dropbear/initramfs/dropbear_dss_host_key"
|
||||
fi
|
||||
|
||||
echo "============setup root prompt============"
|
||||
@@ -794,6 +785,7 @@ CONF
|
||||
|
||||
echo "========running packages upgrade==========="
|
||||
chroot_execute "apt upgrade --yes"
|
||||
chroot_execute "apt purge cryptsetup* --yes"
|
||||
|
||||
echo "===========add static route to initramfs via hook to add default routes due to Ubuntu initramfs DHCP bug ========="
|
||||
mkdir -p "$c_zfs_mount_dir/usr/share/initramfs-tools/scripts/init-premount"
|
||||
@@ -831,7 +823,7 @@ chroot_execute "update-grub"
|
||||
|
||||
echo "======= setting up zed =========="
|
||||
|
||||
chroot_execute "zfs set canmount=noauto rpool"
|
||||
chroot_execute "zfs set canmount=noauto $v_rpool_name"
|
||||
|
||||
echo "======= setting mountpoints =========="
|
||||
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu"
|
||||
|
||||
Reference in New Issue
Block a user