#!/bin/bash #Auto Installer #VERSION#0.5.1 #ssullivan@liquidweb.com version="0.5.1" if ! id | grep -q "uid=0(root)" ; then echo "ERROR: You must be root to run this." exit 1 fi #check for update wget http://scripts.ssullivan.org/autoinstaller/autoinstaller --output-document autoinstaller.update &>/dev/null curver=`cat autoinstaller.update | grep ".VERSION#" | sed -e 's/.VERSION#//' | head -1` myver=`cat $0 | grep ".VERSION#" | sed -e 's/.VERSION#//' | head -1` if [[ $curver != $myver ]]; then echo "AutoInstaller is out of date, updating... $0" wget http://scripts.ssullivan.org/autoinstaller/autoinstaller --output-document autoinstaller.update &> /dev/null mv -f autoinstaller.update $0 echo "$0 has been updated, please re-run Autoinstaller" exit 100 else echo "$0 is up to date." fi function help { echo " /// AutoInstaller ///" echo -e "Options: \n" echo "--version Display version " echo "--help This help page " echo "--memcached Install memcache-PHP & memcached " echo "--memcache-php Install only memcache-PHP " echo "--memcached-only Install only memcached deamon " echo "--xcache-php Install Xcache-PHP (experimental) " echo -e "--git Installs Git version control \n" } if [[ "$1" = "--version" ]]; then shift echo "AutoInstaller version $version" #memcached and memcache-PHP elif [[ "$1" = "--memcached" ]]; then shift toBuild="Memcached" getMSG=$(echo "Retrieving $toBuild build script...") echo $getMSG memcachedFile=/scripts/memcached.autoinstaller #check to see if memcached build file is already present if [ -e $memcachedFile ]; then rm -rf $memcachedFile fi memcachedGet=http://scripts.ssullivan.org/autoinstaller/memcached/memcached.autoinstaller echo "Downloading from $memcachedGet ..." wget -O /scripts/memcached.autoinstaller $memcachedGet instMSG=$(echo "Running the $toBuild install script now...") echo -e "$instMSG \n" sh $memcachedFile #memcache-PHP only elif [[ "$1" = "--memcache-php" ]]; then shift toBuild="memcache-PHP" getMSG=$(echo "Retrieving $toBuild build script...") echo $getMSG memcachephpFile=/scripts/memcachephp.autoinstaller if [ -e $memcachephpFile ]; then rm -rf $memcachephpFile fi memcachephpGet=http://scripts.ssullivan.org/autoinstaller/memcached/memcachephp.autoinstaller echo "Downloading from $memcachephpGet ..." wget -O /scripts/memcachephp.autoinstaller $memcachephpGet instMSG=$(echo "Running the $toBuild install script now...") echo -e "$instMSG \n" sh $memcachephpFile #memcached deamon only elif [[ "$1" = "--memcached-only" ]]; then shift toBuild="memcached-deamon" getMSG=$(echo "Retrieving $toBuild build script...") echo $getMSG memcachedeamonFile=/scripts/memcachedeamon.autoinstaller if [ -e $memcachedeamonFile ]; then rm -rf $memcachedeamonFile fi memcachedeamonGet=http://scripts.ssullivan.org/autoinstaller/memcached/memcachedeamon.autoinstaller echo "Downloading from $memcachedeamonGet ..." wget -O /scripts/memcachedeamon.autoinstaller $memcachedeamonGet instMSG=$(echo "Running the $toBuild install script now...") echo -e "$instMSG \n" sh $memcachedeamonFile elif [[ "$1" = "--xcache-php" ]]; then shift toBuild="Xcache-PHP" getMSG=$(echo "Retrieving $toBuild build script...") echo $getMSG xcacheFile=/scripts/xcache.autoinstaller if [ -e $xcacheFile ]; then rm -rf $xcacheFile fi xcacheGet=http://scripts.ssullivan.org/autoinstaller/xcache/xcache.autoinstaller echo "Downloading from $xcacheGet ..." wget -O /scripts/xcache.autoinstaller $xcacheGet instMSG=$(echo "Running the $toBuild install script now...") echo -e "$instMSG \n" sh $xcacheFile elif [[ "$1" = "--git" ]]; then shift toBuild="Git" getMSG=$(echo "Retrieving $toBuild build script...") echo $getMSG gitFile=/scripts/git.autoinstaller if [ -e $gitFile ]; then rm -rf $gitFile fi gitGet=http://scripts.ssullivan.org/autoinstaller/git/git.autoinstaller echo "Downloading from $gitGet ..." wget -O /scripts/git.autoinstaller $gitGet instMSG=$(echo "Running the $toBuild install script now...") echo -e "$instMSG \n" sh $gitFile elif [[ "$1" = "--help" ]]; then shift help else help fi