#!/bin/csh -f #+ #OSIRIS library of scripts # #NAME # osirisSetupDataRoot - Sets up a new OSIRIS_DATA_ROOT output data tree # #SYNOPSIS # osirisSetupDataRoot [directory] # #DESCRIPTION # description of the script # #OPTIONS # -t # # ID number to attach to all script generated errors, warnings, and # questions that are passed to the OGS. The ID number is separated # from the rest of the message with a ";". # # -m # simulate calls to RPC servers. during simulated calls, the # command is echoed (instead of being executed). # # others? # #EXAMPLES # script_name junk1 -t 123 # What would happen? # #ENVIRONMENT VARIABLES # list of environment variables used # #FILES # list of files used # #SERVERS & KEYWORDS # list of the servers and keywords used, for example: # # service = osiris # keywords: sfilter/ifilter, sscale # #SCRIPTS CALLED # list of the scripts called by this script, for example: # # help, syncheck # #EXIT STATUS # 0 - normal exit, no error # 1 - script aborted by an interrupt # 2 - syncheck error # 3 - error parsing command line input # other errors... # #SEE ALSO # ??? #- # # Modification History: # 20041124 - MB: Initial version created # # Boiler plate for "-h" support for command autohelp. if ("$1" == "-h") then help $0 | more exit $status endif # Boilerplate for syncheck. # Note that the boiler plate should be transparent for all usages, # but to make correct use of syncheck you will need to specify the # correct pattern. set noglob set CheckStatus = `syncheck -command $0 $* -pattern {text}` unset noglob if ("$CheckStatus" != "OK") then help $0 | more exit 2 endif # End of help/syncheck boiler plate. # Set up to trap interrupts (Ctrl-C, etc.) onintr abort # use argument is supplied if ($#argv > 0) then set data_root = $1 else # use envvar if not if (`printenv OSIRIS_DATA_ROOT` == '') then echo "$OSIRIS_DATA_ROOT not set. Please set to appropriate directory or pass in a directory to set up." exit else set data_root = ${OSIRIS_DATA_ROOT} endif endif if (!( -d ${data_root} ) ) then echo -n Making directory ${data_root}... mkdir ${data_root} if ($status != 0) then echo ERROR making ${data_root} directory. Aborting. exit endif echo done. endif # give group permission echo -n Giving ${data_root} group writeable permission... chmod g+rwx ${data_root} echo done. # make ${data_root}/CALB tree echo -n Populating ${data_root}/CALB ... mkdir ${data_root}/CALB mkdir ${data_root}/CALB/lab mkdir ${data_root}/CALB/lab/sbad mkdir ${data_root}/CALB/lab/ibad mkdir ${data_root}/CALB/lab/sdark mkdir ${data_root}/CALB/lab/idark mkdir ${data_root}/CALB/lab/sflat mkdir ${data_root}/CALB/lab/iflat mkdir ${data_root}/CALB/lab/rectif mkdir ${data_root}/CALB/lab/wcal mkdir ${data_root}/CALB/lab/slinear mkdir ${data_root}/CALB/lab/ilinear mkdir ${data_root}/CALB/lab/ipsf mkdir ${data_root}/CALB/telescope mkdir ${data_root}/CALB/telescope/sbad mkdir ${data_root}/CALB/telescope/ibad mkdir ${data_root}/CALB/telescope/sdark mkdir ${data_root}/CALB/telescope/idark mkdir ${data_root}/CALB/telescope/sflat mkdir ${data_root}/CALB/telescope/iflat mkdir ${data_root}/CALB/telescope/rectif mkdir ${data_root}/CALB/telescope/wcal mkdir ${data_root}/CALB/telescope/slinear mkdir ${data_root}/CALB/telescope/ilinear mkdir ${data_root}/CALB/telescope/ipsf echo done. goto done abort: # Block of code to handle interrupts. exit 1 done: # is there anything that needs to go here? exit