]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-instaweb.sh
Merge branch 'jn/web'
[git.git] / git-instaweb.sh
index 16cd351f7f0d992be37be83017961c70731d4cc5..f5629e7439955666b1755177135ac7ac198bad54 100755 (executable)
@@ -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
 
@@ -53,6 +47,9 @@ start_httpd () {
                                return
                        fi
                done
+               echo "$httpd_only not found. Install $httpd_only or use" \
+                    "--httpd to specify another http daemon."
+               exit 1
        fi
        if test $? != 0; then
                echo "Could not execute http daemon $httpd."
@@ -64,7 +61,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)
@@ -160,10 +157,20 @@ apache2_conf () {
        test "$local" = true && bind='127.0.0.1:'
        echo 'text/css css' > $fqgitdir/mime.types
        cat > "$conf" <<EOF
+ServerName "git-instaweb"
 ServerRoot "$fqgitdir/gitweb"
 DocumentRoot "$fqgitdir/gitweb"
 PidFile "$fqgitdir/pid"
 Listen $bind$port
+EOF
+
+       for mod in mime dir; do
+               if test -e $module_path/mod_${mod}.so; then
+                       echo "LoadModule ${mod}_module " \
+                            "$module_path/mod_${mod}.so" >> "$conf"
+               fi
+       done
+       cat >> "$conf" <<EOF
 TypesConfig $fqgitdir/mime.types
 DirectoryIndex gitweb.cgi
 EOF