An OpenWRT Device
Access to external storage (This could be USB Harddrive, SD/MMC Card or Samba share)
Setup and Usage
Setting it up ipkg installing to alternative locations is very easy.
First you have to mount your external storage-device as /opt
For ASUS WL-500g (deluxe) users, I have provided the information needed to make this happen on boot, in my
USB Disk/Printing tutorial.
After having your external storage available as /opt on your system, you need to make a small change to the /etc/ipkg.conf file, mine looks like:
src whiterussian-nbd http://downloads.openwrt.org/people/nbd/whiterussian/packages
src non-free http://downloads.openwrt.org/whiterussian/packages/non-free
dest root /
dest opt /opt
dest ram /tmp
The interesting part is the line: dest opt /opt
This creates an alternative destination for packages.
Now you are basically done and you can use ipkg to install packages to /opt
You use the new destination like this:
ipkg -d opt install < package-name >
You should however consider different things when choosing destination for packages. Basic stuff like kernel-modules (drivers), ssh deamons, firewall stuff and so on should probably be installed directly in the flash, while stuff like www servers can be installed in /opt since this is probably where you want to store the files for webpages anyway.
Packages installed to /opt have their executables in /opt/usr/bin and /opt/bin and since this is not part of the default path, they have to be called with full path.
To get rid of this unwanted "feature" change the PATH line of /etc/profiles to something like :
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin
Installing libs in /opt
People that have tried installing libs to /opt knows that this causes problems.
The reason is, that OpenWRT as default is only looking in /lib and /usr/lib for libs, and not in /opt/usr/lib .
To make libs work from /opt you need to add the following line to /etc/profile :
export LD_LIBRARY_PATH=/lib:/usr/lib:/opt/usr/lib:/opt/lib
Making services installed to /opt start at system boot time
In order to get stuff in /opt/etc/init.d/ startet at boot-time I have created the script S98optfiles and placed it in /etc/init.d
#!/bin/sh
#
# macsat.com /opt/etc/init.d/ script
#
i=0
while [ $i -le 30 ]
do
if [ -d /opt/etc/init.d ]
then
for i in /opt/etc/init.d/S*; do
$i start 2>&1
done | logger -s -p 6 -t '' &
break
fi
sleep 1
i=`expr $i + 1`
done
Now you should be ready to use your /opt directory and opt destination in ipkg for installing packages into :-)
I hope you found this tutorial useful.
Comments and questions are welcome at the Support Forum