Code:
#!/bin/bash
# Make root file system writable
mntroot rw
# Change to the /opt directory
cd /opt
# Set the Optware feed URL
feed="http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable"
# Download the ipkg-opt package
wget "${feed}/ipkg-opt_0.99.163-10_arm.ipk"
# Extract the ipkg-opt package
tar -xOvzf ipkg-opt_0.99.163-10_arm.ipk ./data.tar.gz | tar -C / -xzvf -
# Create the ipkg directory
mkdir -p /opt/etc/ipkg
# Configure the Optware feed
echo "src cross $feed" > /opt/etc/ipkg/feeds.conf
# Update the package manager
export PATH=$PATH:/opt/bin
ipkg update
# Make root file system read-only
mntroot ro