User Tools

Site Tools


Gitweb on PirateBox/OpenErt

Unfortunately this is no success story, I kept stuck right in front of the goal.. but maybe the problem can be solved sometime. The main reason why it doesn't work “right out of the box” is, that git for OpenWrt is compiled without the web stuff. :(

Installation of the stuff

Download the following files 

and upload them all to the PirateBox then run the following commands on the PirateBox

opkg install  -d ext   /mnt/usb/PirateBox/Shared/*.ipk
ln -s /usr/local/usr/share/git-core  /usr/share 
mkdir /mnt/usb/git
ln /usr/local/usr/bin/git /usr/local/usr/libexec/git-core   # fixes an issue of the OpenWrt package
mkdir /usr/libexec
ln -s /usr/local/usr/libexec/git-core  /usr/local/usr/libexec/

Now we prepare the custom version of gitweb

mkdir  /mnt/usb/tmp
cd /mnt/usb/tmp
cp /mnt/usb/PirateBox/Shared/   ./
cp git- /usr/local/usr/share/ -rv
## Do some configuration...
sed -i -e  's|++GIT_BINDIR++/|/usr/local/usr/bin/|g'  \
  -e  's|++GITWEB_PROJECTROOT++|/mnt/usb/git|g'   \
  -e  's|++GITWEB_PROJECT_MAXDEPTH++|2007|g' \
  -e  's|++GITWEB_HOME_LINK_STR++|projects|g' \
  -e  's|++GITWEB_SITENAME++|PirateBox-git|g' \
  -e  's|++GITWEB_SITE_HEADER++|PirateBox-git|g' \
  -e  's|++GITWEB_HOMETEXT++|indextext.html|g' \
  -e 's|++GITWEB_SITE_FOOTER++||g' \
  -e 's|++GITWEB_CSS++|static/gitweb.css|g' \
  -e 's|++GITWEB_LOGO++|static/git-logo.png|g' \
  -e 's|++GITWEB_FAVICON++|static/git-favicon.png|g' \
  -e 's|++GITWEB_JS++|static/gitweb.js|g'   \
  -e 's|++GITWEB_LIST++||g' \
  -e 's|++GITWEB_EXPORT_OK++||g' \
  -e 's|++GITWEB_STRICT_EXPORT++||g'  \
  -e 's|++GITWEB_BASE_URL++||g' \
  -e 's|++GIT_VERSION++||g' \
  -e 's|++HIGHLIGHT_BIN++|highlight|g' \

Now run the following configuration extention for the lighttpd.conf

echo '
server.modules += ( "mod_alias" )
$HTTP["host"] == "git.piratebox.lan" {       
  server.document-root    = "/usr/local/usr/share/gitweb"
  cgi.assign = ( ".perl" => "/usr/bin/perl" )    
  server.indexfiles = ( "gitweb.perl" )                                   
  $HTTP["url"] =~ "(?x)^/(.*/(HEAD | info/refs | objects/(info/[^/]+ | [0-9a-f]{2}/[0-9a-f]{38} | pack/
      alias.url  += ( "" => "/usr/local/usr/libexec/git-core/git-http-backend")
      cgi.assign = ("" => "")                    
      setenv.add-environment = (       
          "GIT_PROJECT_ROOT" => "/mnt/usb/git/",
          "GIT_HTTP_EXPORT_ALL" => ""
} ' >>  /opt/piratebox/conf/lighttpd/lighttpd.conf

Then restart the piratebox scripts including the webserver

/etc/init.d/piratebox restart

After this restart the git-repository is reachable under git.piratebox.lan .

The Problem

Remember to use “bare” repositories you can create like described here

As I mentioned, I did not success, because my clone always fails with the following message:

$ git clone http://git.piratebox.lan/?p=test3 
Cloning into '?p=test3'...
fatal: http://git.piratebox.lan/?p=test3/info/refs not found: did you run git update-server-info on the server?

According to this howto I need to run this command… I found out that git update-server-info works, but I still get the error. Unfortunately it makes no difference if the folder is an ext3 or fat filesystem :(

openwrt/gitweb.txt · Last modified: 2014/12/03 21:37 by matthias