From: Julien Moutinho Date: Mon, 13 Oct 2014 06:26:24 +0000 (+0200) Subject: Ajout : ./garradin X-Git-Url: https://git.cyclocoop.org/?p=garradin.git;a=commitdiff_plain;h=431676587bf805faf940c4c1b0abe521581623f8 Ajout : ./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 +}