Determine kernel variant

This is required to use this script for a dedicated root server.
This commit is contained in:
Julian Kornberger
2020-03-09 18:22:32 +01:00
parent 5ff5bcba83
commit 4f1089bc7e
3 changed files with 17 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
# zfs-hetzner-vm # zfs-hetzner-vm
Scripts to install Debian 10 or Ubuntu 18 with ZFS root on Hetzner VPS.<br/> Scripts to install Debian 10 or Ubuntu 18 with ZFS root on Hetzner root servers (virtual and dedicated).<br/>
__WARNING:__ all data on the disk will be destroyed. __WARNING:__ all data on the disk will be destroyed.
## How to use: ## How to use:

View File

@@ -26,6 +26,7 @@ declare -a v_selected_disks
v_swap_size= # integer v_swap_size= # integer
v_free_tail_space= # integer v_free_tail_space= # integer
v_hostname= v_hostname=
v_kernel_variant=
v_zfs_arc_max_mb= v_zfs_arc_max_mb=
v_root_password= v_root_password=
v_encrypt_rpool= # 0=false, 1=true v_encrypt_rpool= # 0=false, 1=true
@@ -387,6 +388,12 @@ function ask_hostname {
print_variables v_hostname print_variables v_hostname
} }
function determine_kernel_variant {
if dmidecode | grep vServer 2>&1; then
v_kernel_variant="-cloud"
fi
}
function chroot_execute { function chroot_execute {
chroot $c_zfs_mount_dir bash -c "$1" chroot $c_zfs_mount_dir bash -c "$1"
} }
@@ -686,7 +693,7 @@ chroot_execute "rm -f /etc/localtime /etc/timezone"
chroot_execute "dpkg-reconfigure tzdata -f noninteractive " chroot_execute "dpkg-reconfigure tzdata -f noninteractive "
echo "======= installing latest kernel=============" echo "======= installing latest kernel============="
chroot_execute "apt install --yes -t buster-backports linux-image-cloud-amd64 linux-headers-cloud-amd64" chroot_execute "apt install --yes -t buster-backports linux-image${v_kernel_variant}-amd64 linux-headers${v_kernel_variant}-amd64"
echo "======= installing aux packages ==========" echo "======= installing aux packages =========="
chroot_execute "apt install --yes man wget curl software-properties-common nano htop gnupg" chroot_execute "apt install --yes man wget curl software-properties-common nano htop gnupg"

View File

@@ -26,6 +26,7 @@ declare -a v_selected_disks
v_swap_size= # integer v_swap_size= # integer
v_free_tail_space= # integer v_free_tail_space= # integer
v_hostname= v_hostname=
v_kernel_variant=
v_zfs_arc_max_mb= v_zfs_arc_max_mb=
v_root_password= v_root_password=
v_encrypt_rpool= # 0=false, 1=true v_encrypt_rpool= # 0=false, 1=true
@@ -352,6 +353,12 @@ function ask_hostname {
print_variables v_hostname print_variables v_hostname
} }
function determine_kernel_variant {
if dmidecode | grep vServer 2>&1; then
v_kernel_variant="-virtual"
fi
}
function chroot_execute { function chroot_execute {
chroot $c_zfs_mount_dir bash -c "$1" chroot $c_zfs_mount_dir bash -c "$1"
} }
@@ -658,7 +665,7 @@ chroot_execute "rm -f /etc/localtime /etc/timezone"
chroot_execute "dpkg-reconfigure tzdata -f noninteractive " chroot_execute "dpkg-reconfigure tzdata -f noninteractive "
echo "======= installing latest kernel=============" echo "======= installing latest kernel============="
chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes linux-headers-virtual-hwe-18.04 linux-image-virtual-hwe-18.04 linux-image-extra-virtual-hwe-18.04" chroot_execute "DEBIAN_FRONTEND=noninteractive apt install --yes linux-headers${v_kernel_variant}-hwe-18.04 linux-image${v_kernel_variant}-hwe-18.04 linux-image-extra${v_kernel_variant}-hwe-18.04"
echo "======= installing aux packages ==========" echo "======= installing aux packages =========="
chroot_execute "apt install --yes man wget curl software-properties-common nano htop gnupg" chroot_execute "apt install --yes man wget curl software-properties-common nano htop gnupg"