mirror of
https://github.com/rocky-linux/rocky-tools.git
synced 2024-11-22 05:01:25 +00:00
Check for dnf-plugins-core and enable config-manager
Check to make sure that dnf-plugins-core is present, and force-enable the config-manager plugin for those dnf commands that need it in case it has been disabled.
This commit is contained in:
parent
64fd6b5f08
commit
23bc5d57c8
@ -222,9 +222,20 @@ bin_check() {
|
||||
fi
|
||||
done
|
||||
|
||||
if ! pkg_ver dnf 4.2; then
|
||||
exit_message 'dnf >= 4.2 is required for this script. Please run "dnf update" first.'
|
||||
local -A pkgs
|
||||
pkgs=(
|
||||
[dnf]=4.2
|
||||
[dnf-plugins-core]=0
|
||||
)
|
||||
|
||||
for pkg in "${!pkgs[@]}"; do
|
||||
ver=${pkgs[$pkg]}
|
||||
if ! pkg_ver "$pkg" "$ver"; then
|
||||
exit_message \
|
||||
"$pkg >= $ver is required for this script. Please run "\
|
||||
"\"dnf install $pkg; dnf update\" first."
|
||||
fi
|
||||
done;
|
||||
|
||||
if (( ${#missing[@]} )); then
|
||||
exit_message "Commands not found: ${missing[*]}. Possible bad PATH setting or corrupt installation."
|
||||
@ -717,7 +728,8 @@ EOF
|
||||
infomsg $'\nRemoving dnf cache\n'
|
||||
rm -rf /var/cache/{yum,dnf}
|
||||
infomsg $'Ensuring repos are enabled before the package swap\n'
|
||||
safednf -y config-manager --set-enabled "${!repo_map[@]}" || {
|
||||
safednf -y --enableplugin=config-manager config-manager \
|
||||
--set-enabled "${!repo_map[@]}" || {
|
||||
printf '%s\n' 'Repo name missing?'
|
||||
exit 25
|
||||
}
|
||||
@ -730,7 +742,8 @@ EOF
|
||||
|
||||
if (( ${#managed_repos[@]} )); then
|
||||
infomsg $'\nDisabling subscription managed repos\n'
|
||||
safednf -y config-manager --disable "${managed_repos[@]}"
|
||||
safednf -y --enableplugin=config-manager config-manager \
|
||||
--disable "${managed_repos[@]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user