Skip to content

Instantly share code, notes, and snippets.

@dlutzy
Created August 27, 2012 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlutzy/3484576 to your computer and use it in GitHub Desktop.
Save dlutzy/3484576 to your computer and use it in GitHub Desktop.
Test Driven Sysadmin 3
#!/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