All pastes #204141 Raw Edit

2733088

public shellscript v1 · immutable
#204141 ·published 2006-10-15 18:14 UTC
rendered paste body
#!/bin/bash####Script to install Ruby on Rails on a cPanel server###This script is ©2006 Defender Technologies Group LLC.,#and may not be reproduced in part or full without permission##Tony Dodd <tony@defenderhosting.com>##if [ x`which GET` == "x" ]then	echo "Sorry, GET is required for this script to run"	exit 2fiif [ `id | awk '{print $1}' | sed -e 's/(.*)$//g' | cut -d"=" -f2` -ne "0" ]then	echo "Sorry, root is required for this script to run"	exit 2fifunction rubyver {#function will grab the download url for latest rubyruby_url=`GET http://ruby-lang.org/en/20020102.html | grep "stable release" -m1 | cut -d"<" -f4 | cut -d"\"" -f2`ruby_version=`echo $ruby_url | cut -d"/" -f6 | sed -e 's/\.tar\.gz//g'`ruby_file=`echo $ruby_url | cut -d"/" -f6`}function doruby {if [ -e /usr/src/rubyfiles/ruby/$ruby_version ]thenecho "$ruby_version already installed, skipping"elsemkdir -p /usr/src/rubyfiles/rubycd /usr/src/rubyfiles/rubywget $ruby_urltar -zxvf $ruby_filecd $ruby_version./configure && make && make installfi}function gemsver {gems_url=http\:\/\/rubyforge.org`GET http://rubyforge.org/frs/?group_id=126 | grep rubygems\- -m1 | cut -d"\"" -f2`gems_version=`echo $gems_url | cut -d"/" -f7 | sed -e 's/\.tgz//g'`gems_file=`echo $gems_url | cut -d"/" -f7`}function dogems {if [ -e /usr/src/rubyfiles/gems/$gems_version ]thenecho "$gems_version already installed, skipping"elsemkdir /usr/src/rubyfiles/gems # if rubyfiles hasn't been created yet, there is a problem.cd /usr/src/rubyfiles/gemswget $gems_urltar -zxvf $gems_filecd $gems_versionruby setup.rbfi}function dorails {gem install rails -y#more of a placeholder than a real function, in case this method ever needs to be revised.}function fcgiver {#again, another semi place-holder in case this changes in future.fcgi_url="http://fastcgi.com/dist/fcgi-2.4.0.tar.gz"fcgi_version="fcgi-2.4.0"fcgi_file="fcgi-2.4.0.tar.gz"}function dofcgi {if [ -e /usr/src/rubyfiles/fcgi/$fcgi_version ]thenecho "$fcgi_version already installed, skipping"elsemkdir /usr/src/rubyfiles/fcgicd /usr/src/rubyfiles/fcgiwget $fcgi_urltar -zxvf $fcgi_filecd $fcgi_version./configure && make && make installfi}function modfcgiver {#another place-holdermodfcgi_url="http://fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz"modfcgi_version="mod_fastcgi-2.4.2"modfcgi_file="mod_fastcgi-2.4.2.tar.gz"}function domodfcgi {if [ -e /usr/src/rubyfiles/mod_fcgi/$modfcgi_version ]thenecho "$modfcgi_version already installed, skipping"elsemkdir /usr/src/rubyfiles/mod_fcgicd /usr/src/rubyfiles/mod_fcgiwget $modfcgi_urltar -zxvf $modfcgi_filecd $modfcgi_version$apxs -o mod_fastcgi.so -c *.c$apxs -i -a -n fastcgi mod_fastcgi.sofi}function findapxs {if [ -e /usr/local/apache/bin/apxs ]thenapxs="/usr/local/apache/bin/apxs"echo "found apxs at $apxs"elif [ -n `whereis apxs | awk '{print $2}'` ]thenapxs="`whereis apxs | awk '{print $2}'`"echo "found apxs at $apxs"elseecho "I cannot find apxs, please add a symlink to it in /usr/sbin/ then run me again"fi}function dogemfcgi {#placeholdergem install fcgi -y}function httpdconf {fcgi_line=`cat /etc/httpd/conf/httpd.conf -n | grep AccessFile -m1 -B1 | head -1 | awk '{print $1}'`function getsupport {#grab support scripts that we needmkdir -p /usr/src/rubyfiles/scripts/cd /usr/src/rubyfiles/scriptswget http://download.powervps.com/scriptsupport/insertext.sh}getsupportfindapxsrubyvergemsverfcgiverdorubydogemsdorailsdofcgidomodfcgidogemfcgi