All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
make_tar_sbnd.sh
Go to the documentation of this file.
1 #! /bin/bash
2 #------------------------------------------------------------------
3 #
4 # Name: make_tar_sbnd.sh
5 #
6 # Purpose: Make a tarball for a larsoft test release, for purpose
7 # of being shipped to grid worker.
8 #
9 # Usage:
10 #
11 # make_tar_sbnd.sh [-h|--help] [-d dir] <tarball-name>
12 #
13 # Options:
14 #
15 # -h, --help - Print help message.
16 # -d dir - Specify location of test release (default $SRT_PRIVATE_CONTEXT
17 # or $MRB_INSTALL).
18 #
19 # Notes.
20 #
21 # 1. Resulting tar file is always created in the current directory.
22 #
23 # 2. This scripts attempts to exclude non-relevant files from the
24 # tarball, including the following.
25 # a) The tmp subdirectory.
26 # b) .svn directories.
27 # c) *.root files in the top directory.
28 #
29 # 3. This script can be invoked in the test release directory, or in
30 # another directory.
31 #
32 # Created 8-Nov-2013 H. Greenlee
33 #
34 #------------------------------------------------------------------
35 
36 # Help function.
37 
38 function dohelp {
39  echo "Usage: make_tar_sbnd.sh [-h|--help] [-d dir] <tarball-name>"
40 }
41 
42 # Parse arguments.
43 
44 if [ $# -eq 0 ]; then
45  dohelp
46  exit
47 fi
48 
49 # Defaults.
50 
51 tar=''
52 dir=''
53 if [ x$SRT_PRIVATE_CONTEXT != x ]; then
54  dir=$SRT_PRIVATE_CONTEXT
55 fi
56 if [ x$MRB_INSTALL != x ]; then
57  dir=$MRB_INSTALL
58 fi
59 if [ x$dir = x ]; then
60  dir=`pwd`
61 fi
62 
63 while [ $# -gt 0 ]; do
64  case "$1" in
65 
66  # Help.
67  -h|--help )
68  dohelp
69  exit
70  ;;
71 
72  # Directory.
73  -d )
74  if [ $# -gt 1 ]; then
75  dir=$2
76  shift
77  fi
78  ;;
79 
80  # Other options.
81  -* )
82  echo "Unrecognized option $1"
83  dohelp
84  exit
85  ;;
86 
87  # Positional.
88  * )
89  if [ x$tar = x ]; then
90  tar=$1
91  else
92  echo "Too many arguments."
93  dohelp
94  exit 1
95  fi
96 
97  esac
98  shift
99 done
100 
101 # Make sure source directory is defined and exists.
102 
103 if [ x$dir = x ]; then
104  echo "No source directory specified."
105  dohelp
106  exit 1
107 fi
108 if [ ! -d $dir ]; then
109  echo "Directory $dir doesn't exist."
110  exit 1
111 fi
112 
113 # Make sure that a tarball was specified.
114 
115 if [ x$tar = x ]; then
116  echo "No tarball specified."
117  dohelp
118  exit 1
119 fi
120 
121 # If the tarball already exists, delete it.
122 
123 if [ -f $tar ]; then
124  rm $tar
125 fi
126 
127 ls -A $dir | egrep -v '.root$|tmp' | tar -C $dir -T- -czf $tar --exclude=.svn --exclude=\*.tar
128 
129 
130 
process_name opflash particleana ie x
then echo Invalid dCache scratch not copying back else ifdh ls
Definition: run_job.sh:111
shift
Definition: fcl_checks.sh:26
while getopts h
then shift fi
tuple dir
Definition: dropbox.py:28
then dohelp exit fi tar
Definition: make_tarball.sh:51
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
function dohelp
Definition: make_tarball.sh:38
float A
Definition: dedx.py:137