rg100a openwrt 软件安装到硬盘

将opkg.conf修改成(sda1这个对应自己硬盘目录)
src/gz packages http://downloads.openwrt.org/backfire/10.03.1-rc4/brcm63xx/packages/
dest root /
dest usb /mnt/sda1/opt
dest ram /mnt/sda1/tmp
lists_dir ext /var/opkg-lists
option overlay_root /mnt/sda1/overlay

安装软件要在命令行下安装
如:opkg -d usb install proftpd

修改profile文件
vi /etc/profile

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/mnt/sda1/opt/sbin:/mnt/sda1/opt/usr/bin
export LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/sda1/opt/lib:/mnt/sda1/opt/usr/lib

然后就需要opkg-link这个工具

具体代码如下
———不要此行———
#!/bin/sh
COMMAND=$1
PACKAGE=$2
setdest () {
for i in `grep dest /etc/opkg.conf | cut -d ’ ’ -f 3`; do
if [ -f $i/usr/lib/opkg/info/$PACKAGE.list ]; then
DEST=$i
fi
done
if [ “x$DEST” = “x” ]; then
echo “Can not locate $PACKAGE.”
echo “Check /etc/opkg.conf for correct dest listings”;
echo “Check name of requested package: $PACKAGE”
exit 1
fi
}
addlinks () {
setdest;
cat $DEST/usr/lib/opkg/info/$PACKAGE.list | while read LINE; do
SRC=$LINE
DST=`echo $SRC | sed ’s%’$DEST’%%’`
DSTNAME=`basename $DST`
DSTDIR=`echo $DST | sed ’s%/’$DSTNAME’%%’`
test -f “$SRC”
if [ $? = 0 ]; then
test -e “$DST”
if [ $? = 1 ]; then
mkdir -p $DSTDIR
ln -sf $SRC $DST
else
echo “Not linking $SRC to $DST”
echo “$DST Already exists”
fi
else
test -d “$SRC”
if [ $? = 0 ]; then
test -e $DST
if [ $? = 1 ]; then
mkdir -p $DST
else
echo “directory already exists”
fi
else
echo “Source directory $SRC does not exist”
fi
fi
done
}
removelinks () {
setdest;
cat $DEST/usr/lib/opkg/info/$PACKAGE.list | while read LINE; do
SRC=$LINE
DST=`echo $LINE | sed ’s%’$DEST’%%’`
DSTNAME=`basename $DST`
DSTDIR=`echo $DST | sed ’s%/’$DSTNAME’%%’`
test -f $DST
if [ $? = 0 ]; then
rm -f $DST
test -d $DSTDIR && rmdir $DSTDIR 2>/dev/null
else
test -d $DST
if [ $? = 0 ]; then
rmdir $DST
else
echo “$DST does not exist”
fi
fi
done
}
mountdest () {
test -d $PACKAGE
if [ $? = 1 ]; then
echo “Mount point does not exist”
exit 1
fi
for i in $PACKAGE/usr/lib/opkg/info/*.list; do
$0 add `basename $i .list`
done
}
umountdest () {
test -d $PACKAGE
if [ $? = 1 ]; then
echo “Mount point does not exist”
exit 1
fi
for i in $PACKAGE/usr/lib/opkg/info/*.list; do
$0 remove `basename $i .list`
done
}
case “$COMMAND” in
add)
addlinks
;;
remove)
removelinks
;;
mount)
mountdest
;;
umount)
umountdest
;;
*)
echo “Usage: $0 ”
echo ” Commands: add, remove, mount, umount”
echo ” Targets: , ”
echo “Example: $0 add kismet-server”
echo “Example: $0 remove kismet-server”
echo “Example: $0 mount /mnt/usb”
echo “Example: $0 umount /mnt/usb”
exit 1
;;
esac
exit 0
———不要此行———

将opkg-link复制到/下
执行chmod +x /opkg-link
opkg说明
/opkg-link add mini-httpd 连接mini-httpd到系统目录
/opkg-link remove mini-httpd 删除根目录的mini-httpd连接
/opkg-link mount /mnt/sda1/opt 把 /mnt/hda1/opt下所有的软件连接到系统目录
/opkg-link umount /mnt/sda1/opt 删除对/mnt/hda1/opt下所有的连接

连接之后如往硬盘安装软件装完后再运行下连接命令