Skip to content

Commit

Permalink
added compatibility check
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbarth committed Dec 21, 2012
1 parent 4269546 commit 9b0bffc
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/common/init.sh
Expand Up @@ -3,35 +3,41 @@
# $@ - Array of applications installations to run.
run_install()
{
SYSTEM=$(cat /etc/redhat-release | awk '{print tolower($1)}')
OS=`cat /etc/redhat-release | awk '{print tolower($1)}'`
KERNEL=`uname -m`
DIRECTORY=$PWD
if [[ -z $@ ]]; then
# Applications are required to be specified
echo -e "\terror: applications packages not specified."
echo -e "\tusage: ./setup.sh [package]"
exit 1
else
# Run compatibility check.
if [[ $@ != *-compad* ]]; then
check_compad
fi
# Install common unless flag is set.
if [[ $@ != *-common* ]]; then
common_install
fi
# Install select applications.
for application in $@
do
if [[ $application == "-common" ]]; then
if [[ $application == -* ]]; then
continue
fi
eval "${application}_install"
done
fi
}

# Installs applications using the default package manager.
#
# $@ - An array of packages.
package_install()
# Runs a check to see if your system is compatible with these scripts.
check_compad()
{
eval "yum install -y $@"
if [[ "fedora redhat centos" != *$OS* || $KERNEL != "x86_64" ]]; then
echo -e "\terror: your system is not supported."
exit 1
fi
}

# Adds an executable path to the bashrc.
Expand Down

0 comments on commit 9b0bffc

Please sign in to comment.