setupRun.sh
Support script. The current script is maintained in ~/Dropbox/Dawn-shape/scripts-limited-copy.
This will do the things needed to get a specific tiling sequence ready to be run. It figures out which landmarks and maplets are needed, copies them into the working directory, builds the make_fileT.in and does a make_script.e
Generated by
- Eric Palmer
- You will need to change the "which" variable to tell it which bigmap you want to process.
There is a left, right, top and bottom variables which set the boundaries for new landmarks. These values are used to build make_fileT.in. They are of pixel value, from 50 to 950.
Used by
- user
Executed from a working directory that has the symbolic links set (using setup.sh).
Details
# Dec 11st, 2011 - Eric E. Palmer
# Version 1.2
# This sets up a run, copying over only the files that are needed.
# You must change which to match the bigmap you are using
# If you want a different set of locations, then you need to change the
# right, left, top, bottom
# Usage: You start the script in the directory that you are going to do work in
# It requires a virtual directory that is basically just sybmolic links to
# the Dropbox/Dawn-Shape/Vesta (or work_generic) directory. However, it
# will generate files that get copied into the working directory
# Working Directory
# The working directory has symbolic links to needed files (established by
# using setup.sh). All other needed files are copied by this
# script
# Master Directory
# This has a full set of files needed so we can generate bigmaps and a
# place to copy things from. It is created by using setup.sh and then
# update.sh
dropPath=~/Dropbox/Dawn-shape # path to dropbox -
localMain=/Volumes/Media/run-master # path to master directory
# Ensure bigmap is given as a commandline argument
if [ -z $1 ]; then
echo "Usage: setupRun.sh <bigmap_name>";
echo "Example: setupRun.sh ZS0216";
exit;
fi
# Set variables
which=$1 # first argument is set to which bigmap we are doing to do
left=50 # Makescript left boundaries
right=950 # Makescript right boundaries
top=200 # Makescript top boundaries
bottom=800 # Makescript bottom boundaries
currPath=`pwd`
date > current.log
echo "--We are building $which from $left to $right, and $top to $bottom"
echo "--We are building $which from $left to $right, and $top to $bottom" >> current.log
# Setup some links and files that are needed in the local directory
$dropPath/work_generic/setup.sh >> current.log
if [ ! -e 'SUMFILES' ]; then ln -s $localMain/SUMFILES SUMFILES; fi
#### Local
# clean up old
# An error with the rm is not a problem, it just means
# nothing has been done previously
echo "--Cleaning up previous in $currPath"
echo "--Cleaning up previous in $currPath" >> current.log
# rather than deleting all the old run logfiles, keep it for one more run
if [ -e '001.INN' ]; then
list=`ls *INN *OOT`;
for i in $list
do
echo $i;
mv $i old/;
done;
fi
if [ -e 'LMRKLIST.TXT' ]; then mv LMRKLIST.TXT old/; fi # SPECIAL NEEDS
sh rem_script.b # std
rm -f TESTFILES/* # std
rm -f TESTFILES1/* # std
rm -f NEW_FILES/LMKFILES/*
if [ -e 'NEW_FILES/LMKFILES' ]; then rmdir NEW_FILES/LMKFILES ; fi
rm -f NEW_FILES/MAPFILES/*
if [ -e 'NEW_FILES/MAPFILES' ]; then rmdir NEW_FILES/MAPFILES ; fi
rm -f LMKFILES/*
if [ -e 'LMKFILES' ]; then rmdir LMKFILES ; fi
rm -f MAPFILES/*
if [ -e 'MAPFILES' ]; then rmdir MAPFILES ; fi
if [ -e 'LMKRLIST1.TXT' ]; then # test for a big mistake
echo "#### LMRKLIST1.TXT was found. You need to delete it by hand";
echo "#### Be sure that sh EXPORT.TXT has been run"
exit;
fi
#### Master
# Deal with run-master directory
cd $localMain
echo "--Running update.sh in $localMain"
echo "--Running update.sh in $localMain" >> current.log
./update.sh >> current.log
echo "--Cleaning up previous in $localMain" >> current.log
echo "--Cleaning up previous in $localMain"
rm -f NEW_FILES/LMKFILES/*
rm -f NEW_FILES/LMRKLIST.TXT
rm -f NEW_FILES/MAPFILES/*
# Get ready for new
# Figure out landmarks that fall in overlap
str=$dropPath/Vesta/$which.IN
echo "--Running bigmap on $str"
echo "--Running bigmap on $str" >> current.log
~/bin/bigmap < $str >> current.log
# Cheat the system so that export.e thinks the overlap files are the
# finished product of a run that need to be exported
cp USED_MAPS.TXT LMRKLIST1.TXT
# Build the export script and execute it (makes a tar ball of needed files)
echo "--Exporting" >> current.log
echo "--Exporting"
~/bin/export.e
sh EXPORT.TXT
# Copy files to working directory
echo "--move/extract NEW_FILES.tar at $currPath"
echo "--move/extract NEW_FILES.tar at $currPath" >> current.log
mv NEW_FILES.tar $currPath
cd $currPath
tar xf NEW_FILES.tar
mv NEW_FILES/* .
cp $localMain/MAPFILES/$which.MAP MAPFILES/ # This must be done after the tar and mv
if [ ! -e 'TESTFILES' ]; then mkdir TESTFILES; fi
if [ ! -e 'TESTFILES1' ]; then mkdir TESTFILES1; fi
if [ ! -e 'NEWFILES' ]; then mkdir NEWFILES; fi
if [ ! -e 'NEWFILES/LMKFILES' ]; then mkdir NEWFILES/LMKFILES; fi
if [ ! -e 'NEWFILES/MAPFILES' ]; then mkdir NEWFILES/MAPFILES; fi
echo "--Building make_scriptT.in" >> current.log
echo "--Building make_scriptT.in"
# Backup the old, just in case
if [ -e 'make_script.in' ]; then mv make_script.in old/ ; fi
# Set headers
echo "& cp MAPFILES/$which.MAP MAPFILES/XXXXXX.MAP" > make_scriptT.in
echo "XXXXXX" >> make_scriptT.in
echo "XXX050.SEED" >> make_scriptT.in
x=$left
# Loop to build the locations of the landmarks make_scriptT.in
while [ $x -le $right ]; do
y=$top
while [ $y -le $bottom ]; do
echo "$x, $y" >> make_scriptT.in
let y=y+50
done
let x=x+50
done
echo "END" >> make_scriptT.in
# Build the script and prepare it to be run
~/bin/make_scriptT.e
chmod a+x run_script.b
echo ""
echo "Now you can run it by using:"
echo "./run_script.b &"
echo ""
# All done
echo "Done with setupRun.sh" >> current.log
date >> current.log