From 8e97ebc3a476a3e92cee3573c1607464c16da1a7 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 22 Sep 2024 03:14:02 +0900 Subject: [PATCH] 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 --- all-in-one.sh | 6 +++--- copy_logs.sh | 12 ++++++------ functions | 8 +------- run_tests.sh | 4 ++-- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/all-in-one.sh b/all-in-one.sh index 6caaa05e7..fd24db4c2 100755 --- a/all-in-one.sh +++ b/all-in-one.sh @@ -42,9 +42,9 @@ print_header 'Start (all-in-one.sh)' if is_fedora; then print_header 'Setup (RedHat based)' - sudo -E $YUM -y remove facter puppet rdo-release - sudo -E $YUM -y install libxml2-devel libxslt-devel ruby-devel rubygems wget qemu-img - sudo -E $YUM -y groupinstall "Development Tools" + sudo -E dnf -y remove facter puppet rdo-release + sudo -E dnf -y install libxml2-devel libxslt-devel ruby-devel rubygems wget qemu-img + sudo -E dnf -y groupinstall "Development Tools" DASHBOARD="dashboard" elif uses_debs; then print_header 'Setup (Debian based)' diff --git a/copy_logs.sh b/copy_logs.sh index 5261aa2f7..5067967eb 100755 --- a/copy_logs.sh +++ b/copy_logs.sh @@ -338,14 +338,14 @@ if [ `command -v apt` ]; then apt-cache policy > $LOG_DIR/apt-cache-policy.txt sudo cp -r /etc/apt $LOG_DIR/etc/apt fi -if [ `command -v rpm` ]; then + +if is_fedora; then rpm -qa |sort > $LOG_DIR/rpm-qa.txt - sudo $YUM repolist -v > $LOG_DIR/repolist.txt - sudo $YUM 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 repolist -v > $LOG_DIR/repolist.txt + sudo dnf list installed > $LOG_DIR/installed-packages.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 sudo cp /var/log/dnf.log $LOG_DIR/dnf sudo cp /var/log/dnf.rpm.log $LOG_DIR/dnf diff --git a/functions b/functions index ab7fa2ad4..5a1014c35 100644 --- a/functions +++ b/functions @@ -161,12 +161,6 @@ uses_debs() { type "apt-get" 2>/dev/null } -if type "dnf" 2>/dev/null;then - export YUM=dnf -else - export YUM=yum -fi - print_header() { if [ -n "$(set | grep xtrace)" ]; then set +x @@ -224,7 +218,7 @@ install_puppet() { fi fi elif is_fedora; then - $SUDO $YUM install -y ${PUPPET_PKG} + $SUDO dnf install -y ${PUPPET_PKG} fi } diff --git a/run_tests.sh b/run_tests.sh index 48aa7ec2f..5b101220a 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -166,7 +166,7 @@ fi if uses_debs; then $SUDO apt-get install -y dstat ebtables iotop sysstat 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 # SElinux in permissive mode so later we can catch alerts $SUDO selinuxenabled && $SUDO setenforce 0 @@ -224,7 +224,7 @@ if [ "${MANAGE_REPOS,,}" = true ]; then fi print_header 'Updating packages' if is_fedora; then - $SUDO $YUM update -y + $SUDO dnf update -y update_ret=$? elif uses_debs; then export DEBIAN_FRONTEND=noninteractive