From 7a8b1fb2aa4f606915c6475abd49364c8f5e2433 Mon Sep 17 00:00:00 2001 From: bryan Date: Fri, 14 Jan 2022 00:52:48 -0500 Subject: [PATCH] Wire up yum --- installJRMC | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/installJRMC b/installJRMC index 83d0e23..f30a1fa 100755 --- a/installJRMC +++ b/installJRMC @@ -1421,6 +1421,7 @@ uninstall() { echo "To remove your rpmbuild output files, run: rm -rf $OUTPUTDIR" elif [[ $? -eq 100 ]]; then err "JRiver Media Center package '$MCPKG' is not present" + err "and was not uninstalled" else err "Could not remove Media Center package" fi @@ -1453,9 +1454,14 @@ main() { # Distro-specific commands if [[ "$ID" =~ ^(fedora|centos)$ ]]; then - pkg_install(){ sudo dnf install -y "$@"; } - pkg_remove(){ sudo dnf remove -y "$@"; } - pkg_update(){ sudo dnf makecache; } + if hash dnf &>/dev/null; then + declare mgr="dnf" + elif hash yum &>/dev/null; then + declare mgr="yum" + fi + pkg_install(){ sudo "$mgr" install -y "$@"; } + pkg_remove(){ sudo "$mgr" remove -y "$@"; } + pkg_update(){ sudo "$mgr" makecache; } pkg_query(){ rpm -q "$@"; } firewall_cmd(){ sudo firewall-cmd "$@"; } elif [[ "$ID" =~ ^(debian|ubuntu)$ ]]; then