-
Notifications
You must be signed in to change notification settings - Fork 3
/
clone-and-deploy.sh
60 lines (54 loc) · 1.25 KB
/
clone-and-deploy.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# @balkian
# This script clones and runs an instance of the eestec.portal
#
# If no arguments are given, the demo.cfg is used, which should
# populate the ZODB with dummy users and passwords and leave a
# fresh demo.eestec.net site to show the latest version in master.
#
# To use it in a cronjob, add the -f option to force the deletion
# of the folder.
#
SRC=git://github.com/eestec
DEFAULT_CFG="demo.cfg"
DIR="/tmp"
REPO="eestec.portal"
while getopts ":fb:" opt; do
case $opt in
f)
FORCE=TRUE
;;
b)
CFG=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
if [ -z "$CFG" ]; then
CFG=$DEFAULT_CFG
fi
echo "Using directory: $DIR"
echo "Using repository: $SRC/$REPO.git"
echo "Will deploy with "$CFG
cd $DIR
if [ -e $REPO ]; then
if [ -z $FORCE ]; then
echo "$DIR/$REPO will be stopped and deleted. Are you sure? [yN] "
read REPLY
if [ ! "x$REPLY" = "xy" ]
then
exit 1
fi
fi
$REPO/bin/instance stop
rm -rf $REPO
fi
git clone $SRC/$REPO.git
cd $REPO
virtualenv -p python2.7 --no-site-packages .
bin/python bootstrap.py
$(which echo) -e "[buildout]\nextends = buildout.d/$CFG" > buildout.cfg
bin/buildout
bin/instance start