Created
August 27, 2012 00:13
-
-
Save dlutzy/3484576 to your computer and use it in GitHub Desktop.
Test Driven Sysadmin 3
This file contains hidden or 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 | |
function installinator() | |
{ | |
if which apt-get > /dev/null | |
then | |
echo "I'm a debian based system probably ubuntu" | |
INSTALLER="apt-get" | |
fi | |
if which yum > /dev/null | |
then | |
echo "I'm an RPM based system like RHEL, CentOS, Fedora etc..." | |
INSTALLER="yum" | |
fi | |
if which brew > /dev/null | |
then | |
INSTALLER="brew" | |
fi | |
if [ -z "$INSTALLER" ] | |
then | |
echo "I'm not sure what I am. Build from source perhaps? You're on your own buddy." | |
exit 1 | |
fi | |
echo "installing $@ with $INSTALLER" | |
$INSTALLER install -y $@ | |
} | |
if which links > /dev/null | |
then | |
echo "Test passed. links is already installed" | |
else | |
echo "Test failed. links is not installed, installing now..." | |
installinator links | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment