forked from victronenergy/venus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
do_release.sh
executable file
·60 lines (52 loc) · 1.27 KB
/
do_release.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
DEPLOY=deploy/venus
REMOTE=victron_www@updates-origin.victronenergy.com
D=/var/www/victron_www/feeds/venus/
FEED="$REMOTE:$OPKG"
if [ $# -eq 0 ]; then
echo "Usage: $0 release|candidate|testing"
exit 1
fi
function release ()
{
from="$D$1"
to="$D$2"
exclude=""
echo $from $to
ssh $REMOTE "if [ ! -d $to ]; then mkdir $to; fi"
# upload the files
ssh $REMOTE "rsync -v $exclude -rpt --no-links $from/ $to"
# thereafter update the symlinks and in the end delete the old files
ssh $REMOTE "rsync -v $exclude -rptl $from/ $to"
# keep all released images
if [ "$2" = "release" ]; then
exclude="$exclude --exclude=images/"
fi
ssh $REMOTE "rsync -v $exclude -rpt --delete $from/ $to"
}
case $1 in
release )
echo "Candidate -> Release"
release candidate release
;;
candidate )
echo "Testing -> Candidate"
release testing candidate
;;
testing )
echo "Develop -> Testing"
release develop testing
;;
skip-candidate )
echo "Testing -> Release (skips candidate!)"
read -n1 -r -p "Press any key to continue... Or CTRL-C to abort"
release testing release
;;
skip-testing )
echo "Develop -> Candidate (skips testing!)"
read -n1 -r -p "Press any key to continue... Or CTRL-C to abort"
release develop candidate
;;
*)
echo "Not a valid parameter"
;;
esac