#!/bin/bash ## Thanks to Brian Logan corrected $link to $links at end. This bug ## would have prevented installation of links. ## 19 Dec 2005 ## ## $local/com/INSTALL_BHAM_LINUX_POPLOG ## http://www.cs.bham.ac.uk/research/poplog/com/INSTALL_BHAM_LINUX_POPLOG ## Install poplog ## o with or without motif ## o with original (isl/core) startup image ## o in default directory or specified directory ## ## RUN THIS WITH THREE OR FOUR ARGUMENTS. ## ## The first is ## motif or nomotif ## ## The second is ## bham or original ## ## The third is the directory in which to locate poplog ## or default ## (default selects /usr/local/poplog) ## If no third directory is given, it will create a ## pop/ subdirectory of the current directory and use that ## ## The Final argument is optional and determines whether ## symbolic links will be installed in /usr/local/bin ## and /usr/local/man ## If provided it can be either 'nolinks' or 'links'. ## If not provided it defaults to 'links' ## (However if not run as root the links will not be installed.) ## ## Aaron Sloman (http://www.cs.bham.ac.uk/~axs/) ## Revised 27 May 2005 ## Made 3rd argument optional ## ## Revised 19 Feb 2005 ## Provided optional 4th argument ## ## Revised 20 Jan 2005 ## John Duncan reported typo. ## INSTALL_POPLOG should have been INSTALL_BHAM_LINUX_POPLOG throughout ## Now fixed ## popversion=v15.6 export popversion if [ "x$1" == "x" ] || [ "$1" == "-help" ] || [ "$1" == "help" ] then echo "" echo " Three or four arguments are required." echo " The first should be either" echo " motif" echo " or" echo " nomotif" echo "" echo " The second determines the saved image configuration and should be either" echo " bham" echo " or" echo " original" echo "" echo " The third should be either an installation directory or just" echo " default" echo " (The 'default' installation directory is /usr/local/poplog/)" echo " If nothing is specified a pop/ subdirectory of current directory" echo " will be created" echo "" echo " The fourth argument is optional and may be 'links' or 'nolinks'" echo " If it is 'links' (the default if omitted) a link to an executable" echo " poplog file will be placed in /usr/local/bin and links to documentation" echo " will be placed in /usr/local/man/man1, so that 'man poplog' works" echo " NB: the links cannot be installed if you do not have write access" echo " to those directories, which normally requires this script to be run" echo " as root." echo " If you don't have access, links will not be installed, even" echo " if requested, and a warning will be displayed." echo " " echo "======" echo " Examples:" echo " ./INSTALL_BHAM_LINUX_POPLOG motif bham default links > install.log" echo " " echo " ./INSTALL_BHAM_LINUX_POPLOG nomotif bham ~/mypop nolinks > install.log" echo " " echo " ./INSTALL_BHAM_LINUX_POPLOG motif original /usr/local/newpoplog > install.log" echo " " echo " Use new pop/ sub-directory here: " echo " ./INSTALL_BHAM_LINUX_POPLOG motif bham > install.log" echo " " echo " Recommended: run as root thus: " echo " ./INSTALL_BHAM_LINUX_POPLOG motif bham default links > install.log" echo " ====" echo "" echo " Use the format 'COMMAND > install.log' to save output in file install.log" echo "" echo "" exit fi ## Run this in the directory in which the poplog tar file ## has been unpacked tardir=`pwd` echo "" echo "Installing poplog from tar bundle in $tardir" ## Create Poplog directory and define some environment variables ## Assumes that either a directory has been passed in as argument or ## the default should be used motif=unset if [ "$1" == "motif" ]; then motif=true echo "Installing with motif" elif [ "$1" == "nomotif" ]; then motif=false echo "Installing without motif" elif [ "$1" == "" ]; then echo "First argument missing: should be 'motif' or 'nomotif'" exit 1 else echo $1 " not accepted: should be 'motif' or 'nomotif'" exit 1 fi startup=unset if [ "$2" == "bham" ]; then startup=bham elif [ "$2" == "original" ]; then startup=orig elif [ "$2" == "" ]; then echo "Second argument missing: should be 'bham' or 'original'" exit 1 else echo $2 " not accepted: should be 'bham' or 'original'" exit 1 fi if [ "$3" == "" ] ; then 4="links" 3="" fi if [ "$3" == "default" ] ; then rootdir=/usr/local/poplog elif [ "$3" == "" ]; then rootdir=`pwd`/pop echo "Installing in $rootdir" 4="links" else rootdir=$3 fi if [ "$4" == "" ] || [ "$4" == "links" ] ; then links=1 echo "Links from /usr/local/{bin,man} will be installed if possible" echo "" else echo "Symbolic links from /usr/local will not be installed" echo "" links=0 fi echo "" echo "Installing $1 $2 Poplog version $popversion in: $rootdir" export rootdir echo "Root directory for poplog set to: $rootdir" echo "Creating directories for poplog and local extensions there." mkdir $rootdir $rootdir/$popversion $rootdir/local chmod 755 $rootdir $rootdir/$popversion $rootdir/local export usepop=$rootdir/$popversion ## Location for local saved images ## Version specific export poplocalbin=$usepop/poplocalbin mkdir $poplocalbin export poplocal=$rootdir export local=$poplocal/local echo " poplocal is $poplocal" echo " local is $local" echo " usepop is $usepop" #echo " poplocalbin is $poplocalbin" ### NOW UNPACK TAR FILE cd $rootdir # Create a useful symbolic link, after first removing old one # if it exists rm -f current-poplog ln -s $popversion current-poplog echo "Unpacking tar file. May take some time" # Install linux poplog with motif tar tvfz $tardir/bham-linux-poplog-${popversion}.tar.gz | head -5 zcat $tardir/bham-linux-poplog-${popversion}.tar.gz | tar xf - echo "UNPACKING POPLOG TAR FILE COMPLETE" echo "main poplog system installed in $usepop" echo "Creating startup scripts" cd $usepop/INSTALL echo "Running the 'pre-check' script CHECK_LINUX_FACILITIES" ./CHECK_LINUX_FACILITIES ./CREATE_SCRIPTS $rootdir ls -l $usepop/bin/poplog* echo "poplog and poplog.sh startup scripts Done" echo "======================================================" echo "directories in $usepop/pop " ls -l $usepop/pop/ echo "======================================================" echo "Now rebuilding system images" . $usepop/pop/com/poplog.sh export popsrc=$usepop/pop/src export popsys=$usepop/pop/pop ## Now link poplog. echo "going to INSTALL dir $usepop/INSTALL " cd $usepop/INSTALL echo "100" if [ "$startup" == "bham" ] then echo "Selecting 'bham' version of mkstartup" ./LINK_LIKE_BHAM else echo "Selecting 'core' version of mkstartup" ./LINK_LIKE_CORE fi if [ $motif == "true" ] then echo " Run LINK_MOTIF_POPLOG" ./LINK_MOTIF_POPLOG else echo "Run .LINK_NOMOTIF_POPLOG" ./LINK_NOMOTIF_POPLOG fi ## Check for success of LINK command if [ -f $usepop/pop/lib/psv/startup.psv ] then echo "Install $1 $2 $3 $4 worked OK" echo "Saved images in $usepop/pop/lib/psv/" else echo "PROBLEM: Install $1 $2 $3 $4 did not work" echo "This could be due to a problem accessing motif libraries" echo "Try repeating installation using 'nomotif' instead of 'motif'" echo "Your motif libraries are shown by 'ls -l /usr/X11R6/lib/libXm.so*'" ls -l /usr/X11R6/lib/libXm.so* echo "Exiting installation" exit 1 fi if [ "$links" == "1" ] then echo "Installing link for running poplog" rm /usr/local/bin/poplog ln -s $usepop/bin/poplog.sh /usr/local/bin/poplog ls -l /usr/local/bin/poplog echo "Installing man files" cd /usr/local/man/man1 ln -s $usepop/man/man1/* . else echo "Executable and man files not linked" fi echo "done INSTALL POPLOG FOR LINUX + PC in $rootdir using $1 $2"