{"id":951,"date":"2016-06-08T21:14:26","date_gmt":"2016-06-08T19:14:26","guid":{"rendered":"http:\/\/hobbykeller.spdns.de\/?p=951"},"modified":"2016-08-01T15:27:27","modified_gmt":"2016-08-01T13:27:27","slug":"git-installation-bug-in-openwrts-chaos-calmer-15-05-1","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=951","title":{"rendered":"Git installation bug in OpenWRT&#8217;s Chaos Calmer  15.05.1"},"content":{"rendered":"<p>If you compiled OpenWRT&#8217;s Chaos Calmer 15.05.1 stable release from source and installed git by opkg, you will get a git version which is both outdated (version 2.3.5-1 while the current version at the time of writing is 2.8.4) and &#8220;crippled&#8221;. This post shows how to get a more recent version without any limitations.<!--more--><\/p>\n<h1>Major turn-offs of OpenWRT&#8217;s default git package<\/h1>\n<p>If you want to install git on your OpenWRT router, you have two options:<\/p>\n<ol>\n<li>Either you use the <code>opkg install<\/code> command to add the git package to a running router or&#8230;<\/li>\n<li>&#8230;you compile it from the package sources after you activated the package in the menuconfig.<\/li>\n<\/ol>\n<p>If you go for option 1 as recommended in my contribution about <a href=\"http:\/\/hobbykeller.spdns.de\/?p=718\" target=\"_blank\">setting up a git server on OpenWRT<\/a>, the drawback is that you will get a ridiculously outdated version (something around 2.3.5 while the current version at the time of writing is 2.8.4) and your git installation will be crippled in the sense that essential parts like the templates will not be installed.<\/p>\n<p>If you go for option 2, at least there is a more recent vesion (2.8.2 at the time of writing), but the installation will still be crippled. For instance, gitolite which runs on top of git was unable to create new repos. You will get some kind of warning and FATAL messages which include some hint that git lacks a <code>template<\/code> folder:<\/p>\n<pre class=\"lang:default decode:true\" title=\"Git warning with crippled installation\">warning: templates not found \/usr\/share\/git-core\/templates<\/pre>\n<h1>Solution<\/h1>\n<p>Strangely the maintainer of the oWRT git package <a href=\"https:\/\/github.com\/openwrt\/packages\/commit\/dccc2268bb11ea65ee98ed7c355b913375d089f5\" target=\"_blank\">deliberately removed the template files<\/a> from the installation. The idea therefore is a to create a simplified <code>Makefile<\/code> ressembling the one which was in place prior to the modifications done in the commit linked above.<\/p>\n<p>So we checkout the current package sources for git:<\/p>\n<pre class=\"lang:default decode:true\" title=\"Downloading the recent git sources for our custom repo\">ilek@i7:~\/myowrt\/custpacks$ svn checkout https:\/\/github.com\/openwrt\/packages\/trunk\/net\/git\r\nA    git\/Makefile\r\nA    git\/patches\r\nA    git\/patches\/100-convert_builtin.patch\r\nA    git\/patches\/200-disable_fasthash.patch\r\nA    git\/patches\/300-configure_for_crosscompiling\r\nA    git\/patches\/400-imapsend_without_curl.patch\r\nChecked out revision 6018.<\/pre>\n<p>And then change the <code>Makefile<\/code> to:<\/p>\n<pre class=\"lang:default decode:true \" title=\"Simpliefied git Makefile to ensure templates are included\"># Copyright (C) 2009-2015 OpenWrt.org\r\n#\r\n# This is free software, licensed under the GNU General Public License v2.\r\n# See \/LICENSE for more information.\r\n#\r\n\r\ninclude $(TOPDIR)\/rules.mk\r\n\r\nPKG_NAME:=git\r\nPKG_VERSION:=2.8.2\r\nPKG_RELEASE:=1\r\n\r\nPKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz\r\nPKG_SOURCE_URL:=@KERNEL\/software\/scm\/git\/\r\nPKG_MD5SUM:=b8edb4ae34828fda6aa2a4478089b107\r\n\r\nPKG_INSTALL:=1\r\nPKG_BUILD_PARALLEL:=1\r\n\r\ninclude $(INCLUDE_DIR)\/package.mk\r\n\r\ndefine Package\/git\r\n  SECTION:=net\r\n  CATEGORY:=Network\r\n  SUBMENU:=Version Control Systems\r\n  DEPENDS:=+libopenssl +libpthread +librt\r\n  TITLE:=The fast version control system\r\n  URL:=http:\/\/git-scm.com\r\n  MAINTAINER:=Peter Wagner &lt;tripolar@gmx.at&gt;\r\nendef\r\n\r\ndefine Package\/git\/description\r\n 2.8.2 is a free &amp; open source, distributed version control system\r\n designed to handle everything from small to very large projects\r\n with speed and efficiency.\r\nendef\r\n\r\nMAKE_FLAGS := \\\r\n\tCC=\"$(TARGET_CC)\" \\\r\n\tCFLAGS=\"$(TARGET_CFLAGS)\" \\\r\n\tCPPFLAGS=\"$(TARGET_CPPFLAGS)\" \\\r\n\tLDFLAGS=\"$(TARGET_LDFLAGS)\" \\\r\n\tNO_EXPAT=\"YesPlease\" \\\r\n\tNO_MKSTEMPS=\"YesPlease\" \\\r\n\tNO_GETTEXT=\"YesPlease\" \\\r\n\tNO_UNIX_SOCKETS=\"YesPlease\" \\\r\n\tNO_ICONV=\"YesPlease\" \\\r\n\tNO_NSEC=\"YesPlease\" \\\r\n\tNO_PERL=\"YesPlease\" \\\r\n\tNO_PYTHON=\"YesPlease\" \\\r\n\tNO_TCLTK=\"YesPlease\" \\\r\n\tNO_INSTALL_HARDLINKS=\"yes\" \\\r\n\r\nCONFIGURE_ARGS += \\\r\n\t--without-iconv \\\r\n\r\ndefine Build\/Configure\r\n\t$(MAKE) -C $(PKG_BUILD_DIR) \\\r\n\t\tconfigure\r\n\r\n\t( cd $(PKG_BUILD_DIR); \\\r\n\t\t.\/configure --prefix=\/usr \\\r\n\t);\r\nendef\r\n\r\ndefine Package\/git\/install\r\n\t$(INSTALL_DIR) $(1)\r\n\t$(RM) $(PKG_INSTALL_DIR)\/usr\/bin\/git-cvsserver\r\n\t$(CP) $(PKG_INSTALL_DIR)\/* $(1)\/\r\nendef\r\n\r\n$(eval $(call BuildPackage,git))<\/pre>\n<p>In order to avoid collisions between our customized git and the default git which ships with oWRT, we first uninstall the default git from the menuconfig:<\/p>\n<pre class=\"lang:default decode:true\" title=\"Removing buggy git feed from menuconf feeds\">ilek@i7:~\/codelab\/openwrt$ .\/scripts\/feeds uninstall git\r\nUninstalling package 'git'<\/pre>\n<p>We then physically remove the default oWRT git feed:<\/p>\n<pre class=\"lang:default decode:true \" title=\"Removing the buggy git feed from the package repos\">ilek@i7:~\/codelab\/openwrt\/feeds\/packages\/net$ rm -rf git<\/pre>\n<p>And then activate our own git feed from the menuconfig:<\/p>\n<pre class=\"lang:default decode:true\" title=\"Intalling our custom git sources into menuconfig\">ilek@i7:~\/codelab\/openwrt$ .\/scripts\/feeds update custom\r\nUpdating feed 'custom' from '\/home\/ilek\/myowrt\/custpacks' ...\r\nCreate index file '.\/feeds\/custom.index' \r\nCollecting package info: done\r\nilek@i7:~\/codelab\/openwrt$ .\/scripts\/feeds install git\r\nInstalling package 'git'\r\nilek@i7:~\/codelab\/openwrt$ .\/scripts\/feeds update -i\r\nCreate index file '.\/feeds\/packages.index' \r\nCollecting package info: done\r\nCreate index file '.\/feeds\/luci.index' \r\nCreate index file '.\/feeds\/routing.index' \r\nCreate index file '.\/feeds\/telephony.index' \r\nCreate index file '.\/feeds\/management.index' \r\nCreate index file '.\/feeds\/custom.index'\r\nilek@i7:~\/codelab\/openwrt$ scripts\/feeds install -p custom git<\/pre>\n<p>Once the correct git appears in your menuconfig, M-select the package. There is no need to add the git-http package. Then trigger a build run by issuing <code>make package\/git\/compile<\/code>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you compiled OpenWRT&#8217;s Chaos Calmer 15.05.1 stable release from source and installed git by opkg, you will get a git version which is both outdated (version 2.3.5-1 while the<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=951\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Git installation bug in OpenWRT&#8217;s Chaos Calmer  15.05.1<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,16],"tags":[204,150,135,203,159],"class_list":["post-951","post","type-post","status-publish","format-standard","hentry","category-linux","category-openwrt","tag-usrsharegit-coretemplates","tag-chaos-calmer","tag-git","tag-installation","tag-openwrt-15-05"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=951"}],"version-history":[{"count":9,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/951\/revisions"}],"predecessor-version":[{"id":979,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/951\/revisions\/979"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}