Last active
August 29, 2015 14:10
-
-
Save jordanwesthoff/057d9e53ad2d488f9c76 to your computer and use it in GitHub Desktop.
Intelligent sorter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUM_CMD=$(which yum) | |
APT_GET_CMD=$(which apt-get) | |
OTHER_CMD=$(which <other installer> | |
if [[ ! -z $YUM_CMD ]]; then | |
yum install $YUM_PACKAGE_NAME | |
elif [[ ! -z $APT_GET_CMD ]]; then | |
apt-get $DEB_PACKAGE_NAME | |
elif [[ ! -z $OTHER_CMD ]]; then | |
$OTHER_CMD <proper arguments> | |
else | |
echo "error can't install package $PACKAGE" | |
exit 1; | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Find our package manager | |
if VERB="$( which apt-get )" 2> /dev/null; then | |
echo "Debian-based" | |
elif VERB="$( which yum )" 2> /dev/null; then | |
echo "Modern Red Hat-based" | |
elif VERB="$( which portage )" 2> /dev/null; then | |
echo "Gentoo-based" | |
elif VERB="$( which pacman )" 2> /dev/null; then | |
echo "Arch-based" | |
else | |
echo "I have no idea what I'm doing." >&2 | |
exit 1 | |
fi | |
if [[ 1 -ne $# ]]; then | |
echo "Syntax: $0 PACKAGE" | |
exit 1 | |
fi | |
$VERB "$1" | |
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/icy/pacapt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment