Monthly Archive: July 2015

Make a bash-script change directory to where it is located!

In case you have files that are located in the same directory as the script that are read by the script, and you are to lazy to make it a configuration variable 🙂

SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname $SCRIPT`
cd $SCRIPTPATH

Make your Raspberry Pi Netboot over NFS

When I started using my first Raspberry Pi, I read about people having to change their SD-card every now and then because most (especially cheap) SD-cards are not made for being used as a harddisk replacement. So I googled a bit and setup NFS boot for my Raspberry Pi. Tested on Raspberry Pi Model B, B+ and 2.

This is what your cmdline.txt should look like, of course change the necessary information to correspond with your own environment.

ip=dhcp netboot=nfs boot=NFS=172.16.1.2:/Users/siho/openelec/system disk=NFS=172.16.1.2:/Users/siho/openelec/storage ssh quiet fastboot

…and of course you need to have a working NFS server with corresponding exports…

This is my /etc/exports

/Users/siho/openelec/system 
/Users/siho/openelec/storage -mapall=siho:staff

And yes, for observant readers, this is run on an OS X machine, but should work with any other BSD or Linux-system as well 🙂