Newer
Older
#!/bin/bash
#
# Usage: deploy.sh [/path/to/deploy/directory]
#
# The default deploy directory is
#
# /pbs/throng/lsst/software/arc6-client
#
#
# Init
#
thisScript=$(basename $0)
defaultDeployDir='/pbs/throng/lsst/software/arc6-client'
#
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Usage
#
function usage() {
local name=$1
echo -e "Usage: ${name} [-h] [-d <deploy dir>]\n"
echo -e " e.g. ${name} -d ${defaultDeployDir}"
}
#
# Parse command line arguments
#
deployDir=${defaultDeployDir}
OPTIND=1
while getopts "hd:" option; do
case "${option}" in
h|\?)
usage ${thisScript}
exit 0
;;
d)
deployDir=$OPTARG
;;
esac
done
shift $((OPTIND-1))
#
# Ensure there are no extra arguments
#
if [[ $# -gt 0 ]]; then
echo "${thisScript}: unexpected argument $1"
usage ${thisScript}
exit 1
fi
#
# Check deploy directory exists
if [[ ! -d ${deployDir} ]]; then
echo "${thisScript}: could not find deploy directory ${deployDir}"
exit 1
fi
# Pack and copy the relevant files to the deploy directory
#
tempFile=$(mktemp)
trap "rm -f ${tempFile}" EXIT
chmod g+rx,o+rx *.sh
tar -cf ${tempFile} \
./README.md \
./run-arc.sh \
tar --dir ${deployDir} -xf ${tempFile}
#
# Create a symlink for each ARC client command
# See https://www.nordugrid.org/arc/arc6/users/client_tools.html
#
declare -a arcCommands=(
"arcproxy"
"arcrenew"
"arcsub"
"arcstat"
"arccat"
"arckill"
"arcclean"
"arcresub"
"arcresume"
"arcget"
"arctest"
"arcls"
"arccp"
"arcmkdir"
"arcrename"
"arcrm"
"arcinfo"
"arcsync"
)
cd ${deployDir}
for cmd in "${arcCommands[@]}"; do
done
#
# Modify setup.sh to adapt it to the deployment directory
#
deployDir=$(readlink -f ${deployDir})
sed --in-place -e "s|XXX_DEPLOY_DIR_XXX|${deployDir}|g" ${deployDir}/setup.sh