mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-30 14:55:16 +00:00
fa00892778
ospkgs and otherpkgs passed --force-yes to every apt-get upgrade and install. apt has printed a deprecation warning for it since 1.1, and the flag also allowed downgrades, changes to held packages and the removal of essential packages, none of which an unattended package update should do. Three of the ospkgs installs relied on it alone for the unsigned xCAT repositories and ran without DEBIAN_FRONTEND=noninteractive, unlike the upgrade. The 8 call sites now go through xcat_apt_get in xcatpkgutils.sh, which runs apt-get with -y and --allow-unauthenticated under DEBIAN_FRONTEND=noninteractive. Each call site keeps its own quiet, Dpkg and recommends options. A held package or an explicit older version now fails the install instead of being forced, as on the rpm side. --allow-unauthenticated is accepted by every apt release xCAT provisions. Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
41 lines
976 B
Bash
Executable File
41 lines
976 B
Bash
Executable File
#!/bin/sh
|
|
# EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
# Shared POSIX shell helpers for the ospkgs and otherpkgs postscripts.
|
|
|
|
xcat_find_rpm_package_manager()
|
|
{
|
|
if [ -x "${1:-/usr/bin}/dnf" ]; then
|
|
printf '%s\n' dnf
|
|
elif [ -x "${1:-/usr/bin}/yum" ]; then
|
|
printf '%s\n' yum
|
|
else
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
# The xCAT repositories are unsigned, and an unattended node cannot answer a debconf prompt.
|
|
xcat_apt_get()
|
|
{
|
|
DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated "$@"
|
|
}
|
|
|
|
# Keep the marker assignment last so callers know the whole library loaded.
|
|
|
|
xcat_is_el_modular_pkgdir()
|
|
{
|
|
case "$1" in
|
|
rhel[89]*|rhel1[0-9]*|rhels[89]*|rhels1[0-9]*|\
|
|
centos[89]*|centos1[0-9]*|rocky[89]*|rocky1[0-9]*|\
|
|
alma[89]*|alma1[0-9]*|almalinux[89]*|almalinux1[0-9]*|\
|
|
ol[89]*|ol1[0-9]*)
|
|
return 0
|
|
;;
|
|
esac
|
|
|
|
return 1
|
|
}
|
|
|
|
# shellcheck disable=SC2034
|
|
XCATPKGUTILS_LOADED=1
|