User Tools

Site Tools


openwrt:gitweb

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

http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/perlbase-find_5.10.0-7_ar71xx.ipk
http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/perlbase-file_5.10.0-7_ar71xx.ipk
http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/perlbase-findbin_5.10.0-7_ar71xx.ipk
http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/perlbase-cwd_5.10.0-7_ar71xx.ipk
http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/perlbase-dynaloader_5.10.0-7_ar71xx.ipk
http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/perlbase-autoloader_5.10.0-7_ar71xx.ipk
http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/git_1.7.11.2-1_ar71xx.ipk
http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/lighttpd-mod-alias_1.4.30-2_ar71xx.ipk
https://github.com/git/git/archive/v1.7.11.2.zip 

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/v1.7.11.2.zip   ./
unzip v1.7.11.2.zip
cp git-1.7.11.2/gitweb /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|++GITWEB_SITE_HTML_HEAD_STRING++||g' \
  -e 's|++GIT_VERSION++|1.7.11.2|g' \
  -e 's|++HIGHLIGHT_BIN++|highlight|g' \
  /usr/local/usr/share/gitweb/gitweb.perl 

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 https://mcwhirter.com.au/craige/blog/2014/Adding_a_Git_Repo_To_GitWeb/

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 http://swarm.cs.pub.ro/~razvan/blog/http-repository-sharing-asides-gitweb/ 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