#!/bin/sh ######################################################################### # Michelson Science Center (MSC) -- http://msc.caltech.edu # # Copyright (c) 1997-2003 California Institute of Technology # # U.S. Government Sponsorship # # Under contract with the National Aeronautics and Space Administration # ######################################################################### ## mkMSCSoftwareTree creates an empty mscSoftware tree in a target ## location -- A.B. 1/2003 ## v0.11 -- Mod 6/03 to put the modules directory in /lib ## usage: mkMSCSoftware [argument] ## mkMSCSoftwareTree takes an optional argument for the location ## where the mscSoftware tree will be created -- otherwise the tree ## is created in the current directory ## Get the current path spec myPWD=`pwd` ## default to making mscSoftware in the current directory target=$myPWD if [ $1 ]; then target=$1 fi if [ -w $target ]; then if [ -d $target/mscSoftware ]; then echo "Error -- $target/mscSoftware already exists!" exit 1 fi echo "You're about to create an empty MSC directory tree in" echo " $target/mscSoftware" echo "Are you SURE you wante to do this...you have 5 seconds to abort (control-C)" echo sleep 5 echo "Creating mscSoftware in" $target "under" $OSTYPE echo ## Make the root directory mkdir $target/mscSoftware ## Making top-level directories if [ -d $target/mscSoftware ]; then cd $target/mscSoftware myRoot=`pwd` echo "Working in $myRoot..." sleep 1 mkdir bin data doc include info lib man man/man1 src ## Create substructure as required ## data cd $myRoot/data mkdir catalogs ## lib cd $myRoot/lib mkdir modules ## src cd $myRoot/src mkdir libraries tools mkdir tools/planning tools/reduction mkdir tools/reduction/astrometry tools/reduction/v2 mkdir tools/reduction/v2/calib mkdir libraries/mscLib libraries/fits cd $myRoot; ## Create environment script (tcsh/csh) template="######################################################################### # Michelson Science Center (MSC) -- http://msc.caltech.edu # # Copyright (c) 1997-2003 California Institute of Technology # # U.S. Government Sponsorship # # Under contract with the National Aeronautics and Space Administration # ######################################################################### ## mscEnv -- (t)csh script file for setting MSC-related environment ## variables (A.B. 2/01, 1/03) ## Top-level MSC stuff setenv MSCPATH "$myRoot" setenv MSCBIN \"\${MSCPATH}/bin\" setenv MSCLIB \"\${MSCPATH}/lib\" setenv MSCINFO \"\${MSCPATH}/info\" setenv MSCMAN \"\${MSCPATH}/man\" setenv MSCINCLUDE \"\${MSCPATH}/include\" setenv MSCSRC \"\${MSCPATH}/src\" setenv MSCDATA \"\${MSCPATH}/data\" setenv MSCMODULES \"\${MSCLIB}/modules\" ## Add MSC directories to paths setenv PATH \"\${PATH}:\${MSCBIN}\" if (\$?MANPATH) then setenv MANPATH \"\${MANPATH}:\${MSCMAN}\" endif if (\$?INFOPATH) then setenv INFOPATH \"\${INFOPATH}:\${MSCINFO}\" else setenv INFOPATH \"\${MSCINFO}\" endif ## PERLLIB to pickup MSC Perl modules if (\$?PERLLIB) then setenv PERLLIB \"\${PERLLIB}:\${MSCMODULES}\" else setenv PERLLIB \"\${MSCMODULES}\" endif ## end mscEnv.csh " echo "$template" > $myRoot/mscEnv.csh ## Create environment script (bash/sh) template="######################################################################### # Michelson Science Center (MSC) -- http://msc.caltech.edu # # Copyright (c) 1997-2003 California Institute of Technology # # U.S. Government Sponsorship # # Under contract with the National Aeronautics and Space Administration # ######################################################################### ## mscEnv -- (ba)sh script file for setting MSC-related environment ## variables (A.B. 2/01, 1/03) ## Top-level MSC stuff export MSCPATH=$myRoot export MSCBIN=\${MSCPATH}/bin export MSCLIB=\${MSCPATH}/lib export MSCINFO=\${MSCPATH}/info export MSCMAN=\${MSCPATH}/man export MSCINCLUDE=\${MSCPATH}/include export MSCSRC=\${MSCPATH}/src export MSCDATA=\${MSCPATH}/data export MSCMODULES=\${MSCLIB}/modules export PERLLIB=\${MSCPATH}/modules " echo "$template" > $myRoot/mscEnv.sh ## Execute a dump of what we did echo "Recursive listing of $myRoot:" echo ls -R -F $myRoot cd $myPWD exit 0 else echo "Error -- creating $target/mscSoftware failed" fi else echo "Error -- $target not writable -- mscSoftware create failed" echo exit 1 fi