From 33151bfe447227b88bdb4b1418e9d830dbd72a93 Mon Sep 17 00:00:00 2001 From: RedBearAK <64876997+RedBearAK@users.noreply.github.com> Date: Wed, 31 Mar 2021 23:58:26 -0800 Subject: [PATCH] Add zypper support, make output easier to read Removing "--allow-downgrades --allow-remove-essential --allow-change-held-packages" as a replacement for "--force-yes" because none of those options are really recommended. They can potentially break the system entirely, and shouldn't actually be necessary in any normal situation when installing packages. This adds some strategic blank lines and "descriptions" of what is happening so things are far more clear in the terminal during install. Aids in troubleshooting which parts go wrong. Adds support for the zypper package manager used by openSUSE Tumbleweed. --- linux/system-config/unipkg.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/linux/system-config/unipkg.sh b/linux/system-config/unipkg.sh index b161804..23ada8d 100755 --- a/linux/system-config/unipkg.sh +++ b/linux/system-config/unipkg.sh @@ -1,15 +1,31 @@ #!/bin/bash if pkgmgr="$( which apt-get )" 2> /dev/null; then - echo "Debian" + echo + echo "Debian apt-get package manager detected... " + echo "Installing $1... " + echo $pkgmgr update - $pkgmgr --yes --force-yes install $1 + $pkgmgr --yes install $1 elif pkgmgr="$( which dnf )" 2> /dev/null; then - echo "dnf" + echo + echo "dnf package manager detected... " + echo "Installing $1... " + echo $pkgmgr check-update; $pkgmgr install -y $1 elif pkgmgr="$( which pacman )" 2> /dev/null; then - echo "Arch-based" + echo + echo "Arch-based pacman package manager detected... " + echo "Installing $1... " + echo $pkgmgr -Syy;yes | $pkgmgr -S $1 +elif pkgmgr="$( which zypper )" 2> /dev/null; then + echo + echo "zypper package manager detected... " + echo "Installing $1... " + echo + $pkgmgr refresh + $pkgmgr -n install $1 else echo "Package manager not found, please install $1" >&2 exit 1 @@ -18,4 +34,4 @@ if [[ 1 -ne $# ]]; then echo "Syntax: $0 PACKAGE" exit 1 fi -exit $? \ No newline at end of file +exit $?