From 431676587bf805faf940c4c1b0abe521581623f8 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Mon, 13 Oct 2014 08:26:24 +0200 Subject: [PATCH] Ajout : ./garradin --- garradin | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100755 garradin diff --git a/garradin b/garradin new file mode 100755 index 0000000..95dceba --- /dev/null +++ b/garradin @@ -0,0 +1,110 @@ +#!/bin/sh + +#ROOT=/usr/share/garradin/www +ROOT=${0%/*}/www +#ROOT=~/fossil/garradin/src/www +ROUTER=${ROOT}/_route.php +PORT=8088 +ADDRESS=localhost +VERBOSE=0 + +# Execute getopt +ARGS=`getopt -o "p:vh" -l "port:,verbose,help" -n "garradin" -- "$@"` + +# Bad arguments +if [ $? -ne 0 ]; +then + exit 1 +fi + +# A little magic +eval set -- "$ARGS" + +# Now go through all the options +while true; +do + case "$1" in + -p|--port) + PORT=$2 + shift;; + + -v|--verbose) + VERBOSE=1 + shift;; + + -h|--help) + cat < /dev/null 2>&1 & +} + +php_pid=$! +sleep .5 + +[ "$CMD" = "ui" ] && { + URL="http://${ADDRESS}:${PORT}/" + [ "$DISPLAY" != "" ] && { + x-www-browser ${URL} & + } || { + www-browser ${URL} & + } + + wait $! + kill $php_pid +} || { + wait $php_pid +} -- 2.20.1