www.mamboteam.com
macsat.com - OpenWrt | Olegs Firmware  
Home arrow Tutorials - OpenWrt (WR) arrow Installing ipkg packages to /opt
Friday, 21 November 2008
 
 
Main Menu
Home
About
News
Tutorials - OpenWrt (WR)
Tutorials - Oleg
Wiki (RDC Based Routers)
Online Shop
Forum
Downloads
Free Linux eBooks
Links
Search
Contact Us
We have 3 guests online
2812134 Visitors
Login
Welcome Guest.






Lost Password?
No account yet? Register
Old macsat.com
Nokia Unlock (Dansk)
Nokia Unlock (English)
XBins IRC Chat
Installing ipkg packages to /opt PDF Print E-mail
(2 votes)
Written by macsat   
Thursday, 24 November 2005
The Tutorial is made using a ASUS WL-500G Deluxe (or WL-500GX and WL-500GD as it is sometimes called).
It should however apply to all "OpenWRT Compatible" devices, even though some details like hardware addresses, storage locations and so on could differ if you use other hardware. Check out the General OpenWRT Tutorial Information page for more information.

Since most OpenWRT compatible hardware only has 4 or 8 MB Flash areas, it can come in handy to install packages to external storage devices.

For some Linksys WRT54G(S) routers hardware mods for adding a SD/MMC card reader directly to the router are available.
Other hardware models have USB ports, which allows connecting an USB harddrive or USB Flash Memory device directly.
If you have hardware where there is no possibilities to attach external storage, you can use SAMBA to connect to a windows share and use that.


Tutorial Index

1. Prerequisites - What is needed to get started.
2. Setup and Usage

Prerequisites

All you need is :
  • 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

    Last Updated ( Tuesday, 04 April 2006 )
     
    < Prev   Next >
    Buy Router
    Linksys WRT54GL
    Linksys WRT54GL
    Recent Forum Topics
    Donations

    If you appriciate this site, please consider making a small donation.

    All donations will be used to cover expenses from running macsat.com.

    Sponsored Ads
     
    Top! Top!