Optware

Optware is software package repositories (aka feeds) maintained by NSLU2 project. They offer access to hundreds of precompiled packages with the latest and greatest software, all at your fingertips, just a command and few seconds away!

bzhou:

/../Seriously, people happy with optware should consider donate to nslu2-linux. That's how we can pull resource together./../

x-click-but04.gif

Using feeds is the recommended way to install and maintain software on your device - this way, you can easily get security and bugfixes, uninstall, and query software database - in other words, get all the service which is core feature of any Linux distribution. Note: it's highly recommended to use only feeds to install the software, and not mix feeds and manual installs from the source. This is the same rule of thumb as for any other Linux distribution. Note2: This may be impractical, as not all software is available in feeds; but at least try to stick to library packages from feeds, if you don't want to create shlib hell for yourself.

There are now two types of MyBook with different hardware, and thus requiring different feeds, as well as the newest MyBookLive.

For original MyBook (with front lights arranged into circle) the feed is 'gumstix1151'.(this feed was originally designed for the gumstix devices - if there is enough interest in optware from this community it will be renamed to match the compilation configuration rather than the single target device, or a new feed perfectly tuned for the MBWE will be created). The main page for the feed is here: http://www.nslu2-linux.org/wiki/Optware/Gumstix . This page does not try to duplicate it, but provide the quick instructions on setting up the feed on MyBook. Please read the original page for more info.
We now have 'mbwe-bluering' feed. If you already have optware installed and use the 'gumstix1151' feed, look here for instructions on "moving" to the new feed. Also consider installing ldso-runpath-enabled-firmware for best optware experience.

For new MyBook (with front lights arranged in line) the feed is 'cs05q1armel'.

For the newest MyBookLive the feed is 'ds101g'.

NSLU2 project is not responsible for any damage that optware causes.

Setup

To start using feed, you need first to install package manager. Optware uses ipkg, which is standard package manager for many embedded distributions. Following commands manually bootstrap ipkg from the feed. They must be run as root.

Installation of optware package manager on new version of MyBook:

You must be logged in as root (default password: welc0me), because "su" command is not installed (busybox is compiled without it).

Then, run following commands:

# wget http://mybookworld.wikidot.com/local--files/optware/setup-whitelight.sh
# sh setup-whitelight.sh

Alternatively, run following commands one by one:

# feed=http://ipkg.nslu2-linux.org/feeds/optware/cs05q1armel/cross/unstable
# ipk_name=$(wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}')
# wget $feed/$ipk_name
# tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf -
# mkdir -p /opt/etc/ipkg
# echo "src armel $feed" > /opt/etc/ipkg/armel-feed.conf
# wget http://mybookworld.wikidot.com/local--files/optware/sort_dirname.tar.gz
# tar xvfz sort_dirname.tar.gz -C /

User binaries will be installed to /opt/bin and admin binaries in /opt/sbin. To run applications in /opt/bin and /opt/sbin without having to type # /opt/bin/<whatever> or # /opt/sbin/<whatever> every time, either execute this command every time you login:

# export PATH=$PATH:/opt/bin:/opt/sbin

or add the above command to the bottom of /root/.bashrc and /etc/profile. An easy way to do that is by issuing these commands:
# echo "export PATH=$PATH:/opt/bin:/opt/sbin" >> /root/.bashrc
# echo "export PATH=$PATH:/opt/bin:/opt/sbin" >> /etc/profile

(you must logout and re-login for these changes to take effect).

In any case, if you don't ensure that /opt/bin is in your path before using ipkg to install packages, update-alternatives will not work for sym-linking newly installed executables in /opt/bin

You may also add . (i.e. current directory) to the path - this prevents you from having to prefix shell scripts in the current directory with "./" to run them.
If you choose to do this then make the line you add to /root/.bashrc and /etc/profile

export PATH=$PATH:/opt/bin::/opt/sbin:.

Then it's all fun:

Update local feed lists - you need to issue this from time to time to get package updates:

# /opt/bin/ipkg update

A good first thing to install would be an alternative text editor like Nano. So follow the instructions here to install nano and test that you have the optware feed up and running properly.

See what's available, short descriptions included:

