Skip to content

Commit

Permalink
Generate install and upgrade scripts during build
Browse files Browse the repository at this point in the history
  • Loading branch information
jtnelson committed Dec 18, 2013
1 parent e5adb3f commit 5e50081
Show file tree
Hide file tree
Showing 9 changed files with 1,628 additions and 0 deletions.
70 changes: 70 additions & 0 deletions concourse-server/.dist.sh
@@ -0,0 +1,70 @@
#!/usr/bin/env bash

#####################################################################
### Script to make a self-extracting install and uggrade scripts ###
#####################################################################
# This script should ONLY be invoked from the Gradle dist task!

# Gradle passes the version number of the current build to this script
# for uniformity in naming conventions.
VERSION=$1

# This script assumes that it is running from the root of the concourse-server
# project
DISTS="build/distributions"
cd $DISTS
unzip concourse-server*zip
cd -

########################################################################
############################ INSTALLER #################################
########################################################################

INSTALLER="concourse-server-$VERSION.install"
../makeself/makeself.sh --notemp $DISTS/concourse-server $INSTALLER "Concourse Server"
mv $INSTALLER $DISTS

########################################################################
############################# UPGRADER #################################
########################################################################

SCRIPT_NAME=".update"
SCRIPT="$DISTS/concourse-server/$SCRIPT_NAME"

# We dynamically create an "update" script that copies certain files from
# the new distribution to the current install directory. Afterwards, the
# update script will start the server and run the upgrade task

# --- copy files
echo "#!/usr/bin/env bash" >> $SCRIPT
echo "cp -R lib/ ../lib/" >> $SCRIPT
echo "cp -R bin/ ../bin/" >> $SCRIPT
echo "cp -R licenses/ ../licenses/" >> $SCRIPT
# TODO: Copy config files???
echo "cd .." >> $SCRIPT

# --- run upgrade task
# TODO exec bin/start
# TODO exec bin/upgrade
# TODO exec bin/stop

# --- delete upgrade working files
echo "rm -r concourse-server" >> $SCRIPT
echo "rm concourse-server*upgrade" >> $SCRIPT
echo "exit 0" >> $SCRIPT

# Make upgrade script executable
chmod +x $SCRIPT

UPGRADER="concourse-server-$VERSION.upgrade"
../makeself/makeself.sh --notemp $DISTS/concourse-server $UPGRADER "Concourse Server" ./$SCRIPT_NAME
mv $UPGRADER $DISTS

########################################################################
############################# #CLEANUP #################################
########################################################################
cd $DISTS
rm -rf concourse-server
cd -

exit 0
4 changes: 4 additions & 0 deletions concourse-server/build.gradle
Expand Up @@ -52,3 +52,7 @@ task distZip(type: Zip, dependsOn: jar) {
}
}

task dist(type: Exec, dependsOn: distZip) {
commandLine 'bash', '.dist.sh', version
}

341 changes: 341 additions & 0 deletions makeself/COPYING

Large diffs are not rendered by default.

307 changes: 307 additions & 0 deletions makeself/README

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions makeself/TODO
@@ -0,0 +1,6 @@
What needs to be done next :

- Generic compression code (thru a user-defined command)
- Collect names of directories potentially containing md5 program. GUESS_MD5_PATH

St�phane Peter <megastep@megastep.org>

0 comments on commit 5e50081

Please sign in to comment.