Drop switch between dnf and yum

Now we run jobs only in CentOS Stream 9 from Red Hat family operating
systems, so we can safely assume that only the dnf command is
available.

Change-Id: I4adde6a88e99ff4a25d3f497dbeca815bc29b872
This commit is contained in:
Takashi Kajinami 2024-09-22 03:14:02 +09:00
parent ed4a44e1f2
commit 8e97ebc3a4
4 changed files with 12 additions and 18 deletions

View File

@ -42,9 +42,9 @@ print_header 'Start (all-in-one.sh)'
if is_fedora; then if is_fedora; then
print_header 'Setup (RedHat based)' print_header 'Setup (RedHat based)'
sudo -E $YUM -y remove facter puppet rdo-release sudo -E dnf -y remove facter puppet rdo-release
sudo -E $YUM -y install libxml2-devel libxslt-devel ruby-devel rubygems wget qemu-img sudo -E dnf -y install libxml2-devel libxslt-devel ruby-devel rubygems wget qemu-img
sudo -E $YUM -y groupinstall "Development Tools" sudo -E dnf -y groupinstall "Development Tools"
DASHBOARD="dashboard" DASHBOARD="dashboard"
elif uses_debs; then elif uses_debs; then
print_header 'Setup (Debian based)' print_header 'Setup (Debian based)'

View File

@ -338,14 +338,14 @@ if [ `command -v apt` ]; then
apt-cache policy > $LOG_DIR/apt-cache-policy.txt apt-cache policy > $LOG_DIR/apt-cache-policy.txt
sudo cp -r /etc/apt $LOG_DIR/etc/apt sudo cp -r /etc/apt $LOG_DIR/etc/apt
fi fi
if [ `command -v rpm` ]; then
if is_fedora; then
rpm -qa |sort > $LOG_DIR/rpm-qa.txt rpm -qa |sort > $LOG_DIR/rpm-qa.txt
sudo $YUM repolist -v > $LOG_DIR/repolist.txt sudo dnf repolist -v > $LOG_DIR/repolist.txt
sudo $YUM list installed > $LOG_DIR/installed-packages.txt sudo dnf list installed > $LOG_DIR/installed-packages.txt
sudo cp -r /etc/yum.repos.d $LOG_DIR/etc/yum.repos.d
fi
if [ `command -v dnf` ]; then
sudo dnf module list > $LOG_DIR/modulelist.txt sudo dnf module list > $LOG_DIR/modulelist.txt
sudo cp -r /etc/yum.repos.d $LOG_DIR/etc/yum.repos.d
mkdir $LOG_DIR/dnf mkdir $LOG_DIR/dnf
sudo cp /var/log/dnf.log $LOG_DIR/dnf sudo cp /var/log/dnf.log $LOG_DIR/dnf
sudo cp /var/log/dnf.rpm.log $LOG_DIR/dnf sudo cp /var/log/dnf.rpm.log $LOG_DIR/dnf

View File

@ -161,12 +161,6 @@ uses_debs() {
type "apt-get" 2>/dev/null type "apt-get" 2>/dev/null
} }
if type "dnf" 2>/dev/null;then
export YUM=dnf
else
export YUM=yum
fi
print_header() { print_header() {
if [ -n "$(set | grep xtrace)" ]; then if [ -n "$(set | grep xtrace)" ]; then
set +x set +x
@ -224,7 +218,7 @@ install_puppet() {
fi fi
fi fi
elif is_fedora; then elif is_fedora; then
$SUDO $YUM install -y ${PUPPET_PKG} $SUDO dnf install -y ${PUPPET_PKG}
fi fi
} }

View File

@ -166,7 +166,7 @@ fi
if uses_debs; then if uses_debs; then
$SUDO apt-get install -y dstat ebtables iotop sysstat $SUDO apt-get install -y dstat ebtables iotop sysstat
elif is_fedora; then elif is_fedora; then
$SUDO $YUM install -y dstat setools setroubleshoot audit iotop sysstat $SUDO dnf install -y dstat setools setroubleshoot audit iotop sysstat
$SUDO systemctl start auditd $SUDO systemctl start auditd
# SElinux in permissive mode so later we can catch alerts # SElinux in permissive mode so later we can catch alerts
$SUDO selinuxenabled && $SUDO setenforce 0 $SUDO selinuxenabled && $SUDO setenforce 0
@ -224,7 +224,7 @@ if [ "${MANAGE_REPOS,,}" = true ]; then
fi fi
print_header 'Updating packages' print_header 'Updating packages'
if is_fedora; then if is_fedora; then
$SUDO $YUM update -y $SUDO dnf update -y
update_ret=$? update_ret=$?
elif uses_debs; then elif uses_debs; then
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive