Wednesday, June 29, 2011

How to install GIT repo in ZyXEL NSA-320

ZyXEL NSA-320 is 1.2GHz NAS box with maximum of 2 x 2T harddisk (SATA I/II only)
The current firmware is 4.01 and is OK for the fun_plug

This box provides a very cheap alternative for the git repo plus your other storage need such as video, music download and backup as well.

You can gain telnet access following the instruction here :

and if you want to install GIT repo in this box, follow these steps.

(1) Follow the instruction here to gain telnet access, enable ssh server in the box, move the ffproot to harddisk and reboot your NAS box

If you failed the installation, I suggest you to download this directly and put the fun_plug.tgz in your USB stick rather than let it download during setup.

(2) install all packages (as you need most of them to build the git binary) from here
assume your server ipaddress is and use ssh to access the NAS box

ssh root@
mkdir -p /ffp/pkg
cd /ffp/pkg
rsync -av .
cd packages
funpkg -i *.tgz

(3) remove dns323 utilities which are not useful for NSA-320
funpkg -r dns323-utils-0.7.176-2.tgz

(4) install PERL & python
cd /ffp/pkg
funpkg -i python-2.6.4-1.tgz perl-5.10-2.tgz

(5) install the build environment
mkdir -p /i-data/md0/ffpbuildenv
cd /i-data/md0/ffpbuildenv
svn co svn:// .

(6) modify the file to this Select all

set -x
ffp=$(readlink -f /ffp)
if [ -d "$root" ]; then
echo "$root exists"
exit 1

mkdir -p $root
cd $root

mkdir -p ffp dev etc proc sys mnt i-data/md0
mount -t proc proc proc
mount -t sysfs sysfs sys
mount --bind /dev dev
mount --bind /etc etc
mount --bind $ffp ffp
mount --bind /i-data/md0 i-data/md0

ln -s ffp/bin bin
ln -s ffp/lib lib
ln -s ffp/sbin sbin
ln -s ffp usr
ln -s i-data/md0/ffproot/home home

chroot . $SHELL

umount i-data/md0
umount ffp
umount etc
umount dev
umount sys
umount proc

rm bin lib sbin usr home
rmdir ffp dev etc proc sys i-data/md0 mnt
rmdir i-data

cd ..
rmdir $root

(7) chroot to the build environment and get the git source and install it in NAS box

cd /i-data/md0/ffpbuildenv
cd i-data/md0/ffpbuildenv/source
tar xjvf git-1.7.6.tar.bz2
cd git-1.7.6
./configure --prefix=/ffp
NO_NSEC=YesPlease make install

(8) after installation of git, exit the build environment


(9) create git repo in the box (from your desktop)

ssh root@ "mkdir -p /home/root/git/yourproject.git; cd /home/root/git/yourproject.git; git --bare init; touch git-daemon-export-ok"

(10) push your project to the git repo in the NAS box (from your desktop)

cd ~/yourprojectdir
git init
git add . # include everything below ./ in the first commit;
# if you want to remove use git rm -r --cache xxx
git commit
git remote add origin ssh://root@
git push origin master

(11) If you don't want to build it. Just download this package and install it using funpkg -i git-1.7.6.tgz However, you still need to have some package dependencies like PERL & python in order to run.