#!/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 }