# /opt/bin/ipkg list

See what's already installed:

# /opt/bin/ipkg list_installed

Install or upgrade packages:

# /opt/bin/ipkg install <foo> <bar>

This will download packages from the net with all the required dependencies. Note: there's the same command for installing and upgrading to a new version of package.

Deinstall packages:

# /opt/bin/ipkg remove <foo> <bar>

Again, Bluerings owners, unless they use ldso-runpath-enabled-firmware, may need to run # ldconfig after package installation, if it complains that it can't find shared libraries, and possibly update /etc/ld.so.conf to add required libs (e.g., add line '/opt/lib/sasl2' for packages relying on libgsasl to work):

## echo "/opt/lib/<something>" >> /etc/ld.so.conf #if needed
# ldconfig

Also note that without LDSO_RUNPATH support, some packages (like dialog) won't work even after doing so, because of conflicting stock and optware shared libraries (like ncurses).

Launching Optware programs on startup

If you install something that uses initialization and termination scripts (/opt/etc/init.d/*), you should also do this to run them on startup and terminate on halt:
1. Download the script that will do all the work:

# wget -P /etc/init.d http://mybookworld.wikidot.com/local--files/optware/optware.sh

Alternately, create /etc/init.d/optware.sh yourself:
#!/bin/sh

start() {
if [ -d /opt/etc/init.d ]; then
  echo "Launching Optware initialization scripts"
  for f in /opt/etc/init.d/S* ; do
    [ -x $f ] && $f start
  done
else
  echo "error: /opt/etc/ini.d directory not found" >&2
  exit 1
fi
}

stop() {
if [ -d /opt/etc/init.d ]; then
  echo "Launching Optware termination scripts"
  for f in /opt/etc/init.d/K* ; do
    [ -x $f ] && $f stop
  done
else
  echo "error: /opt/etc/ini.d directory not found" >&2
  exit 1
fi
}

restart() {
    stop
    start
}

case "$1" in
    start)
        start
    ;;
    stop)
        stop
    ;;
    restart)
        restart
    ;;
    cleanup)
    ;;
    *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $?

2. Make it executable:

# chmod +x /etc/init.d/optware.sh

Now you can run optware initialization and termination scripts using it:
# /etc/init.d/optware.sh start #this launches the initialization scripts
# /etc/init.d/optware.sh stop #this launches the termination scripts
# /etc/init.d/optware.sh restart #and this first launches the termination scripts and then the initialization scripts

3. Create symlinks for the script to be properly called on startup/halt:

##for MBWE stock fw:
# ln -s optware.sh /etc/init.d/S90optware #this will launch optware initialization scripts on startup
# ln -s optware.sh /etc/init.d/K01optware #and this will launch optware termination scripts on halt
##Debian way (for MyBook Live):
# update-rc.d optware.sh defaults 90 01

Backing up "clean" Optware setup and making sure all your Optware hacks survive a firmware upgrade

1. Back up /opt to somewhere off the machine or to the data partition. This way you will be able to quickly restore optware to "virgin state" in case you mess something up. For example

# DATA=/shares/internal#for bluerings
## or
# DATA=/shares/private#for whitelight
# tar -czvf ${DATA}/optware.orig.tar.gz /opt

To restore this backup, just issue:
# rm -rf /opt
# tar -xzvf /shares/internal/optware.orig.tar.gz -C /#for bluerings
## or
# tar -xzvf /shares/private/optware.orig.tar.gz -C /#for whitelight

2. If you upgrade your firmware, all data stored on the root filesystem will be lost, so it is a good idea to move optware to the data partition. Also, you probably should back up the optware init script:

# mv -f /opt ${DATA}
# ln -s ${DATA}/opt /opt
# tar -czvf ${DATA}/opt.init.tar.gz /etc/init.d/optware.sh /etc/init.d/S90optware /etc/init.d/K01optware

After a firmware upgrade you'll just have to do this to restore all you optware hacks:
(don't forget to set DATA variable according to what MBWE edition you have)
# rm -rf /opt
# ln -s ${DATA}/opt /opt
# tar -xzvf ${DATA}/opt.init.tar.gz -C /
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License