Merge "Update again and retry a failed package install"
This commit is contained in:
@@ -881,29 +881,43 @@ function get_packages {
|
|||||||
|
|
||||||
# Distro-agnostic package installer
|
# Distro-agnostic package installer
|
||||||
# install_package package [package ...]
|
# install_package package [package ...]
|
||||||
function install_package {
|
function update_package_repo {
|
||||||
|
if [[ "NO_UPDATE_REPOS" = "True" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if is_ubuntu; then
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
if is_ubuntu; then
|
if [[ "$REPOS_UPDATED" != "True" || "$RETRY_UPDATE" = "True" ]]; then
|
||||||
# if there are transient errors pulling the updates, that's fine. It may
|
# if there are transient errors pulling the updates, that's fine.
|
||||||
# be secondary repositories that we don't really care about.
|
# It may be secondary repositories that we don't really care about.
|
||||||
[[ "$NO_UPDATE_REPOS" = "True" ]] || apt_get update || /bin/true
|
apt_get update || /bin/true
|
||||||
NO_UPDATE_REPOS=True
|
REPOS_UPDATED=True
|
||||||
|
fi
|
||||||
$xtrace
|
$xtrace
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function real_install_package {
|
||||||
|
if is_ubuntu; then
|
||||||
apt_get install "$@"
|
apt_get install "$@"
|
||||||
elif is_fedora; then
|
elif is_fedora; then
|
||||||
$xtrace
|
|
||||||
yum_install "$@"
|
yum_install "$@"
|
||||||
elif is_suse; then
|
elif is_suse; then
|
||||||
$xtrace
|
|
||||||
zypper_install "$@"
|
zypper_install "$@"
|
||||||
else
|
else
|
||||||
$xtrace
|
|
||||||
exit_distro_not_supported "installing packages"
|
exit_distro_not_supported "installing packages"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Distro-agnostic package installer
|
||||||
|
# install_package package [package ...]
|
||||||
|
function install_package {
|
||||||
|
update_package_repo
|
||||||
|
real_install_package $@ || RETRY_UPDATE=True update_package_repo && real_install_package $@
|
||||||
|
}
|
||||||
|
|
||||||
# Distro-agnostic function to tell if a package is installed
|
# Distro-agnostic function to tell if a package is installed
|
||||||
# is_package_installed package [package ...]
|
# is_package_installed package [package ...]
|
||||||
function is_package_installed {
|
function is_package_installed {
|
||||||
|
|||||||
Reference in New Issue
Block a user