Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dnf instead of yum for Enterprise Linux distros #245

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions xo-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ function InstallDependenciesRPM {
if [[ -z $(runcmd_stdout "rpm -qa epel-release") ]] && [[ "$INSTALL_REPOS" == "true" ]]; then
echo
printprog "Installing epel-repo"
runcmd "yum -y install epel-release"
runcmd "dnf -y install epel-release"
printok "Installing epel-repo"
fi

# install packages
echo
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"

# only run automated node install if executable not found
Expand All @@ -221,7 +221,7 @@ function InstallDependenciesRPM {
runcmd "curl -s -L https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"
fi

runcmd "yum install -y nodejs"
runcmd "dnf install -y nodejs"
printok "Installing node.js"
else
UpdateNodeYarn
Expand All @@ -237,7 +237,7 @@ function InstallDependenciesRPM {
runcmd "curl -s -o /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo"
fi

runcmd "yum -y install yarn"
runcmd "dnf -y install yarn"
printok "Installing yarn"
fi

Expand All @@ -248,9 +248,9 @@ function InstallDependenciesRPM {
if [[ "$INSTALL_REPOS" == "true" ]]; then
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 "yum --enablerepo=forensics install -y libvhdi-tools"
runcmd "dnf --enablerepo=forensics install -y libvhdi-tools"
else
runcmd "yum install -y libvhdi-tools"
runcmd "dnf install -y libvhdi-tools"
fi
printok "Installing libvhdi-tools"
fi
Expand Down Expand Up @@ -385,8 +385,8 @@ function UpdateNodeYarn {

runcmd "curl -sL https://rpm.nodesource.com/setup_${NODEVERSION}.x | bash -"

runcmd "yum clean all"
runcmd "yum install -y nodejs"
runcmd "dnf clean all"
runcmd "dnf install -y nodejs"
printok "node.js version is ${NODEV:-"not installed"}, upgrading to ${NODEVERSION}.x"
else
if [[ -z "$NODEV" ]]; then
Expand All @@ -398,7 +398,7 @@ function UpdateNodeYarn {
if [[ "$TASK" == "Update" ]]; then
echo
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"
elif [[ "$TASK" == "Installation" ]]; then
echo
Expand Down Expand Up @@ -527,7 +527,7 @@ function InstallSudo {
printok "Installing sudo"
elif [[ "$PKG_FORMAT" == "rpm" ]]; then
printprog "Installing sudo"
runcmd "yum install -y sudo"
runcmd "dnf install -y sudo"
printok "Installing sudo"
fi
fi
Expand Down Expand Up @@ -1266,17 +1266,17 @@ function CheckOS {
exit 1
fi

if [[ $(runcmd_stdout "command -v yum") ]]; then
if [[ $(runcmd_stdout "command -v dnf") ]]; then
PKG_FORMAT="rpm"
fi

if [[ $(runcmd_stdout "command -v apt-get") ]]; then
PKG_FORMAT="deb"
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
printfail "this script requires either yum or apt-get"
printfail "this script requires either dnf or apt-get"
exit 1
fi

Expand Down