Merge pull request #245 from viniciusferrao/master

Use `dnf` instead of `yum` for Enterprise Linux distros
This commit is contained in:
Roni Väyrynen
2024-06-27 16:07:58 +03:00
committed by GitHub

View File

@@ -201,14 +201,14 @@ function InstallDependenciesRPM {
if [[ -z $(runcmd_stdout "rpm -qa epel-release") ]] && [[ "$INSTALL_REPOS" == "true" ]]; then if [[ -z $(runcmd_stdout "rpm -qa epel-release") ]] && [[ "$INSTALL_REPOS" == "true" ]]; then
echo echo
printprog "Installing epel-repo" printprog "Installing epel-repo"
runcmd "yum -y install epel-release" runcmd "dnf -y install epel-release"
printok "Installing epel-repo" printok "Installing epel-repo"
fi fi
# install packages # install packages
echo echo
printprog "Installing build dependencies, redis server, python3, git, nfs-utils, cifs-utils, lvm2, ntfs-3g, dmidecode patch" printprog "Installing build dependencies, redis server, python3, git, nfs-utils, cifs-utils, lvm2, ntfs-3g, dmidecode patch"
runcmd "yum -y install gcc gcc-c++ make openssl-devel redis libpng-devel python3 git nfs-utils cifs-utils lvm2 ntfs-3g dmidecode patch" runcmd "dnf -y install gcc gcc-c++ make openssl-devel redis libpng-devel python3 git nfs-utils cifs-utils lvm2 ntfs-3g dmidecode patch"
printok "Installing build dependencies, redis server, python3, git, nfs-utils, cifs-utils, lvm2, ntfs-3g, dmidecode patch" printok "Installing build dependencies, redis server, python3, git, nfs-utils, cifs-utils, lvm2, ntfs-3g, dmidecode patch"
# only run automated node install if executable not found # only run automated node install if executable not found
@@ -221,7 +221,7 @@ function InstallDependenciesRPM {
runcmd "curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -" runcmd "curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
fi fi
runcmd "yum install -y nodejs" runcmd "dnf install -y nodejs"
printok "Installing node.js" printok "Installing node.js"
else else
UpdateNodeYarn UpdateNodeYarn
@@ -237,7 +237,7 @@ function InstallDependenciesRPM {
runcmd "curl -s -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo" runcmd "curl -s -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo"
fi fi
runcmd "yum -y install yarn" runcmd "dnf -y install yarn"
printok "Installing yarn" printok "Installing yarn"
fi fi
@@ -248,9 +248,9 @@ function InstallDependenciesRPM {
if [[ "$INSTALL_REPOS" == "true" ]]; then if [[ "$INSTALL_REPOS" == "true" ]]; then
runcmd "rpm -ivh https://forensics.cert.org/cert-forensics-tools-release-el${OSVERSION}.rpm" runcmd "rpm -ivh https://forensics.cert.org/cert-forensics-tools-release-el${OSVERSION}.rpm"
runcmd "sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/cert-forensics-tools.repo" runcmd "sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/cert-forensics-tools.repo"
runcmd "yum --enablerepo=forensics install -y libvhdi-tools" runcmd "dnf --enablerepo=forensics install -y libvhdi-tools"
else else
runcmd "yum install -y libvhdi-tools" runcmd "dnf install -y libvhdi-tools"
fi fi
printok "Installing libvhdi-tools" printok "Installing libvhdi-tools"
fi fi
@@ -385,8 +385,8 @@ function UpdateNodeYarn {
runcmd "curl -sL https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -" runcmd "curl -sL https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
runcmd "yum clean all" runcmd "dnf clean all"
runcmd "yum install -y nodejs" runcmd "dnf install -y nodejs"
printok "node.js version is ${NODEV:-"not installed"}, upgrading to ${NODEVERSION}.x" printok "node.js version is ${NODEV:-"not installed"}, upgrading to ${NODEVERSION}.x"
else else
if [[ -z "$NODEV" ]]; then if [[ -z "$NODEV" ]]; then
@@ -398,7 +398,7 @@ function UpdateNodeYarn {
if [[ "$TASK" == "Update" ]]; then if [[ "$TASK" == "Update" ]]; then
echo echo
printprog "node.js version already on $NODEV, checking updates" printprog "node.js version already on $NODEV, checking updates"
runcmd "yum update -y nodejs yarn" runcmd "dnf update -y nodejs yarn"
printok "node.js version already on $NODEV, checking updates" printok "node.js version already on $NODEV, checking updates"
elif [[ "$TASK" == "Installation" ]]; then elif [[ "$TASK" == "Installation" ]]; then
echo echo
@@ -527,7 +527,7 @@ function InstallSudo {
printok "Installing sudo" printok "Installing sudo"
elif [[ "$PKG_FORMAT" == "rpm" ]]; then elif [[ "$PKG_FORMAT" == "rpm" ]]; then
printprog "Installing sudo" printprog "Installing sudo"
runcmd "yum install -y sudo" runcmd "dnf install -y sudo"
printok "Installing sudo" printok "Installing sudo"
fi fi
fi fi
@@ -1266,7 +1266,7 @@ function CheckOS {
exit 1 exit 1
fi fi
if [[ $(runcmd_stdout "command -v yum") ]]; then if [[ $(runcmd_stdout "command -v dnf") ]]; then
PKG_FORMAT="rpm" PKG_FORMAT="rpm"
fi fi
@@ -1274,9 +1274,9 @@ function CheckOS {
PKG_FORMAT="deb" PKG_FORMAT="deb"
fi fi
# hard dependency which we can't skip so bail out if no yum/apt-get present # hard dependency which we can't skip so bail out if no dnf/apt-get present
if [[ -z "$PKG_FORMAT" ]]; then if [[ -z "$PKG_FORMAT" ]]; then
printfail "this script requires either yum or apt-get" printfail "this script requires either dnf or apt-get"
exit 1 exit 1
fi fi