Git 1.7.6
[git/git.git] / git-instaweb.sh
CommitLineData
a51d37c1
EW
1#!/bin/sh
2#
3# Copyright (c) 2006 Eric Wong
4#
c2db2e0e 5
c5699693 6PERL='@@PERL@@'
c2db2e0e
PH
7OPTIONS_KEEPDASHDASH=
8OPTIONS_SPEC="\
1b1dd23f 9git instaweb [options] (--start | --stop | --restart)
c2db2e0e
PH
10--
11l,local only bind on 127.0.0.1
12p,port= the port to bind to
13d,httpd= the command to launch
14b,browser= the browser to launch
15m,module-path= the module path (only needed for apache2)
16 Action
17stop stop the web server
18start start the web server
19restart restart the web server
20"
a51d37c1
EW
21
22. git-sh-setup
23
b2bc9a30 24fqgitdir="$GIT_DIR"
43d60d2e
FP
25local="$(git config --bool --get instaweb.local)"
26httpd="$(git config --get instaweb.httpd)"
c0cb4ed3 27root="$(git config --get instaweb.gitwebdir)"
43d60d2e
FP
28port=$(git config --get instaweb.port)
29module_path="$(git config --get instaweb.modulepath)"
a51d37c1 30
9126425d 31conf="$GIT_DIR/gitweb/httpd.conf"
a51d37c1
EW
32
33# Defaults:
34
82e5a82f 35# if installed, it doesn't need further configuration (module_path)
a51d37c1
EW
36test -z "$httpd" && httpd='lighttpd -f'
37
c0cb4ed3
PKS
38# Default is @@GITWEBDIR@@
39test -z "$root" && root='@@GITWEBDIR@@'
40
a51d37c1
EW
41# any untaken local port will do...
42test -z "$port" && port=1234
43
43d60d2e
FP
44resolve_full_httpd () {
45 case "$httpd" in
4bdf8599
DM
46 *apache2*|*lighttpd*|*httpd*)
47 # yes, *httpd* covers *lighttpd* above, but it is there for clarity
43d60d2e 48 # ensure that the apache2/lighttpd command ends with "-f"
e1622bfc 49 if ! echo "$httpd" | sane_grep -- '-f *$' >/dev/null 2>&1
43d60d2e
FP
50 then
51 httpd="$httpd -f"
52 fi
53 ;;
78646987
JN
54 *plackup*)
55 # server is started by running via generated gitweb.psgi in $fqgitdir/gitweb
56 full_httpd="$fqgitdir/gitweb/gitweb.psgi"
57 httpd_only="${httpd%% *}" # cut on first space
58 return
59 ;;
422bff28 60 *webrick*)
f46e1304 61 # server is started by running via generated webrick.rb in
422bff28 62 # $fqgitdir/gitweb
f46e1304 63 full_httpd="$fqgitdir/gitweb/webrick.rb"
422bff28
EW
64 httpd_only="${httpd%% *}" # cut on first space
65 return
66 ;;
43d60d2e
FP
67 esac
68
69 httpd_only="$(echo $httpd | cut -f1 -d' ')"
e47eec8f 70 if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null 2>&1;; esac
a51d37c1 71 then
43d60d2e 72 full_httpd=$httpd
a51d37c1
EW
73 else
74 # many httpds are installed in /usr/sbin or /usr/local/sbin
75 # these days and those are not in most users $PATHs
14b45b66
MD
76 # in addition, we may have generated a server script
77 # in $fqgitdir/gitweb.
c0cb4ed3 78 for i in /usr/local/sbin /usr/sbin "$root" "$fqgitdir/gitweb"
a51d37c1
EW
79 do
80 if test -x "$i/$httpd_only"
81 then
43d60d2e 82 full_httpd=$i/$httpd
a51d37c1
EW
83 return
84 fi
85 done
43d60d2e
FP
86
87 echo >&2 "$httpd_only not found. Install $httpd_only or use" \
88 "--httpd to specify another httpd daemon."
f281e3a1 89 exit 1
a51d37c1 90 fi
43d60d2e
FP
91}
92
93start_httpd () {
0b624b4c
SB
94 if test -f "$fqgitdir/pid"; then
95 say "Instance already running. Restarting..."
96 stop_httpd
97 fi
98
43d60d2e
FP
99 # here $httpd should have a meaningful value
100 resolve_full_httpd
101
102 # don't quote $full_httpd, there can be arguments to it (-f)
0ded4758 103 case "$httpd" in
78646987
JN
104 *mongoose*|*plackup*)
105 #These servers don't have a daemon mode so we'll have to fork it
0ded4758
WL
106 $full_httpd "$fqgitdir/gitweb/httpd.conf" &
107 #Save the pid before doing anything else (we'll print it later)
108 pid=$!
109
110 if test $? != 0; then
111 echo "Could not execute http daemon $httpd."
112 exit 1
113 fi
114
115 cat > "$fqgitdir/pid" <<EOF
116$pid
117EOF
118 ;;
119 *)
120 $full_httpd "$fqgitdir/gitweb/httpd.conf"
121 if test $? != 0; then
122 echo "Could not execute http daemon $httpd."
123 exit 1
124 fi
125 ;;
126 esac
a51d37c1
EW
127}
128
129stop_httpd () {
43d60d2e 130 test -f "$fqgitdir/pid" && kill $(cat "$fqgitdir/pid")
d1127622 131 rm -f "$fqgitdir/pid"
a51d37c1
EW
132}
133
d94775e1
JN
134httpd_is_ready () {
135 "$PERL" -MIO::Socket::INET -e "
136local \$| = 1; # turn on autoflush
137exit if (IO::Socket::INET->new('127.0.0.1:$port'));
138print 'Waiting for \'$httpd\' to start ..';
139do {
140 print '.';
141 sleep(1);
142} until (IO::Socket::INET->new('127.0.0.1:$port'));
143print qq! (done)\n!;
144"
145}
146
822f7c73 147while test $# != 0
a51d37c1
EW
148do
149 case "$1" in
150 --stop|stop)
151 stop_httpd
152 exit 0
153 ;;
154 --start|start)
155 start_httpd
156 exit 0
157 ;;
158 --restart|restart)
159 stop_httpd
160 start_httpd
161 exit 0
162 ;;
c2db2e0e 163 -l|--local)
a51d37c1
EW
164 local=true
165 ;;
c2db2e0e
PH
166 -d|--httpd)
167 shift
168 httpd="$1"
169 ;;
170 -b|--browser)
171 shift
172 browser="$1"
a51d37c1 173 ;;
c2db2e0e
PH
174 -p|--port)
175 shift
176 port="$1"
a51d37c1 177 ;;
c2db2e0e
PH
178 -m|--module-path)
179 shift
180 module_path="$1"
a51d37c1 181 ;;
c2db2e0e 182 --)
a51d37c1
EW
183 ;;
184 *)
185 usage
186 ;;
187 esac
188 shift
189done
190
191mkdir -p "$GIT_DIR/gitweb/tmp"
43d60d2e 192GIT_EXEC_PATH="$(git --exec-path)"
a51d37c1 193GIT_DIR="$fqgitdir"
c0cb4ed3
PKS
194GITWEB_CONFIG="$fqgitdir/gitweb/gitweb_config.perl"
195export GIT_EXEC_PATH GIT_DIR GITWEB_CONFIG
a51d37c1 196
425b78e8 197webrick_conf () {
422bff28
EW
198 # webrick seems to have no way of passing arbitrary environment
199 # variables to the underlying CGI executable, so we wrap the
200 # actual gitweb.cgi using a shell script to force it
201 wrapper="$fqgitdir/gitweb/$httpd/wrapper.sh"
202 cat > "$wrapper" <<EOF
203#!/bin/sh
204# we use this shell script wrapper around the real gitweb.cgi since
205# there appears to be no other way to pass arbitrary environment variables
206# into the CGI process
207GIT_EXEC_PATH=$GIT_EXEC_PATH GIT_DIR=$GIT_DIR GITWEB_CONFIG=$GITWEB_CONFIG
208export GIT_EXEC_PATH GIT_DIR GITWEB_CONFIG
209exec $root/gitweb.cgi
210EOF
211 chmod +x "$wrapper"
212
213 # This assumes _ruby_ is in the user's $PATH. that's _one_
214 # portable way to run ruby, which could be installed anywhere, really.
425b78e8
MD
215 # generate a standalone server script in $fqgitdir/gitweb.
216 cat >"$fqgitdir/gitweb/$httpd.rb" <<EOF
f46e1304 217#!/usr/bin/env ruby
425b78e8 218require 'webrick'
e9323e7f 219require 'logger'
f46e1304
EW
220options = {
221 :Port => $port,
222 :DocumentRoot => "$root",
e9323e7f
EW
223 :Logger => Logger.new('$fqgitdir/gitweb/error.log'),
224 :AccessLog => [
225 [ Logger.new('$fqgitdir/gitweb/access.log'),
226 WEBrick::AccessLog::COMBINED_LOG_FORMAT ]
227 ],
f46e1304
EW
228 :DirectoryIndex => ["gitweb.cgi"],
229 :CGIInterpreter => "$wrapper",
230 :StartCallback => lambda do
231 File.open("$fqgitdir/pid", "w") { |f| f.puts Process.pid }
232 end,
233 :ServerType => WEBrick::Daemon,
234}
235options[:BindAddress] = '127.0.0.1' if "$local" == "true"
425b78e8
MD
236server = WEBrick::HTTPServer.new(options)
237['INT', 'TERM'].each do |signal|
238 trap(signal) {server.shutdown}
239end
240server.start
241EOF
f46e1304
EW
242 chmod +x "$fqgitdir/gitweb/$httpd.rb"
243 # configuration is embedded in server script file, webrick.rb
244 rm -f "$conf"
425b78e8
MD
245}
246
a51d37c1
EW
247lighttpd_conf () {
248 cat > "$conf" <<EOF
c0cb4ed3 249server.document-root = "$root"
a51d37c1 250server.port = $port
e47eec8f 251server.modules = ( "mod_setenv", "mod_cgi" )
a51d37c1
EW
252server.indexfiles = ( "gitweb.cgi" )
253server.pid-file = "$fqgitdir/pid"
be5347b3 254server.errorlog = "$fqgitdir/gitweb/$httpd_only/error.log"
e47eec8f
RJ
255
256# to enable, add "mod_access", "mod_accesslog" to server.modules
257# variable above and uncomment this
be5347b3 258#accesslog.filename = "$fqgitdir/gitweb/$httpd_only/access.log"
e47eec8f 259
c0cb4ed3 260setenv.add-environment = ( "PATH" => env.PATH, "GITWEB_CONFIG" => env.GITWEB_CONFIG )
e47eec8f 261
a51d37c1 262cgi.assign = ( ".cgi" => "" )
e47eec8f
RJ
263
264# mimetype mapping
265mimetype.assign = (
266 ".pdf" => "application/pdf",
267 ".sig" => "application/pgp-signature",
268 ".spl" => "application/futuresplash",
269 ".class" => "application/octet-stream",
270 ".ps" => "application/postscript",
271 ".torrent" => "application/x-bittorrent",
272 ".dvi" => "application/x-dvi",
273 ".gz" => "application/x-gzip",
274 ".pac" => "application/x-ns-proxy-autoconfig",
275 ".swf" => "application/x-shockwave-flash",
276 ".tar.gz" => "application/x-tgz",
277 ".tgz" => "application/x-tgz",
278 ".tar" => "application/x-tar",
279 ".zip" => "application/zip",
280 ".mp3" => "audio/mpeg",
281 ".m3u" => "audio/x-mpegurl",
282 ".wma" => "audio/x-ms-wma",
283 ".wax" => "audio/x-ms-wax",
284 ".ogg" => "application/ogg",
285 ".wav" => "audio/x-wav",
286 ".gif" => "image/gif",
287 ".jpg" => "image/jpeg",
288 ".jpeg" => "image/jpeg",
289 ".png" => "image/png",
290 ".xbm" => "image/x-xbitmap",
291 ".xpm" => "image/x-xpixmap",
292 ".xwd" => "image/x-xwindowdump",
293 ".css" => "text/css",
294 ".html" => "text/html",
295 ".htm" => "text/html",
296 ".js" => "text/javascript",
297 ".asc" => "text/plain",
298 ".c" => "text/plain",
299 ".cpp" => "text/plain",
300 ".log" => "text/plain",
301 ".conf" => "text/plain",
302 ".text" => "text/plain",
303 ".txt" => "text/plain",
304 ".dtd" => "text/xml",
305 ".xml" => "text/xml",
306 ".mpeg" => "video/mpeg",
307 ".mpg" => "video/mpeg",
308 ".mov" => "video/quicktime",
309 ".qt" => "video/quicktime",
310 ".avi" => "video/x-msvideo",
311 ".asf" => "video/x-ms-asf",
312 ".asx" => "video/x-ms-asf",
313 ".wmv" => "video/x-ms-wmv",
314 ".bz2" => "application/x-bzip",
315 ".tbz" => "application/x-bzip-compressed-tar",
316 ".tar.bz2" => "application/x-bzip-compressed-tar",
317 "" => "text/plain"
318 )
a51d37c1 319EOF
9126425d 320 test x"$local" = xtrue && echo 'server.bind = "127.0.0.1"' >> "$conf"
a51d37c1
EW
321}
322
323apache2_conf () {
4bdf8599
DM
324 if test -z "$module_path"
325 then
326 test -d "/usr/lib/httpd/modules" &&
327 module_path="/usr/lib/httpd/modules"
328 test -d "/usr/lib/apache2/modules" &&
329 module_path="/usr/lib/apache2/modules"
330 fi
a51d37c1 331 bind=
9126425d 332 test x"$local" = xtrue && bind='127.0.0.1:'
e24c76bf 333 echo 'text/css css' > "$fqgitdir/mime.types"
a51d37c1 334 cat > "$conf" <<EOF
44a167b0 335ServerName "git-instaweb"
c0cb4ed3
PKS
336ServerRoot "$root"
337DocumentRoot "$root"
be5347b3
PKS
338ErrorLog "$fqgitdir/gitweb/$httpd_only/error.log"
339CustomLog "$fqgitdir/gitweb/$httpd_only/access.log" combined
a51d37c1
EW
340PidFile "$fqgitdir/pid"
341Listen $bind$port
44a167b0
EW
342EOF
343
4bdf8599
DM
344 for mod in mime dir env log_config
345 do
346 if test -e $module_path/mod_${mod}.so
347 then
44a167b0
EW
348 echo "LoadModule ${mod}_module " \
349 "$module_path/mod_${mod}.so" >> "$conf"
350 fi
351 done
352 cat >> "$conf" <<EOF
e24c76bf 353TypesConfig "$fqgitdir/mime.types"
a51d37c1
EW
354DirectoryIndex gitweb.cgi
355EOF
356
357 # check to see if Dennis Stosberg's mod_perl compatibility patch
358 # (<20060621130708.Gcbc6e5c@leonov.stosberg.net>) has been applied
e1622bfc 359 if test -f "$module_path/mod_perl.so" &&
c0cb4ed3 360 sane_grep 'MOD_PERL' "$root/gitweb.cgi" >/dev/null
a51d37c1
EW
361 then
362 # favor mod_perl if available
363 cat >> "$conf" <<EOF
364LoadModule perl_module $module_path/mod_perl.so
365PerlPassEnv GIT_DIR
2989f516 366PerlPassEnv GIT_EXEC_PATH
c0cb4ed3 367PerlPassEnv GITWEB_CONFIG
a51d37c1
EW
368<Location /gitweb.cgi>
369 SetHandler perl-script
370 PerlResponseHandler ModPerl::Registry
371 PerlOptions +ParseHeaders
372 Options +ExecCGI
373</Location>
374EOF
375 else
376 # plain-old CGI
43d60d2e 377 resolve_full_httpd
9524cf29 378 list_mods=$(echo "$full_httpd" | sed 's/-f$/-l/')
e1622bfc 379 $list_mods | sane_grep 'mod_cgi\.c' >/dev/null 2>&1 || \
10d1432a
MR
380 if test -f "$module_path/mod_cgi.so"
381 then
382 echo "LoadModule cgi_module $module_path/mod_cgi.so" >> "$conf"
383 else
384 $list_mods | grep 'mod_cgid\.c' >/dev/null 2>&1 || \
385 if test -f "$module_path/mod_cgid.so"
386 then
387 echo "LoadModule cgid_module $module_path/mod_cgid.so" \
388 >> "$conf"
389 else
390 echo "You have no CGI support!"
391 exit 2
392 fi
393 echo "ScriptSock logs/gitweb.sock" >> "$conf"
394 fi
a51d37c1 395 cat >> "$conf" <<EOF
2989f516
DM
396PassEnv GIT_DIR
397PassEnv GIT_EXEC_PATH
398PassEnv GITWEB_CONFIG
a51d37c1
EW
399AddHandler cgi-script .cgi
400<Location /gitweb.cgi>
401 Options +ExecCGI
402</Location>
403EOF
404 fi
405}
406
0ded4758
WL
407mongoose_conf() {
408 cat > "$conf" <<EOF
409# Mongoose web server configuration file.
410# Lines starting with '#' and empty lines are ignored.
411# For detailed description of every option, visit
412# http://code.google.com/p/mongoose/wiki/MongooseManual
413
c0cb4ed3 414root $root
0ded4758
WL
415ports $port
416index_files gitweb.cgi
417#ssl_cert $fqgitdir/gitweb/ssl_cert.pem
be5347b3
PKS
418error_log $fqgitdir/gitweb/$httpd_only/error.log
419access_log $fqgitdir/gitweb/$httpd_only/access.log
0ded4758
WL
420
421#cgi setup
c0cb4ed3 422cgi_env PATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH,GITWEB_CONFIG=$GITWEB_CONFIG
0ded4758
WL
423cgi_interp $PERL
424cgi_ext cgi,pl
425
426# mimetype mapping
427mime_types .gz=application/x-gzip,.tar.gz=application/x-tgz,.tgz=application/x-tgz,.tar=application/x-tar,.zip=application/zip,.gif=image/gif,.jpg=image/jpeg,.jpeg=image/jpeg,.png=image/png,.css=text/css,.html=text/html,.htm=text/html,.js=text/javascript,.c=text/plain,.cpp=text/plain,.log=text/plain,.conf=text/plain,.text=text/plain,.txt=text/plain,.dtd=text/xml,.bz2=application/x-bzip,.tbz=application/x-bzip-compressed-tar,.tar.bz2=application/x-bzip-compressed-tar
428EOF
429}
430
78646987
JN
431plackup_conf () {
432 # generate a standalone 'plackup' server script in $fqgitdir/gitweb
433 # with embedded configuration; it does not use "$conf" file
434 cat > "$fqgitdir/gitweb/gitweb.psgi" <<EOF
435#!$PERL
436
437# gitweb - simple web interface to track changes in git repositories
438# PSGI wrapper and server starter (see http://plackperl.org)
439
440use strict;
441
442use IO::Handle;
443use Plack::MIME;
444use Plack::Builder;
445use Plack::App::WrapCGI;
446use CGI::Emulate::PSGI 0.07; # minimum version required to work with gitweb
447
448# mimetype mapping (from lighttpd_conf)
449Plack::MIME->add_type(
450 ".pdf" => "application/pdf",
451 ".sig" => "application/pgp-signature",
452 ".spl" => "application/futuresplash",
453 ".class" => "application/octet-stream",
454 ".ps" => "application/postscript",
455 ".torrent" => "application/x-bittorrent",
456 ".dvi" => "application/x-dvi",
457 ".gz" => "application/x-gzip",
458 ".pac" => "application/x-ns-proxy-autoconfig",
459 ".swf" => "application/x-shockwave-flash",
460 ".tar.gz" => "application/x-tgz",
461 ".tgz" => "application/x-tgz",
462 ".tar" => "application/x-tar",
463 ".zip" => "application/zip",
464 ".mp3" => "audio/mpeg",
465 ".m3u" => "audio/x-mpegurl",
466 ".wma" => "audio/x-ms-wma",
467 ".wax" => "audio/x-ms-wax",
468 ".ogg" => "application/ogg",
469 ".wav" => "audio/x-wav",
470 ".gif" => "image/gif",
471 ".jpg" => "image/jpeg",
472 ".jpeg" => "image/jpeg",
473 ".png" => "image/png",
474 ".xbm" => "image/x-xbitmap",
475 ".xpm" => "image/x-xpixmap",
476 ".xwd" => "image/x-xwindowdump",
477 ".css" => "text/css",
478 ".html" => "text/html",
479 ".htm" => "text/html",
480 ".js" => "text/javascript",
481 ".asc" => "text/plain",
482 ".c" => "text/plain",
483 ".cpp" => "text/plain",
484 ".log" => "text/plain",
485 ".conf" => "text/plain",
486 ".text" => "text/plain",
487 ".txt" => "text/plain",
488 ".dtd" => "text/xml",
489 ".xml" => "text/xml",
490 ".mpeg" => "video/mpeg",
491 ".mpg" => "video/mpeg",
492 ".mov" => "video/quicktime",
493 ".qt" => "video/quicktime",
494 ".avi" => "video/x-msvideo",
495 ".asf" => "video/x-ms-asf",
496 ".asx" => "video/x-ms-asf",
497 ".wmv" => "video/x-ms-wmv",
498 ".bz2" => "application/x-bzip",
499 ".tbz" => "application/x-bzip-compressed-tar",
500 ".tar.bz2" => "application/x-bzip-compressed-tar",
501 "" => "text/plain"
502);
503
504my \$app = builder {
505 # to be able to override \$SIG{__WARN__} to log build time warnings
506 use CGI::Carp; # it sets \$SIG{__WARN__} itself
507
508 my \$logdir = "$fqgitdir/gitweb/$httpd_only";
509 open my \$access_log_fh, '>>', "\$logdir/access.log"
510 or die "Couldn't open access log '\$logdir/access.log': \$!";
511 open my \$error_log_fh, '>>', "\$logdir/error.log"
512 or die "Couldn't open error log '\$logdir/error.log': \$!";
513
514 \$access_log_fh->autoflush(1);
515 \$error_log_fh->autoflush(1);
516
517 # redirect build time warnings to error.log
518 \$SIG{'__WARN__'} = sub {
519 my \$msg = shift;
520 # timestamp warning like in CGI::Carp::warn
521 my \$stamp = CGI::Carp::stamp();
522 \$msg =~ s/^/\$stamp/gm;
523 print \$error_log_fh \$msg;
524 };
525
526 # write errors to error.log, access to access.log
527 enable 'AccessLog',
528 format => "combined",
529 logger => sub { print \$access_log_fh @_; };
530 enable sub {
531 my \$app = shift;
532 sub {
533 my \$env = shift;
534 \$env->{'psgi.errors'} = \$error_log_fh;
535 \$app->(\$env);
536 }
537 };
538 # gitweb currently doesn't work with $SIG{CHLD} set to 'IGNORE',
539 # because it uses 'close $fd or die...' on piped filehandle $fh
540 # (which causes the parent process to wait for child to finish).
541 enable_if { \$SIG{'CHLD'} eq 'IGNORE' } sub {
542 my \$app = shift;
543 sub {
544 my \$env = shift;
545 local \$SIG{'CHLD'} = 'DEFAULT';
546 local \$SIG{'CLD'} = 'DEFAULT';
547 \$app->(\$env);
548 }
549 };
550 # serve static files, i.e. stylesheet, images, script
551 enable 'Static',
552 path => sub { m!\.(js|css|png)\$! && s!^/gitweb/!! },
553 root => "$root/",
554 encoding => 'utf-8'; # encoding for 'text/plain' files
555 # convert CGI application to PSGI app
556 Plack::App::WrapCGI->new(script => "$root/gitweb.cgi")->to_app;
557};
558
559# make it runnable as standalone app,
560# like it would be run via 'plackup' utility
20e7ab8a
JN
561if (caller) {
562 return \$app;
563} else {
78646987
JN
564 require Plack::Runner;
565
566 my \$runner = Plack::Runner->new();
567 \$runner->parse_options(qw(--env deployment --port $port),
20e7ab8a 568 "$local" ? qw(--host 127.0.0.1) : ());
78646987
JN
569 \$runner->run(\$app);
570}
571__END__
572EOF
573
574 chmod a+x "$fqgitdir/gitweb/gitweb.psgi"
575 # configuration is embedded in server script file, gitweb.psgi
576 rm -f "$conf"
577}
578
c0cb4ed3
PKS
579gitweb_conf() {
580 cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
581#!/usr/bin/perl
582our \$projectroot = "$(dirname "$fqgitdir")";
583our \$git_temp = "$fqgitdir/gitweb/tmp";
584our \$projects_list = \$projectroot;
fc5b8e01
GB
585
586\$feature{'remote_heads'}{'default'} = [1];
c0cb4ed3 587EOF
4af819d4
JN
588}
589
c0cb4ed3 590gitweb_conf
a51d37c1 591
be5347b3
PKS
592resolve_full_httpd
593mkdir -p "$fqgitdir/gitweb/$httpd_only"
594
a51d37c1
EW
595case "$httpd" in
596*lighttpd*)
597 lighttpd_conf
598 ;;
4bdf8599 599*apache2*|*httpd*)
a51d37c1
EW
600 apache2_conf
601 ;;
425b78e8
MD
602webrick)
603 webrick_conf
604 ;;
0ded4758
WL
605*mongoose*)
606 mongoose_conf
607 ;;
78646987
JN
608*plackup*)
609 plackup_conf
610 ;;
a51d37c1
EW
611*)
612 echo "Unknown httpd specified: $httpd"
613 exit 1
614 ;;
615esac
616
617start_httpd
5209eda8 618url=http://127.0.0.1:$port
2e0c2902
CC
619
620if test -n "$browser"; then
d94775e1 621 httpd_is_ready && git web--browse -b "$browser" $url || echo $url
2e0c2902 622else
d94775e1 623 httpd_is_ready && git web--browse -c "instaweb.browser" $url || echo $url
2e0c2902 624fi