Skip to content

Commit 5e50081

Browse files
committed
Generate install and upgrade scripts during build
1 parent e5adb3f commit 5e50081

File tree

9 files changed

+1628
-0
lines changed

9 files changed

+1628
-0
lines changed

concourse-server/.dist.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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

concourse-server/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,7 @@ task distZip(type: Zip, dependsOn: jar) {
5252
}
5353
}
5454

55+
task dist(type: Exec, dependsOn: distZip) {
56+
commandLine 'bash', '.dist.sh', version
57+
}
58+

makeself/COPYING

Lines changed: 341 additions & 0 deletions
Large diffs are not rendered by default.

makeself/README

Lines changed: 307 additions & 0 deletions
Large diffs are not rendered by default.

makeself/TODO

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
What needs to be done next :
2+
3+
- Generic compression code (thru a user-defined command)
4+
- Collect names of directories potentially containing md5 program. GUESS_MD5_PATH
5+
6+
St�phane Peter <[email protected]>

0 commit comments

Comments
 (0)