#!/bin/sh # At LMB (and probably elsewhere!) ignore the following 3 lines - this should # be set up in a site-wide setup file. # # N.B. If you want to setup a site-wide installation, you'll probably want to # edit and uncomment the following lines to point to the site-wide wish8.5 # and Mosflm executables #export MOSFLM_WISH=/path/to/your/wish8.5 #export MOSFLM_EXEC=/path/to/your/ipmosflm STARTDIR= IMAGEDIR= STARTDIRSET= IMAGEDIRSET= MOSFLM_LOGGING=0 EXPERTDETECTORSETTINGS=0 IMOSFLM_VERSION="iMosflm 1.0.4, 21st January (requiring Mosflm 7.0.6)" export MOSFLM_LOGGING export EXPERTDETECTORSETTINGS export IMOSFLM_VERSION # command-line options for X do case $X in "--debug") #echo "* full debugging turned on - a log of your session will be stored in a" #echo " datestamped file called something like \"logfile`date \"+%Y%m%d_%H%M%S\"`.debug\"" MOSFLM_LOGGING=1 export MOSFLM_LOGGING sleep 2 ;; "--expert") echo "* Expert mode on - be VERY sure you want this" EXPERTDETECTORSETTINGS=1 export EXPERTDETECTORSETTINGS ;; "--help") echo "Usage: imosflm [options]..." echo "Options:" echo "--debug Creates a large output file for debugging purposes" echo " Don't use this unless asked to by a developer" echo "--expert You don't want to do this unless you are a Mosflm developer" echo "--help Displays this message, then exits" echo "--imagedir " echo " Starts the image browser in this directory; if " echo " is given as an environment variable, it will be expanded" echo " to its full value" echo "--startdir " echo " Starts mosflm in directory rather than the current" echo " directory. This will only work if the directory exists and " echo " you have write permission to it, otherwise iMosflm will exit." echo " All the normal mosflm output files will be in this directory" echo "--version Displays the program version and required Mosflm version, " echo " then exits" exit ;; "--imagedir") IMAGEDIRSET=1 ;; "--startdir") STARTDIRSET=1 ;; "--version") echo "* ${IMOSFLM_VERSION}" exit ;; *) if [ "$IMAGEDIRSET" != "" ] then IMAGEDIR=$X export IMAGEDIR if [ -d $IMAGEDIR ] then if [ -r $IMAGEDIR ] then echo "* mosflm will start by looking for images in $IMAGEDIR" else echo "" echo "You don't have read permission for $IMAGEDIR" echo "iMosflm will revert to the current start directory " exit fi else echo "" echo "$IMAGEDIR is not a directory" echo "iMosflm will revert to the current start directory " exit fi IMAGEDIRSET= elif [ "$STARTDIRSET" != "" ] then STARTDIR=$X export STARTDIR if [ -d $STARTDIR ] then if [ -w $STARTDIR ] then echo "* mosflm will start in $STARTDIR" echo " all the mosflm log files will be there" else echo "" echo "You don't have write permission for $STARTDIR" echo "exiting iMosflm now" exit fi else echo "" echo "$STARTDIR is not a directory" echo "exiting iMosflm now" exit fi STARTDIRSET= else echo "$X is not an option" exit fi ;; esac done if [ $HOSTTYPE = "intel-pc" ] # echo looks like an Intel Mac to me... then export GFORTRAN_UNBUFFERED_ALL=1 fi case $0 in /*) abspath=$0 ;; *) abspath=$PWD/$0 ;; esac # function to test wish executable test_wish() { WISH_FAIL=0 $1< /dev/null if [ $? -eq 0 ] then echo testing MOSFLM_WISH \($MOSFLM_WISH\) # Test that it has all require packages test_wish $MOSFLM_WISH if [ $WISH_FAIL -eq 1 ] then echo "" echo "Cannot use wish8.5 executable pointed to by" echo "MOSFLM_WISH environment variable." echo "Your tcl/tk installation ($MOSFLM_WISH) is" echo "missing the following required tcl/tk packages:" diagnoze_failure echo "To use a different tcl/tk installation set the" echo "environment variable \"MOSFLM_WISH\" to the" echo "full pathname of your prefered wish8.5 executable" echo "" else FOUND_WISH=1 # normal start of iMosflm here if [ "$STARTDIR" != "" ] then cd $STARTDIR fi exec $MOSFLM_WISH ${abspath}.tcl fi else echo "" echo "Environment variable MOSFLM_WISH does not point to" echo "a valid wish8.5 executable!" echo "" fi fi if [ $FOUND_WISH != 1 ] then # Test wish8.5 in path type wish8.5 &> /dev/null if [ $? -eq 0 ] then # Test found wish8.5 DEFAULT_WISH=`which wish8.5` echo "Testing default wish8.5 executable ($DEFAULT_WISH)." test_wish $DEFAULT_WISH if [ $WISH_FAIL -eq 1 ] then echo "The default wish8.5 installation is missing the" echo "following required tcl/tk packages:" diagnoze_failure echo "" else echo "Running imosflm with default wish8.5 executable ($DEFAULT_WISH)." FOUND_WISH=1 # normal start of iMosflm here if [ "$STARTDIR" != "" ] then cd $STARTDIR fi exec $DEFAULT_WISH ${abspath}.tcl fi fi fi if [ $FOUND_WISH != 1 ] then echo "Please enter the path of a wish8.5 executable from" echo "the tcl/tk installation you wish to use:" echo "(Or just hit to exit):" read MY_WISH if [ "$MY_WISH" != "" ] then type $MY_WISH &> /dev/null if [ $? -eq 0 ] then test_wish $MY_WISH if [ $WISH_FAIL -eq 1 ] then echo "Your wish8.5 executable ($MY_WISH) is missing" echo "the following required packages:" diagnoze_failure echo "" else FOUND_WISH=1 # normal start of iMosflm here if [ "$STARTDIR" != "" ] then cd $STARTDIR fi exec $MY_WISH ${abspath}.tcl fi else echo "Could not run $MY_WISH" echo "Please check file permissions and try again." echo "" exit fi fi fi if [ $FOUND_WISH -ne 1 ] then echo "No wish8.5 executable with all required packages was found." echo "You can download a \"batteries included\" tcl/tk distribution" echo "which includes wish8.5 executable and all require packages from:" echo "www.activestate.com" echo "" fi