Refactored package installation functions

KUbuntu doesn't ship with zfsutils-linux installed, however, this doesn't complete the support.
This commit is contained in:
Saverio Miroddi 2021-04-28 23:40:03 +02:00
parent 224e630b7f
commit f2be14369f

View File

@ -576,8 +576,12 @@ function set_use_zfs_ppa_Debian {
# Whiptail's lack of multiline editing is quite painful.
#
function install_dialog_package {
apt install -y dialog
function install_host_base_packages {
# `efibootmgr` needs installation on all the systems.
# the other packages are each required by different distros, so for simplicity, they're all packed
# together.
#
apt install -y efibootmgr dialog software-properties-common
}
function select_disks {
@ -827,7 +831,7 @@ function ask_dataset_create_options {
print_variables v_dataset_create_options
}
function install_host_packages {
function install_host_zfs_packages {
if [[ $v_use_ppa == "1" ]]; then
if [[ ${ZFS_SKIP_LIVE_ZFS_MODULE_INSTALL:-} != "1" ]]; then
add-apt-repository --yes "$c_ppa"
@ -846,12 +850,14 @@ function install_host_packages {
fi
fi
apt install --yes efibootmgr
# Required only by some distros.
#
apt install --yes zfsutils-linux
zfs --version > "$c_zfs_module_version_log" 2>&1
}
function install_host_packages_Debian {
function install_host_zfs_packages_Debian {
if [[ ${ZFS_SKIP_LIVE_ZFS_MODULE_INSTALL:-} != "1" ]]; then
echo "zfs-dkms zfs-dkms/note-incompatible-licenses note true" | debconf-set-selections
@ -864,29 +870,10 @@ function install_host_packages_Debian {
modprobe zfs
fi
apt install --yes efibootmgr
zfs --version > "$c_zfs_module_version_log" 2>&1
}
# Differently from Ubuntu, Mint doesn't have the package installed in the live version.
#
function install_host_packages_Linuxmint {
apt install --yes zfsutils-linux
invoke "install_host_packages"
}
function install_host_packages_elementary {
if [[ ${ZFS_SKIP_LIVE_ZFS_MODULE_INSTALL:-} != "1" ]]; then
apt update
apt install --yes software-properties-common
fi
invoke "install_host_packages"
}
function install_host_packages_UbuntuServer {
function install_host_zfs_packages_UbuntuServer {
if [[ $v_use_ppa != "1" ]]; then
apt install --yes zfsutils-linux efibootmgr
@ -911,7 +898,7 @@ function install_host_packages_UbuntuServer {
apt update
apt install --yes "linux-headers-$(uname -r)"
install_host_packages
install_host_zfs_packages
else
apt install --yes efibootmgr
fi
@ -1279,7 +1266,13 @@ function prepare_jail {
chroot_execute 'echo "nameserver 8.8.8.8" >> /etc/resolv.conf'
}
# See install_host_packages() for some comments.
# Same principle as install_host_base_packages().
#
function install_jail_base_packages {
chroot_execute "apt install --yes rsync grub-efi-amd64-signed shim-signed software-properties-common"
}
# See install_host_zfs_packages() for some comments.
#
function install_jail_zfs_packages {
if [[ $v_use_ppa == "1" ]]; then
@ -1301,8 +1294,6 @@ function install_jail_zfs_packages {
#
chroot_execute "apt install --yes libzfs2linux zfs-initramfs zfs-zed zfsutils-linux"
fi
chroot_execute "apt install --yes grub-efi-amd64-signed shim-signed"
}
function install_jail_zfs_packages_Debian {
@ -1321,18 +1312,12 @@ APT'
chroot_execute "apt update"
chroot_execute 'echo "zfs-dkms zfs-dkms/note-incompatible-licenses note true" | debconf-set-selections'
chroot_execute "apt install --yes rsync zfs-initramfs zfs-dkms grub-efi-amd64-signed shim-signed"
}
function install_jail_zfs_packages_elementary {
chroot_execute "apt install --yes software-properties-common"
invoke "install_jail_zfs_packages"
chroot_execute "apt install --yes zfs-initramfs zfs-dkms"
}
function install_jail_zfs_packages_UbuntuServer {
if [[ $v_use_ppa != "1" ]]; then
chroot_execute "apt install --yes zfsutils-linux zfs-initramfs grub-efi-amd64-signed shim-signed"
chroot_execute "apt install --yes zfsutils-linux zfs-initramfs"
else
invoke "install_jail_zfs_packages"
fi
@ -1519,7 +1504,7 @@ invoke "create_passphrase_named_pipe"
invoke "prepare_standard_repositories"
invoke "update_apt_index"
invoke "set_use_zfs_ppa"
invoke "install_dialog_package"
invoke "install_host_base_packages"
invoke "select_disks"
invoke "select_pools_raid_type"
@ -1532,7 +1517,7 @@ invoke "ask_rpool_name"
invoke "ask_pool_create_options"
invoke "ask_dataset_create_options"
invoke "install_host_packages"
invoke "install_host_zfs_packages"
invoke "setup_partitions"
if [[ -z ${ZFS_OS_INSTALLATION_SCRIPT:-} ]]; then
@ -1554,6 +1539,7 @@ else
fi
invoke "prepare_jail"
invoke "install_jail_base_packages"
invoke "install_jail_zfs_packages"
invoke "prepare_efi_partition"
invoke "configure_and_update_grub"