-
Notifications
You must be signed in to change notification settings - Fork 75
/
do_release.sh
executable file
·71 lines (61 loc) · 1.58 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
61
62
63
64
65
66
67
68
69
70
71
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
call() {
# call ssh to run on a remotely
ssh $REMOTE "$@"
# run it locally instead for testing
# eval "$@"
}
function release ()
{
from="$D$1"
to="$D$2"
exclude=""
# Set this to only release large images. Note: it will rsync all packages.
# exclude="--include=images/* --include='images/*/venus-swu-*large-*' --include='images/*/venus-image-*large-*' --exclude=images/*/*"
args="-v"
echo $from $to
call "if [ ! -d $to ]; then mkdir $to; fi"
# upload the files
call "rsync $args $exclude -rpt --no-links $from/ $to"
# thereafter update the symlinks and in the end delete the old files
call "rsync $args $exclude -rptl $from/ $to"
# keep all released images
if [ "$2" = "release" ]; then
exclude="$exclude --exclude=images/"
fi
call "rsync $args $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