Git

Installing git on MyBook Live

This tutorial assume that you already have root ssh access to your MyBook Live.

What NOT to do

The fist time I wanted to install git I tryed using apt-get to install it. It worked, I got a functionnal git at the cost of the whole system not working anymore… The web interface stopped working, only the network shares where still working, but later I discovered that a reboot would brick the device!

I had to manually restore the hard drive.

HOWTO : git

Now that we know what not to do, how can we do it, safely ?

There is another source of softwares that we can use, it's Optware.
Follow the simple steps and you are ready to install git !

And now you can install git binaries:

/opt/bin/ipkg install git

To allow all the users to access it, you have tow choices, add the /opt/bin to your $PATH or link git in /usr/bin. I'll cover the second one :

ln -s /opt/bin/git /usr/bin/git

That's it, git should now work.

HOWTO : Gitolite

WIP - will complete this section soon. These instructions are currently a braindump, I will test and update this procedure soon.

Gitolite is a little trickier to install as the MyBook Live have some SELinux restrictions that prevent it's perl scripts from working properly… The restructions allow a user to create a file and add content (echo "write" > test.out), but not append to it (echo "append" » test.out), which is required for gitolite to work… This caused a lot of permission denied error that made little sense at first:

FATAL: errors found but logfile could not be created
FATAL: /shares/git/.gitolite/logs/gitolite-2013-06.log: Permission denied
FATAL: cli      gitolite

Note : I need to find out how to fix the trustees instead of disabling them

With the web UI :

  • Create a new user : git
  • Create a new share : git

With ssh shell :

As root

First, change the home directory of the git user in /etc/passwd to : /shares/git

Deactivate the SELinux trustees :

settrustees -D

Prevent trustees to be restored at reboot. Edit the file /etc/init.d/mountDataVolume.sh and comment out the line :
/usr/local/sbin/setTrustees.sh

to
#/usr/local/sbin/setTrustees.sh

Make sure our git user can connect with ssh:
Edit the file /etc/ssh/sshd_config, find the line with "AllowUsers" :

AllowUsers root git

And make sure this line is commented out :
#AcceptEnv LANG LC_*

Set your share permissions (required for ssh):

chmod o-w /shares/git
chown git /shares/git

Log in your new git user:

su - git

Setup your environment:
mkdir ~/bin
echo "export PATH=\$PATH:~/bin" > ~/.profile
echo "export LANG=C" >> ~/.profile
echo "umask 022" >> ~/.profile
source .profile

Follow the gitolite install instructions

Once your setup is done you need to make sure your ssh permission are set :

chmod -R go-rw ~/.ssh

Have fun !

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License