macsat.com OpenWrt and ASUS WL Forum

OpenWrt (White Russian) => Tutorials => Topic started by: jiel on January 10, 2006, 22:37:06 PM



Title: Installing ipkg packages to /opt
Post by: jiel on January 10, 2006, 22:37:06 PM
I recently installed openWRT on an WL500g Deluxe.
I followed the tutorials to install an usb key. It worked fine . The usb key is placed at location /opt.
Additionally, I reserved 25 M of the usb key to a linux swap partition and activated it by modifying the proposed /etc/init.d/S11mount script as follows :

#!/bin/sh
# Which device needs to be mounted?
MOUNT_DEVICE0=/dev/scsi/host0/bus0/target0/lun0/part1

i=0
# Wait 15s, mount when ready, and continue if it dosnt get ready within 15s
while [ $i -le 15 ]
  do
  if [ -e $MOUNT_DEVICE0 ]
  then
    mount $MOUNT_DEVICE0 /opt/
    echo "Success: $MOUNT_DEVICE0"
    # JLM 10-01-2006 swapon
    swapon /dev/scsi/host0/bus0/target0/lun0/part5
    exit 0
  fi
  sleep 1
  i=`expr $i + 1`
done

And it works.

But, I have a problem when installing new packages to /opt : when I try to install packages through :
  ipkg -d opt install <name of package>
all element are installed in a new directory /opt/opt. Example for libs : /opt/opt/lib and not as expected /opt/lib.

can you help me and tell me what is wrong ?
 :)


Title: Re: Installing ipkg packages to /opt
Post by: macsat on January 12, 2006, 07:57:52 AM


Can you give me the content of your /etc/ipkg.conf file ?


Title: Re: Installing ipkg packages to /opt
Post by: jiel on January 12, 2006, 22:03:08 PM
After having make several tries yesterday evening, I think I understood my mistake. Please correct me, if I am wrong.

The package I targetted to installed are already "compiled" for an installation in the directory "/opt". I saw this when looking at the package contents on the site : http://ipkgfind.nslu2-linux.org/ (it is the samba 3.0xxx package). I didn't know this.
Having the instruction "dest opt /opt" in the ipkg.conf file, I tried to install samba with the following command :
ipkg -d opt install samba.

And of course the installation is made to "/opt" from above installation instruction + "/opt/bin/...." for example from the package compilation, which ends at /opt/opt/bin/.....

Is my understanding correct ?


Title: Re: Installing ipkg packages to /opt
Post by: macsat on January 12, 2006, 22:13:39 PM

This could be 100% correct.

If you have used destination /opt  for a package that installs to /opt/bin /opt/var and so on per default, the files would end up in /opt/opt/bin /opt/opt/var ....etc.

Did you use a package designed for Olegs firmware on an OpenWrt box?

"Normal" OpenWrt packages are compiled as to be installed in /  and hence the -d opt is needed for thoose.


Title: Re: Installing ipkg packages to /opt
Post by: jiel on January 14, 2006, 15:49:25 PM
In fact I took it from http://ipkgfind.nslu2-linux.org/; the package is precompiled with "/opt/...." installation target.
Thanks for your help; so I learned to take care what the installation target is.



Title: Re: Installing ipkg packages to /opt
Post by: Quest on April 03, 2006, 14:29:24 PM
From the tutorial :
I havent been able to find where to tell OpenWRT to look in /opt/usr/lib so instead I have made a small script, that creates symlinks in /usr/lib for all files in /opt/usr/lib.
Download the script here and run it after running the ipkg -d opt install command on libs.


Add the following line to /etc/profile :
export LD_LIBRARY_PATH=/lib:/usr/lib:/opt/lib:/opt/usr/lib

This should do the trick  :)


Title: Re: Installing ipkg packages to /opt
Post by: VeNoM on July 13, 2006, 17:49:05 PM
I installed lighttpd and other apps in /opt and it won't start on reboot.
I modified the path, libs and everything ...

Code:
root@WL-500gP:~# echo $PATH
/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin:/opt/usr/bin:/opt/usr/sbin


Jul 13 19:12:28 (none) user.info : starting /opt/etc/init.d/S50lighttpd
Jul 13 19:12:29 (none) user.info : : /opt/etc/init.d/S50lighttpd: 22: lighttpd: not found
Jul 13 19:12:29 (none) user.info : /opt/etc/init.d/S50lighttpd: 22: lighttpd: not found


Jul 13 19:12:37 (none) user.info : /opt/usr/bin/rrdtool: can't load library 'librrd.so.0'
Jul 13 19:12:37 (none) user.info : : /opt/usr/bin/rrdtool: can't load library 'librrd.so.0'

Jul 13 19:12:37 (none) user.info : /opt/usr/sbin/rrdcollect: can't load library 'librrd.so'
Jul 13 19:12:37 (none) user.info : : /opt/usr/sbin/rrdcollect: can't load library 'librrd.so'

Jul 13 19:12:28 (none) user.info : : starting /opt/etc/init.d/S49ulogd
Jul 13 19:12:28 (none) user.info : starting /opt/etc/init.d/S49ulogd




Title: Re: Installing ipkg packages to /opt
Post by: macsat on July 27, 2006, 10:13:37 AM

check the contents of :
Code:
/opt/etc/default/lighttpd

You might need to change a path to the config file in there, since you have it installed in /opt

Also in the top of:
Code:
/opt/etc/init.d/lighttpd

there is a couple of places where you need to prepend : /opt   to the paths.

Finally - as mentioned in my "install to /opt" tutorial, running my optlibs.sh script is needed after adding libraries to /opt



/macsat


Title: Re: Installing ipkg packages to /opt
Post by: ha on July 29, 2006, 20:02:27 PM
I have same problem

1. /opt/etc/default/lighttpd

OPTIONS="-f /opt/etc/lighttpd.conf"


2. /opt/etc/init.d/lighttpd

#!/bin/sh

BIN=lighttpd
DEFAULT=/opt/etc/default/$BIN
LOG_D=/opt/var/log/$BIN
RUN_D=/opt/var/run
PID_F=$RUN_D/$BIN.pid
[ -f $DEFAULT ] && . $DEFAULT

case $1 in
 start)
  mkdir -p $LOG_D
  mkdir -p $RUN_D
  $BIN $OPTIONS
  ;;
 stop)
  [ -f $PID_F ] && kill $(cat $PID_F)
  ;;
 *)
  echo "usage: $0 (start|stop)"
  exit 1
esac

exit $?