X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-instaweb.sh;h=95c3e5aa1f9bd5f0cec215ee2f81b2d4c36ea929;hb=511707d42b3b3e57d9623493092590546ffeae80;hp=cbc7418e3501b37a701a5177157733d97b405376;hpb=e94b4d2f2a3a9b2aaaac15c33d5d31f76531ecbf;p=git.git diff --git a/git-instaweb.sh b/git-instaweb.sh index cbc7418e3..95c3e5aa1 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -8,13 +8,7 @@ USAGE='[--start] [--stop] [--restart] . git-sh-setup -case "$GIT_DIR" in -/*) - fqgitdir="$GIT_DIR" ;; -*) - fqgitdir="$PWD/$GIT_DIR" ;; -esac - +fqgitdir="$GIT_DIR" local="`git config --bool --get instaweb.local`" httpd="`git config --get instaweb.httpd`" browser="`git config --get instaweb.browser`" @@ -36,14 +30,15 @@ test -z "$port" && port=1234 start_httpd () { httpd_only="`echo $httpd | cut -f1 -d' '`" - if test "`expr index $httpd_only /`" -eq '1' || \ - which $httpd_only >/dev/null + if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null;; esac then $httpd $fqgitdir/gitweb/httpd.conf else # many httpds are installed in /usr/sbin or /usr/local/sbin # these days and those are not in most users $PATHs - for i in /usr/local/sbin /usr/sbin + # in addition, we may have generated a server script + # in $fqgitdir/gitweb. + for i in /usr/local/sbin /usr/sbin "$fqgitdir/gitweb" do if test -x "$i/$httpd_only" then @@ -67,7 +62,7 @@ stop_httpd () { test -f "$fqgitdir/pid" && kill `cat "$fqgitdir/pid"` } -while case "$#" in 0) break ;; esac +while test $# != 0 do case "$1" in --stop|stop) @@ -143,6 +138,43 @@ GIT_DIR="$fqgitdir" export GIT_EXEC_PATH GIT_DIR +webrick_conf () { + # generate a standalone server script in $fqgitdir/gitweb. + cat >"$fqgitdir/gitweb/$httpd.rb" <"$fqgitdir/gitweb/$httpd" <"$conf" <> "$conf" +} + lighttpd_conf () { cat > "$conf" <