commit 8362ef88c9c9e3f69db7b3e6ded86e7fda597211 parent 3ea3346dd96f60449986a2f560b151397714cff4 Author: gearsix <gearsix@tuta.io> Date: Tue, 15 Mar 2022 14:58:22 +0000 start; identifying install/remove cmd Diffstat:
A | xpm.sh | | | 26 | ++++++++++++++++++++++++++ |
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/xpm.sh b/xpm.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env sh + +pm="" + +set_cmd_install() { + if [ $(command -v apt) ]; then pm="apt install" + elif [ $(command -v zypper) ]; then pm="zypper install" + elif [ $(command -v xbps-install" ]; then pm="xbps-install" + fi +} + +set_cmd_remove() { + if [ $(command -v apt) ]; then pm="apt purge" + elif [ $(command -v zypper) ]; then pm="zypper remove" + elif [ $(command -v xbps-remove ]; then pm="xbps-remove -R" + fi +} + +case "$1") + "i"|"in"|"install") + set_pm_install + ;; + "r"|"rm"|"remove") + set_pm_remove + ;; +esac