From: Eric Wong Date: Wed, 4 Aug 2010 09:51:25 +0000 (+0000) Subject: instaweb: fix WEBrick server support X-Git-Tag: v1.7.3-rc0~93^2~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/422bff280297b55aff6542cc5df1c078f37ab673?hp=721e76cbfac650ce676fc789b717eb21e1daa46e instaweb: fix WEBrick server support 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 --- diff --git a/git-instaweb.sh b/git-instaweb.sh index b7342e22c8..5d4ddc8f58 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -57,6 +57,13 @@ resolve_full_httpd () { 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' ')" @@ -188,6 +195,23 @@ GITWEB_CONFIG="$fqgitdir/gitweb/gitweb_config.perl" 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" <"$fqgitdir/gitweb/$httpd.rb" <"$fqgitdir/gitweb/$httpd" <"$fqgitdir/gitweb/$httpd.sh" <"$conf" <> "$conf" }