aboutsummaryrefslogtreecommitdiff
path: root/libexec/app-run-hook
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-01-27 15:00:27 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-01-27 15:00:27 +0100
commite1daac32c5b7ca0d902c16135d361aa5303f5124 (patch)
tree3ebe514ae823d23b26c96d8d2db9c6b97e191de4 /libexec/app-run-hook
parent11c930f71db58201994265b71a8f76187f1dbda1 (diff)
downloadapp.sh-e1daac32c5b7ca0d902c16135d361aa5303f5124.tar.gz
app.sh-e1daac32c5b7ca0d902c16135d361aa5303f5124.tar.bz2
app.sh-e1daac32c5b7ca0d902c16135d361aa5303f5124.tar.xz
app.sh-e1daac32c5b7ca0d902c16135d361aa5303f5124.zip
o Creating an initial version of install-file.
Diffstat (limited to 'libexec/app-run-hook')
-rwxr-xr-xlibexec/app-run-hook49
1 files changed, 49 insertions, 0 deletions
diff --git a/libexec/app-run-hook b/libexec/app-run-hook
new file mode 100755
index 0000000..ec96c58
--- /dev/null
+++ b/libexec/app-run-hook
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+set -e
+set -u
+
+APPSH_HOME=$(cd $(dirname "$0")/.. && pwd)
+
+. $APPSH_HOME/lib/common
+# HEADER END
+
+usage() {
+ echo "usage: $usage_app -v [version] -h [hook]" 2>&1
+}
+
+version=
+hook=
+
+while getopts "v:h:" opt
+do
+ case $opt in
+ v)
+ version=$OPTARG
+ shift 2
+ OPTIND=1
+ ;;
+ h)
+ hook=$OPTARG
+ shift 2
+ OPTIND=1
+ ;;
+ esac
+done
+
+if [[ -z $version || -z $hook || $# != 0 ]]
+then
+ usage
+fi
+
+bin=versions/$version/hooks/$hook
+
+if [[ ! -r $bin ]]
+then
+ exit 0
+fi
+
+# TODO: remove after
+#chmod +x $bin
+echo "Running hook: $hook"
+run_app -v $version hooks/$hook