# [PATCHv2] git-instaweb: detect difference between mod_cgi and mod_cgid for apache2

1 messages from 2009-08-12 to 2009-08-12. Participants: Mark A Rada.
Thread: https://gitlist.dev/t/20547

## Mark A Rada, 2009-08-12 02:34

Subject: [PATCHv2] git-instaweb: detect difference between mod_cgi and mod_cgid for apache2
Message-ID: <F920560B-FABD-47A1-9F83-47A3F2C3193D@mailservices.uwaterloo.ca>
URL: https://gitlist.dev/e/F920560B-FABD-47A1-9F83-47A3F2C3193D%40mailservices.uwaterloo.ca

```
Comments?

--
Mark A Rada (ferrous26)
marada@uwaterloo.ca


--->8----
Some people have mod_cgid in place of mod_cgi, this will check which one
the user has available to them first and then act accordingly.

It is possible to have both mod_cgi and mod_cgid installed at the same
time; in these cases, mod_cgi will preferred over mod_cgid to make
things easier.

In the case that no CGI modules are available for apache2 the script
will print a message to the user notifying him/her about the problem.

Signed-off-by: Mark Rada <marada@uwaterloo.ca>
---
  git-instaweb.sh |   15 ++++++++++++++-
  1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/git-instaweb.sh b/git-instaweb.sh
index 5f5cac7..ec0b518 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -298,7 +298,20 @@ EOF
  		resolve_full_httpd
  		list_mods=$(echo "$full_httpd" | sed "s/-f$/-l/")
  		$list_mods | grep 'mod_cgi\.c' >/dev/null 2>&1 || \
-		echo "LoadModule cgi_module $module_path/mod_cgi.so" >> "$conf"
+		if test -f "$module_path/mod_cgi.so"
+		then
+			echo "LoadModule cgi_module $module_path/mod_cgi.so" >> "$conf"
+		else
+			$list_mods | grep 'mod_cgid\.c' >/dev/null 2>&1 || \
+			if test -f "$module_path/mod_cgid.so"
+			then
+				echo "LoadModule cgid_module $module_path/mod_cgid.so" >> "$conf"
+			else
+				echo "You don't have any CGI support!"
+				exit 2
+			fi
+			echo "ScriptSock logs/gitweb.sock" >> "$conf"
+		fi
  		cat >> "$conf" <<EOF
  AddHandler cgi-script .cgi
  <Location /gitweb.cgi>
-- 
1.6.4

```
