From 8e64eff782aa9d695afc6ee92f4f428c33ec8d23 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 23 Dec 2012 17:35:06 +0100 Subject: o Moving config.properties to etc/ to make it more app.sh compatible. --- .gitignore | 2 +- config.properties.template | 13 -------- etc/app.conf | 1 + etc/config.properties.template | 13 ++++++++ pom.xml | 13 ++++++++ src/main/java/io/trygvis/esper/testing/Config.java | 2 +- src/main/unix/files/root/bin/method | 37 ++++++++++++++++++++++ src/main/unix/files/scripts/postinstall | 3 ++ 8 files changed, 69 insertions(+), 15 deletions(-) delete mode 100644 config.properties.template create mode 100644 etc/app.conf create mode 100644 etc/config.properties.template create mode 100644 src/main/unix/files/root/bin/method create mode 100644 src/main/unix/files/scripts/postinstall diff --git a/.gitignore b/.gitignore index c396f47..a9f72a1 100755 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,6 @@ target .idea *.iml -config.properties +etc/config.properties *tmp* diff --git a/config.properties.template b/config.properties.template deleted file mode 100644 index a8c4b97..0000000 --- a/config.properties.template +++ /dev/null @@ -1,13 +0,0 @@ -gitorious.url= -gitorious.sessionValue= -gitorious.projectListUpdateDelay=1 -gitorious.projectListUpdateInterval=60 - -nexus.updateInterval=3600 - -jenkins.updateInterval=3600 - -database.driver= -database.url=jdbc:h2:tcp://127.0.0.1/esper;DB_CLOSE_DELAY=-1 -database.username= -database.password= diff --git a/etc/app.conf b/etc/app.conf new file mode 100644 index 0000000..9050c9d --- /dev/null +++ b/etc/app.conf @@ -0,0 +1 @@ +app.method=bin/method diff --git a/etc/config.properties.template b/etc/config.properties.template new file mode 100644 index 0000000..a8c4b97 --- /dev/null +++ b/etc/config.properties.template @@ -0,0 +1,13 @@ +gitorious.url= +gitorious.sessionValue= +gitorious.projectListUpdateDelay=1 +gitorious.projectListUpdateInterval=60 + +nexus.updateInterval=3600 + +jenkins.updateInterval=3600 + +database.driver= +database.url=jdbc:h2:tcp://127.0.0.1/esper;DB_CLOSE_DELAY=-1 +database.username= +database.password= diff --git a/pom.xml b/pom.xml index adb8e12..8547498 100644 --- a/pom.xml +++ b/pom.xml @@ -202,7 +202,20 @@ target/appassembler + root + + + root/bin/* + scripts/* + + + root/bin/*.bat + + + 0755 + + diff --git a/src/main/java/io/trygvis/esper/testing/Config.java b/src/main/java/io/trygvis/esper/testing/Config.java index c080a0b..13ef1cd 100644 --- a/src/main/java/io/trygvis/esper/testing/Config.java +++ b/src/main/java/io/trygvis/esper/testing/Config.java @@ -64,7 +64,7 @@ public class Config { initLogging(); Properties properties = new Properties(); - try (FileInputStream inputStream = new FileInputStream("config.properties")) { + try (FileInputStream inputStream = new FileInputStream("etc/config.properties")) { properties.load(inputStream); } diff --git a/src/main/unix/files/root/bin/method b/src/main/unix/files/root/bin/method new file mode 100644 index 0000000..a6f1a2b --- /dev/null +++ b/src/main/unix/files/root/bin/method @@ -0,0 +1,37 @@ +#!/bin/bash + +. $APPSH_HOME/.app/lib/app-common + +method=$APPSH_METHOD + +if [ -z "$1" ] +then + echo "Missing required argument: app" >&2 + exit 1 +fi + +app=$1 +shift + +run() { + app=$1; shift + + if [ ! -x bin/$app ] + then + echo "Unknown app: $app" >&2 + exit 1 + fi + + exec "bin/$app" "$@" +} + +case "$method" in + run) + run "$app" "$@" + ;; + *) + echo "Unknown method: $method" >&2 + exit 1 + ;; +esac +exit $? diff --git a/src/main/unix/files/scripts/postinstall b/src/main/unix/files/scripts/postinstall new file mode 100644 index 0000000..07b1abc --- /dev/null +++ b/src/main/unix/files/scripts/postinstall @@ -0,0 +1,3 @@ +#!/bin/bash + +ln -s ../../../etc -- cgit v1.2.3