Merge pull request #193 from saveriomiroddi/fix_dialog_universe_repo_requirement
Add compatibility with the standard Ubuntu Desktop
This commit is contained in:
commit
25e4545952
@ -476,46 +476,6 @@ If you think this is a bug, please open an issue on https://github.com/saveriomi
|
||||
print_variables v_suitable_disks
|
||||
}
|
||||
|
||||
# REQUIREMENT: it must be ensured that, for any distro, `apt update` is invoked at this step, as
|
||||
# subsequent steps rely on it.
|
||||
#
|
||||
# There are three parameters:
|
||||
#
|
||||
# 1. the tools are preinstalled (ie. Ubuntu Desktop based);
|
||||
# 2. the default repository supports ZFS 0.8 (ie. Ubuntu 20.04+ based);
|
||||
# 3. the distro provides the precompiled ZFS module (i.e. Ubuntu based, not Debian)
|
||||
#
|
||||
# Fortunately, with Debian-specific logic isolated, we need conditionals based only on #2 - see
|
||||
# install_host_packages() and install_host_packages_UbuntuServer().
|
||||
#
|
||||
function set_zfs_ppa_requirement {
|
||||
apt update
|
||||
|
||||
local zfs_package_version
|
||||
zfs_package_version=$(apt show zfsutils-linux 2> /dev/null | perl -ne 'print /^Version: (\d+\.\d+)/')
|
||||
|
||||
# Test returns true if $zfs_package_version is blank.
|
||||
#
|
||||
if [[ ${ZFS_USE_PPA:-} == "1" ]] || dpkg --compare-versions "$zfs_package_version" lt 0.8; then
|
||||
v_use_ppa=1
|
||||
fi
|
||||
}
|
||||
|
||||
function set_zfs_ppa_requirement_Debian {
|
||||
# Only update apt; in this case, ZFS packages are handled in a specific way.
|
||||
|
||||
apt update
|
||||
}
|
||||
|
||||
# Mint 20 has the CDROM repository enabled, but apt fails when updating due to it (or possibly due
|
||||
# to it being incorrectly setup).
|
||||
#
|
||||
function set_zfs_ppa_requirement_Linuxmint {
|
||||
perl -i -pe 's/^(deb cdrom)/# $1/' /etc/apt/sources.list
|
||||
|
||||
invoke "set_zfs_ppa_requirement"
|
||||
}
|
||||
|
||||
# By using a FIFO, we avoid having to hide statements like `echo $v_passphrase | zpoool create ...`
|
||||
# from the logs.
|
||||
#
|
||||
@ -571,6 +531,58 @@ export ZFS_FREE_TAIL_SPACE=12
|
||||
trap _exit_hook EXIT
|
||||
}
|
||||
|
||||
function prepare_standard_repositories {
|
||||
# Make sure it's enabled. Ubuntu MATE has it, while the standard Ubuntu doesn't.
|
||||
# The program exits with success if the repository is already enabled.
|
||||
#
|
||||
add-apt-repository --yes --no-update universe
|
||||
}
|
||||
|
||||
# Mint 20 has the CDROM repository enabled, but apt fails when updating due to it (or possibly due
|
||||
# to it being incorrectly setup).
|
||||
#
|
||||
function prepare_standard_repositories_Linuxmint {
|
||||
perl -i -pe 's/^(deb cdrom)/# $1/' /etc/apt/sources.list
|
||||
|
||||
# The universe repository may be already enabled, but it's more solid to ensure it.
|
||||
#
|
||||
invoke "prepare_standard_repositories"
|
||||
}
|
||||
|
||||
function prepare_standard_repositories_Debian {
|
||||
# Debian doesn't require universe (for dialog).
|
||||
:
|
||||
}
|
||||
|
||||
function update_apt_index {
|
||||
apt update
|
||||
}
|
||||
|
||||
# There are three parameters:
|
||||
#
|
||||
# 1. the tools are preinstalled (ie. Ubuntu Desktop based);
|
||||
# 2. the default repository supports ZFS 0.8 (ie. Ubuntu 20.04+ based);
|
||||
# 3. the distro provides the precompiled ZFS module (i.e. Ubuntu based, not Debian)
|
||||
#
|
||||
# Fortunately, with Debian-specific logic isolated, we need conditionals based only on #2 - see
|
||||
# install_host_packages() and install_host_packages_UbuntuServer().
|
||||
#
|
||||
function set_use_zfs_ppa {
|
||||
local zfs_package_version
|
||||
zfs_package_version=$(apt show zfsutils-linux 2> /dev/null | perl -ne 'print /^Version: (\d+\.\d+)/')
|
||||
|
||||
# Test returns true if $zfs_package_version is blank.
|
||||
#
|
||||
if [[ ${ZFS_USE_PPA:-} == "1" ]] || dpkg --compare-versions "$zfs_package_version" lt 0.8; then
|
||||
v_use_ppa=1
|
||||
fi
|
||||
}
|
||||
|
||||
function set_use_zfs_ppa_Debian {
|
||||
# Only update apt; in this case, ZFS packages are handled in a specific way.
|
||||
:
|
||||
}
|
||||
|
||||
# Whiptail's lack of multiline editing is quite painful.
|
||||
#
|
||||
function install_dialog_package {
|
||||
@ -1511,9 +1523,11 @@ invoke "display_intro_banner"
|
||||
invoke "check_system_memory"
|
||||
invoke "save_disks_log"
|
||||
invoke "find_suitable_disks"
|
||||
invoke "set_zfs_ppa_requirement"
|
||||
invoke "register_exit_hook"
|
||||
invoke "create_passphrase_named_pipe"
|
||||
invoke "prepare_standard_repositories"
|
||||
invoke "update_apt_index"
|
||||
invoke "set_use_zfs_ppa"
|
||||
invoke "install_dialog_package"
|
||||
|
||||
invoke "select_disks"
|
||||
|
Loading…
Reference in New Issue
Block a user