Skip to content

Commit

Permalink
init: move pkg manager exclude lists to separate step, always run them.
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
  • Loading branch information
89luca89 committed Jan 19, 2025
1 parent afb3b07 commit 58d08f3
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions distrobox-init
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,6 @@ setup_apt()
# shellcheck disable=SC2086,2046
apt-get install -y $(apt-cache show ${deps} 2> /dev/null | grep "Package:" | sort -u | cut -d' ' -f2-)

# Setup hooks
setup_deb_exceptions

# In case the locale is not available, install it
# will ensure we don't fallback to C.UTF-8
if [ -e /etc/locale.gen ] && {
Expand Down Expand Up @@ -862,8 +859,6 @@ setup_apt()
# None
setup_dnf()
{
setup_rpm_exceptions

manager=$1

# If we need to upgrade, do it and exit, no further action required.
Expand Down Expand Up @@ -1060,8 +1055,6 @@ EOF
# None
setup_microdnf()
{
setup_rpm_exceptions

# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
microdnf upgrade -y
Expand Down Expand Up @@ -1243,9 +1236,6 @@ setup_pacman()
pacman -S --noconfirm glibc glibc-locales
fi

# Setup hooks
setup_pacman_exceptions

# Ensure we have tzdata installed and populated, sometimes container
# images blank the zoneinfo directory, so we reinstall the package to
# ensure population
Expand Down Expand Up @@ -1425,8 +1415,6 @@ setup_swupd()
# None
setup_xbps()
{
setup_xbps_exceptions

# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
xbps-install -Syu
Expand Down Expand Up @@ -1522,8 +1510,6 @@ setup_xbps()
# None
setup_zypper()
{
setup_rpm_exceptions

# If we need to upgrade, do it and exit, no further action required.
if [ "${upgrade}" -ne 0 ]; then
zypper dup -y
Expand Down Expand Up @@ -1662,6 +1648,23 @@ done
# Ensure we have the least minimal path of standard Linux File System set
PATH="${PATH}:/bin:/sbin:/usr/bin:/usr/sbin"

# Setup pkg manager exceptions and excludes
if command -v apt-get; then
setup_deb_exceptions
elif command -v pacman; then
setup_pacman_exceptions
elif command -v xbps-install; then
setup_xbps_exceptions
elif command -v zypper; then
setup_rpm_exceptions
elif command -v dnf; then
setup_rpm_exceptions
elif command -v microdnf; then
setup_rpm_exceptions
elif command -v yum; then
setup_rpm_exceptions
fi

# Check if dependencies are met for the script to run.
if [ "${upgrade}" -ne 0 ] ||
[ "${missing_packages}" -ne 0 ] ||
Expand Down

0 comments on commit 58d08f3

Please sign in to comment.