Skip to content

Instantly share code, notes, and snippets.

@dlutzy
Created Aug 27, 2012
Embed
What would you like to do?
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