-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_genomethreader
executable file
·41 lines (32 loc) · 1.08 KB
/
install_genomethreader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh -e
PUBLIC_HTML_CURRENT=/var/www/servers/genomethreader.org/htdocs
DISTRIBUTIONS=distributions
ZBH_DIR=/projects/gth
if [ $# -ne 1 ]
then
echo "provide distribution dir as argument" >&2
exit 1
fi
DISTRIBUTION_DIR=$1
# install locally
echo "install locally"
cp $DISTRIBUTION_DIR/*.tar.gz $PUBLIC_HTML_CURRENT/$DISTRIBUTIONS
# install at ZBH
echo "remove old distributions at the ZBH"
ssh $ZBH_MACHINE "rm -rf $ZBH_DIR/*" || true
echo "copy new distributions to the ZBH"
scp $DISTRIBUTION_DIR/*.tar.gz $ZBH_MACHINE:$ZBH_DIR
echo "extract new distributions"
for DISTRIBUTION in `cd $DISTRIBUTION_DIR && ls *.tar.gz`
do
ssh $ZBH_MACHINE "cd $ZBH_DIR && tar xzf $DISTRIBUTION"
done
echo "remove tar files"
ssh $ZBH_MACHINE "rm -rf $ZBH_DIR/*.tar.gz"
echo "rename distribution directories"
for SINGLE_DISTRIBUTION in `ssh $ZBH_MACHINE "cd $ZBH_DIR && ls"`
do
NEW_DISTRIBUTION_NAME=`echo $SINGLE_DISTRIBUTION | sed -e 's/gth-[0-9.]*-//' -e 's/.tar.gz//'`
ssh $ZBH_MACHINE "cd $ZBH_DIR && mv $SINGLE_DISTRIBUTION $NEW_DISTRIBUTION_NAME"
done