Inspired mostly from the Bootstrap DS215j blog post
# Create a directory that won't get nuked during DSM security updates
mkdir /volume1/@optware
cd /volume1/@optware
# Download & configure ipkg
feed=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable
ipkg_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'`
wget $feed/$ipkg_name
tar -xOvzf $ipkg_name ./data.tar.gz | tar -C / -xzvf -
mkdir -p /opt/etc/ipkg
echo "src cross $feed" > /opt/etc/ipkg/feeds.conf
# Move the extracted /opt files to our persistent optware directory & symlink /opt
mv /opt/* /volume1/@optware/
rm -r /opt
ln -s /volume1/@optware /opt
# Make ipkg available immediately to root
export PATH=/opt/sbin:/opt/bin:$PATH
mkdir -p /usr/local/etc/rc.d/
wget -O /usr/local/etc/rc.d/optware.sh https://gist.githubusercontent.com/stevenhaddox/cead26111aea3fdcc9a5/raw/optware.sh
chmod 755 /usr/local/etc/rc.d/optware.sh
ipkg install sudo
visudo
# Add the following line to visudo
# %wheel ALL=(ALL) ALL
%administrators ALL=(ALL) ALL