X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-instaweb.sh;h=95c3e5aa1f9bd5f0cec215ee2f81b2d4c36ea929;hb=511707d42b3b3e57d9623493092590546ffeae80;hp=80adc8307b4310440b5de7df82c5200cc2c45cbb;hpb=e7bb17a4753f11376a9bc6d3c1435c2602d3a0fc;p=git.git diff --git a/git-instaweb.sh b/git-instaweb.sh index 80adc8307..95c3e5aa1 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -8,18 +8,12 @@ USAGE='[--start] [--stop] [--restart] . git-sh-setup -case "$GIT_DIR" in -/*) - fqgitdir="$GIT_DIR" ;; -*) - fqgitdir="$PWD/$GIT_DIR" ;; -esac - -local="`git repo-config --bool --get instaweb.local`" -httpd="`git repo-config --get instaweb.httpd`" -browser="`git repo-config --get instaweb.browser`" -port=`git repo-config --get instaweb.port` -module_path="`git repo-config --get instaweb.modulepath`" +fqgitdir="$GIT_DIR" +local="`git config --bool --get instaweb.local`" +httpd="`git config --get instaweb.httpd`" +browser="`git config --get instaweb.browser`" +port=`git config --get instaweb.port` +module_path="`git config --get instaweb.modulepath`" conf=$GIT_DIR/gitweb/httpd.conf @@ -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" <