summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 721e76c)
raw | patch | inline | side by side (parent: 721e76c)
author | Eric Wong <normalperson@yhbt.net> | |
Wed, 4 Aug 2010 09:51:25 +0000 (09:51 +0000) | ||
committer | Eric Wong <normalperson@yhbt.net> | |
Thu, 5 Aug 2010 08:51:26 +0000 (08:51 +0000) |
This has been broken since commit be5347b ("httpd logs in a
"$httpd_only" subdirectory").
Since WEBrick has no other way of preserving environment
variables needed for gitweb, we create a shell script wrapper
that sets the environment variables as our CGI interpreter
to run gitweb.cgi.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
"$httpd_only" subdirectory").
Since WEBrick has no other way of preserving environment
variables needed for gitweb, we create a shell script wrapper
that sets the environment variables as our CGI interpreter
to run gitweb.cgi.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-instaweb.sh | patch | blob | history |
diff --git a/git-instaweb.sh b/git-instaweb.sh
index b7342e22c88993756e7beb6582a896087e52a034..5d4ddc8f583c460a0c9a11d0167e4bd6318c7e56 100755 (executable)
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
httpd_only="${httpd%% *}" # cut on first space
return
;;
+ *webrick*)
+ # server is started by running via generated webrick.sh in
+ # $fqgitdir/gitweb
+ full_httpd="$fqgitdir/gitweb/webrick.sh"
+ httpd_only="${httpd%% *}" # cut on first space
+ return
+ ;;
esac
httpd_only="$(echo $httpd | cut -f1 -d' ')"
export GIT_EXEC_PATH GIT_DIR GITWEB_CONFIG
webrick_conf () {
+ # webrick seems to have no way of passing arbitrary environment
+ # variables to the underlying CGI executable, so we wrap the
+ # actual gitweb.cgi using a shell script to force it
+ wrapper="$fqgitdir/gitweb/$httpd/wrapper.sh"
+ cat > "$wrapper" <<EOF
+#!/bin/sh
+# we use this shell script wrapper around the real gitweb.cgi since
+# there appears to be no other way to pass arbitrary environment variables
+# into the CGI process
+GIT_EXEC_PATH=$GIT_EXEC_PATH GIT_DIR=$GIT_DIR GITWEB_CONFIG=$GITWEB_CONFIG
+export GIT_EXEC_PATH GIT_DIR GITWEB_CONFIG
+exec $root/gitweb.cgi
+EOF
+ chmod +x "$wrapper"
+
+ # This assumes _ruby_ is in the user's $PATH. that's _one_
+ # portable way to run ruby, which could be installed anywhere, really.
# generate a standalone server script in $fqgitdir/gitweb.
cat >"$fqgitdir/gitweb/$httpd.rb" <<EOF
require 'webrick'
# which assumes _ruby_ is in the user's $PATH. that's _one_
# portable way to run ruby, which could be installed anywhere,
# really.
- cat >"$fqgitdir/gitweb/$httpd" <<EOF
+ cat >"$fqgitdir/gitweb/$httpd.sh" <<EOF
#!/bin/sh
exec ruby "$fqgitdir/gitweb/$httpd.rb" \$*
EOF
- chmod +x "$fqgitdir/gitweb/$httpd"
+ chmod +x "$fqgitdir/gitweb/$httpd.sh"
cat >"$conf" <<EOF
:Port: $port
:DocumentRoot: "$root"
:DirectoryIndex: ["gitweb.cgi"]
:PidFile: "$fqgitdir/pid"
+:CGIInterpreter: "$wrapper"
EOF
test "$local" = true && echo ':BindAddress: "127.0.0.1"' >> "$conf"
}