#!/bin/bash # # Green Grid: Install Script # Chris Hughes (chris.hughes@dartmouth.edu) # 06/29/04 # # # Removed Chris' note # # Version number VERSION="0.7" # This is a hack....Systems that don't have GCC 3.x might have problems... LD_LIBRARY_PATH=/afs/@cell/usr/pkg/gcc/lib; export LD_LIBRARY_PATH # Location of temporary file to use for Green Grid install log TMPFILE="/tmp/$$.tmp" # Default behavior is a client install GG_HOME="${HOME}/GreenGrid"; export GG_HOME # Require tools (tar, wget, python, mail). These need to be in your PATH for # this script to work correctly. These are just the names of binaries REQ_TOOLS="tar wget python mail" echo echo "-----------------------------------------------------" echo "Starting Green Grid Installation (v${VERSION})" echo "-----------------------------------------------------" if [ "$1" = "-server" ]; then echo "Performing server install!" GG_HOME="/usr/local/GreenGrid" else echo "Performing client install!" fi # Check for required tools. for TOOL in $REQ_TOOLS; do which ${TOOL} > /dev/null 2>&1 if [ "$?" != 0 ]; then echo "error: ${TOOL} not found in PATH" exit fi done # Remove GreenGrid directory if it already exists if [ -d "${GG_HOME}" ]; then echo "removing found directory: ${GG_HOME}" rm -rf ${GG_HOME} fi # Create a new Green Grid Directory mkdir ${GG_HOME} cd ${GG_HOME} wget -q http://grid.dartmouth.edu/pacman/pacman-current.tar.gz tar xzf pacman-current.tar.gz # create link to pacman ln -s pacman-[0-9]* pacman PATH=${PATH}:${GG_HOME}/pacman; export PATH if ! pacman -trust-registered-caches -get Dartmouth:GreenGrid -yesyesyes; then echo "install aborted by user" exit 1 fi typeset A=0 while [ $A != 1 ]; do echo;echo echo "-----------------------------------------------------" echo "Would you like to send post-install email" echo "containing the installed packages, kernel version," echo -n "date, architecture and hostname to the Green Grid team ? (y/n) " read send if [ $send = 'y' ]; then echo "Green Grid Install Log" > $TMPFILE if [ "${1}" = "-server" ]; then echo "Install Type: server" >> $TMPFILE else echo "install Type: client" >> $TMPFILE fi echo "Date: `date`" >> $TMPFILE echo "User: `whoami`" >> $TMPFILE echo "Hostname: `hostname`" >> $TMPFILE echo "Kernel Version: `cat /proc/version`" >> $TMPFILE sed 's/<[^<]*>/ /g' $GG_HOME/doc/index.html >> $TMPFILE #cat $TMPFILE | mail -s "Green Grid Install" chris.hughes@dartmouth.edu cat $TMPFILE | mail -s "Green Grid Install" jed.dobson@dartmouth.edu rm -rf $TMPFILE if [ "$?" = 0 ] ; then echo "Email has been sent" else echo "Error: couldn't send email!" fi A=1; elif [ $send = "n" ]; then echo "Installed Complete" A=1; else echo "$send is not a valid answer" fi done rm -rf ${GG_HOME}/pacman-current.tar.gz echo "Finished install!" echo "-----------------------------------------------------"