1
+ #! /usr/bin/env bash
2
+
3
+ # ####################################################################
4
+ # ## Script to make a self-extracting install and uggrade scripts ###
5
+ # ####################################################################
6
+ # This script should ONLY be invoked from the Gradle dist task!
7
+
8
+ # Gradle passes the version number of the current build to this script
9
+ # for uniformity in naming conventions.
10
+ VERSION=$1
11
+
12
+ # This script assumes that it is running from the root of the concourse-server
13
+ # project
14
+ DISTS=" build/distributions"
15
+ cd $DISTS
16
+ unzip concourse-server* zip
17
+ cd -
18
+
19
+ # #######################################################################
20
+ # ########################### INSTALLER #################################
21
+ # #######################################################################
22
+
23
+ INSTALLER=" concourse-server-$VERSION .install"
24
+ ../makeself/makeself.sh --notemp $DISTS /concourse-server $INSTALLER " Concourse Server"
25
+ mv $INSTALLER $DISTS
26
+
27
+ # #######################################################################
28
+ # ############################ UPGRADER #################################
29
+ # #######################################################################
30
+
31
+ SCRIPT_NAME=" .update"
32
+ SCRIPT=" $DISTS /concourse-server/$SCRIPT_NAME "
33
+
34
+ # We dynamically create an "update" script that copies certain files from
35
+ # the new distribution to the current install directory. Afterwards, the
36
+ # update script will start the server and run the upgrade task
37
+
38
+ # --- copy files
39
+ echo " #!/usr/bin/env bash" >> $SCRIPT
40
+ echo " cp -R lib/ ../lib/" >> $SCRIPT
41
+ echo " cp -R bin/ ../bin/" >> $SCRIPT
42
+ echo " cp -R licenses/ ../licenses/" >> $SCRIPT
43
+ # TODO: Copy config files???
44
+ echo " cd .." >> $SCRIPT
45
+
46
+ # --- run upgrade task
47
+ # TODO exec bin/start
48
+ # TODO exec bin/upgrade
49
+ # TODO exec bin/stop
50
+
51
+ # --- delete upgrade working files
52
+ echo " rm -r concourse-server" >> $SCRIPT
53
+ echo " rm concourse-server*upgrade" >> $SCRIPT
54
+ echo " exit 0" >> $SCRIPT
55
+
56
+ # Make upgrade script executable
57
+ chmod +x $SCRIPT
58
+
59
+ UPGRADER=" concourse-server-$VERSION .upgrade"
60
+ ../makeself/makeself.sh --notemp $DISTS /concourse-server $UPGRADER " Concourse Server" ./$SCRIPT_NAME
61
+ mv $UPGRADER $DISTS
62
+
63
+ # #######################################################################
64
+ # ############################ #CLEANUP #################################
65
+ # #######################################################################
66
+ cd $DISTS
67
+ rm -rf concourse-server
68
+ cd -
69
+
70
+ exit 0
0 commit comments