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