Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
optware installation on dlink 323
root@DLink-323:/# /ffp/start/transmission.sh stop
Stopping transmission-daemon
root@DLink-323:/# ps aux
PID USER COMMAND
1 root init
2 root [ksoftirqd/0]
3 root [events/0]
4 root [khelper]
5 root [kthread]
11 root [kblockd/0]
14 root [khubd]
49 root [pdflush]
50 root [pdflush]
52 root [aio/0]
51 root [kswapd0]
189 root [scsi_eh_0]
190 root [scsi_eh_1]
200 root [mtdblockd]
217 root [kcryptd/0]
218 root [kmirrord/0]
229 root [loop0]
1324 root smbd -D
1326 root nmbd -D
1333 root smbd -D
1371 root xmldb -n config
1414 root [md0_raid1]
1441 root [kjournald]
1516 root [kjournald]
1565 root [kjournald]
1584 root chkbutton
1607 root /web/webs
1621 root fancontrol 0
1627 root op_server 3 3 3
1634 root -sh
1673 root check_hotplug
1677 root check_daemon
1755 root atd
1777 root lpd Waiting
1807 root mserver
1808 root apkg
1885 root crond
1974 root /ffp/sbin/telnetd -l /ffp/bin/sh
1989 root /ffp/sbin/sshd
2041 root sshd: root@pts/0
2043 root -sh
2403 root ps aux
root@DLink-323:/# kill 1807
root@DLink-323:/# /ffp/start/optware.sh start
* Installing optware...
* Retrieving http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/ipkg-opt_0.99.163-10_arm.ipk ...
Connecting to ipkg.nslu2-linux.org (140.211.169.161:80)
ipkg-opt_0.99.163-10 100% |****************************************| 74460 00:00:00 ETA
* Linking or Mounting /ffp/opt/optware to /opt ...
Running: mkdir -p /opt
Running: mount --bind /ffp/opt/optware /opt
* Installing /ffp/opt/optware/ipkg-opt_0.99.163-10_arm.ipk ...
./
./opt/
./opt/bin/
./opt/bin/ipkg
./opt/bin/ipkg-opt
./opt/bin/update-alternatives
./opt/etc/
./opt/etc/ipkg.conf
./opt/lib/
./opt/lib/libipkg.so
./opt/lib/libipkg.so.0
./opt/lib/libipkg.so.0.0.0
./opt/share/
./opt/share/ipkg/
./opt/share/ipkg/intercept/
./opt/share/ipkg/intercept/depmod
./opt/share/ipkg/intercept/ldconfig
./opt/share/ipkg/intercept/update-modules
* Adding default feed "src cs08q1armel http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable" to /opt/etc/ipkg.conf
/ffp/start/optware.sh: line 278: /ffp/etc/profile.d//ffp/etc/profile.d/optware.sh: not found
* Installed optware profile at /ffp/etc/profile.d/optware.sh
* Retrieving optware packages currently available:
/opt/bin/ipkg update
/ffp/start/optware.sh: line 278: /opt/bin/ipkg: not found
* Optware packages available for installation:
/opt/bin/ipkg list
* To install an optware package:
/opt/bin/ipkg install <package_name>
Replace <package_name> with package name(s) you want to install. ipkg automatically manages
dependencies. For example, installing rtorrent will automatically install libtorrent.
root@DLink-323:/# ipkg
-sh: ipkg: not found
root@DLink-323:/# Connection to 192.168.1.3 closed.
Vibur:~ adamgriffiths$ ssh nas
root@DLink-323:/mnt/HD_a2/ffp/home/root# ipkg
-sh: ipkg: not found
root@DLink-323:/mnt/HD_a2/ffp/home/root# ls /opt/
/opt/bin/ /opt/etc/ /opt/lib/ /opt/share/
root@DLink-323:/mnt/HD_a2/ffp/home/root# ls /opt/bin/
ipkg ipkg-opt update-alternatives
root@DLink-323:/mnt/HD_a2/ffp/home/root# ls /opt/bin/ -l
-rwxr-xr-x 1 root root 3236 May 15 2010 ipkg
lrwxrwxrwx 1 root root 4 Jan 17 17:36 ipkg-opt -> ipkg
-rwxr-xr-x 1 root root 4248 May 15 2010 update-alternatives
root@DLink-323:/mnt/HD_a2/ffp/home/root# cd /opt/bin/
root@DLink-323:/opt/bin# ./ipkg
-sh: ./ipkg: not found
root@DLink-323:/opt/bin# ./ipkg list
-sh: ./ipkg: not found
root@DLink-323:/opt/bin# ipkg list
-sh: ipkg: not found
root@DLink-323:/opt/bin# ps aux
PID USER COMMAND
1 root init
2 root [ksoftirqd/0]
3 root [events/0]
4 root [khelper]
5 root [kthread]
11 root [kblockd/0]
14 root [khubd]
49 root [pdflush]
50 root [pdflush]
52 root [aio/0]
51 root [kswapd0]
189 root [scsi_eh_0]
190 root [scsi_eh_1]
200 root [mtdblockd]
217 root [kcryptd/0]
218 root [kmirrord/0]
229 root [loop0]
1324 root smbd -D
1326 root nmbd -D
1333 root smbd -D
1371 root xmldb -n config
1414 root [md0_raid1]
1441 root [kjournald]
1516 root [kjournald]
1565 root [kjournald]
1584 root chkbutton
1607 root /web/webs
1621 root fancontrol 0
1627 root op_server 3 3 3
1634 root -sh
1673 root check_hotplug
1677 root check_daemon
1755 root atd
1777 root lpd Waiting
1808 root apkg
1885 root crond
1974 root /ffp/sbin/telnetd -l /ffp/bin/sh
1989 root /ffp/sbin/sshd
2508 root sshd: root@pts/0
2510 root -sh
2617 root ps aux
root@DLink-323:/opt/bin# cd
root@DLink-323:/mnt/HD_a2/ffp/home/root# /ffp/start/optware.sh uninstall
* Uninstalling optware...
* Removing optware profile /ffp/etc/profile.d/optware.sh
* Unmounting and removing optware directory /opt
* Deleting optware directory /ffp/opt/optware
* Changing ffp optware script /ffp/start/optware.sh to not be executable
* To reinstall optware simply make /ffp/start/optware.sh executable and reboot
root@DLink-323:/mnt/HD_a2/ffp/home/root# ls /ffp/start/ -l
-rw-r--r-- 1 root root 52 Oct 25 2008 LOGIN.sh
-rw-r--r-- 1 root root 35 Oct 25 2008 SERVERS.sh
-rw-r--r-- 1 root root 203 Sep 30 2008 inetd.sh
-rw-r--r-- 1 root root 229 Aug 12 03:19 kickwebs.sh
-rw-r--r-- 1 root root 522 Aug 12 03:19 kickwebs_dns320.sh
-rw-r--r-- 1 root root 1624 Aug 12 03:19 lighttpd.sh
-rw-r--r-- 1 root root 267 Apr 15 2008 mediatomb.sh
-rw-r--r-- 1 root root 1468 Apr 16 2008 nfsd.sh
-rw-r--r-- 1 root root 526 Mar 2 2009 ntpd.sh
-rw-r--r-- 1 root root 8688 Jan 17 15:26 optware.sh
-rw-r--r-- 1 root root 160 Apr 16 2008 portmap.sh
-rw-r--r-- 1 root root 1186 Oct 10 07:15 rsyncd.sh
-rwxr-xr-x 1 root root 971 May 20 2009 sshd.sh
-rw-r--r-- 1 root root 383 Sep 30 2008 syslogd.sh
-rwxr-xr-x 1 root root 169 Sep 30 2008 telnetd.sh
-rwxr-xr-x 1 root root 1059 Dec 4 22:05 transmission-cron.sh
-rwxr-x--- 1 root root 1004 Jun 16 2008 transmission.sh
-rw-r--r-- 1 root root 998 Feb 27 2009 unfsd.sh
root@DLink-323:/mnt/HD_a2/ffp/home/root# cat /ffp/start/optware.sh
#!/ffp/bin/sh
# PROVIDE: optware
# BEFORE:
# REQUIRE:
. /ffp/etc/ffp.subr
# Script for ffp 0.5 to automatically install optware's ipkg package manage
# and start any installed optware services.
# 1. Install ffp 0.5 (see http://wiki.dns323.info/howto:ffp)
# 2. Copy this script to /ffp/start/optware.sh and make it executable
# 3. Reboot the NAS
# 4. Check the ffp.log on Volume_1 to see that it installed successfully
#
# Author: TonyT @ http://forum.dsmg600.info/p25180-Yesterday-23:23:10.html
# Modified by Uli Wolf <ffp@wolf-u.li> @ http://wolf-u.li:
# - Copy contents of existing /opt to optware-directory
# - Modified mount-process
# - Slight modification of the installation as we can install to /opt
#
# Installing is only done the first reboot when optware is not installed,
# subsequent reboots only start the installed optware packages by executing
# the scripts in /opt/etc/init.d (which is optware's equivalent of ffp's
# /ffp/start).
#
# Once optware's ipkg is installed you can install optware packages by:
# 1. Telnet/SSH on the NAS
# 2. To retrieve the list of packages that are currently available do:
# 3. $ ipkg update
# 4. To see the list of packages do:
# $ ipkg list
# 5. To install an optware package do:
# $ ipkg install <package_name>
# Replace <package_name> with package name(s) you want to install. ipkg
# automatically manages dependencies. For example, installing rtorrent will
# automatically install libtorrent.
# 6. If you install a package that needs to be started when the NAS is
# rebooted create a <name>.sh file with the commands to start it in
# /opt/etc/init.d and chmod +x. On subsequent reboots /ffp/start/optware.sh
# will execute them in the same way ffp executes the /ffp/start scripts.
#
# To uninstall optware:
# WARNING: This will delete the entire /opt directory which also contains any
# optware packages and configuration files you installed subsequently so be
# sure that is what you want to do!
# 1. Telnet/SSH onto the NAS
# 2. execute:
# $ /ffp/start/opware.sh uninstall
# Uninstalling will:
# 1. Remove the optware ipkg directory it created in /ffp-Directory
# 2. Remove the /opt link it created
# 3. Remove the /ffp/etc/profile.d/optware_profile.sh file it created (this
# gets executed by ffp 0.5 when a new shell is created, it adds /opt/bin
# and /opt/sbin to the path)
# 4. performs a chmod -x /ffp/start/optware.sh so it will no longer execute
#
# To reinstall simply "chmod +x /ffp/start/optware.sh" and reboot again
# (or directly invoke "/ffp/start/optware.sh start").
#
# Known Issues
# 1. Consider setting TMPDIR environment variable in /etc/profile if the
# default /tmp is too small for certain programs installed.
# 2. ipkg currently does not appear to work on the DNS-321 as it requires
# libc.so.0 which is not available in the DNS-321's /lib and the one in
# /ffp/lib appears incompatible and causes a floating point exception.
name="optware"
start_cmd="optware_start"
stop_cmd="optware_stop"
# status_cmd="optware_status"
# Location of optware package
# DNS-323/CH3SNAS:
#OPTWARE_FEED_NAME="dns323"
#OPTWARE_FEED=http://ipkg.nslu2-linux.org/feeds/optware/dns323/cross/unstable
# DNS-320/DNS-321/DNS-325/DNS-343/CH3MNAS/easyStoreNAS:
OPTWARE_FEED_NAME="cs08q1armel"
OPTWARE_FEED=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable
# real path to optware
OPTWARE_PATH=/ffp/opt/optware
# Directory to put profile files that are executed by FFP 0.5
FFP_PROFILE_DIR="/ffp/etc/profile.d"
# The profile file for optware
OPTWARE_PROFILE="$FFP_PROFILE_DIR/optware.sh"
# Use symbolic link rather than mount for the /opt directory.
OPTWARE_USE_SYMBOLIC_LINK="0"
# reverse order of elements in a list
func_reverse_list()
{
_list=
while [ $# -gt 0 ]; do
_list="$1 $_list"
shift
done
echo $_list
}
# Links or Mounts the OPTWAREPATH to /opt
func_optware_createpath()
{
# Move existing /opt away
test -e /opt && mv /opt /opt.bak
if [ $OPTWARE_USE_SYMBOLIC_LINK = "1" ]; then
# create /opt link
echo " Running: ln -snf $OPTWARE_PATH /opt"
ln -snf $OPTWARE_PATH /opt
else
# Mount the /opt directory
echo " Running: mkdir -p /opt"
mkdir -p /opt
echo " Running: mount --bind $OPTWARE_PATH /opt"
mount --bind $OPTWARE_PATH /opt
if [[ $? -ne 0 ]]; then
return 1;
fi
fi
# Did we move the existing /opt? Copy the contents to the new one
test -e /opt.bak && mv /opt.bak/* /opt/ && rm -Rf /opt.bak
# Fixes some issues if scripts are accessing "env"
test -e /usr/bin/ || mkdir -p /usr/bin/
test -e /usr/bin/ && ln -sf /ffp/bin/env /usr/bin/env
}
optware_install()
{
echo "* Installing optware..."
optware_ipkg_name=`wget -qO- $OPTWARE_FEED/Packages | awk '/^Filename: ipkg-opt/ {print $2}'`
if [ ! optware_ipkg_name ]; then
echo "* FAILED: Unable to locate ipkg-opt in $OPTWARE_FEED/Packages"
return 1
fi
mkdir -p $OPTWARE_PATH
cd $OPTWARE_PATH
echo "* Retrieving $OPTWARE_FEED/$optware_ipkg_name ..."
wget $OPTWARE_FEED/$optware_ipkg_name
if [ ! -f $OPTWARE_PATH/$optware_ipkg_name ]; then
echo "* FAILED: Unable to retrieve $OPTWARE_FEED/$optware_ipkg_name"
return 1
fi
echo "* Linking or Mounting $OPTWARE_PATH to /opt ..."
func_optware_createpath
# Unzip and extract the opt directory contained in data.tar.gz
echo "* Installing $OPTWARE_PATH/$optware_ipkg_name ..."
zcat $OPTWARE_PATH/$optware_ipkg_name | tar -xOvf - ./data.tar.gz | zcat | tar -C / -xvf -
if [ ! -d $OPTWARE_PATH/bin ]; then
echo "* FAILED: Unable to unzip $OPTWARE_PATH/$optware_ipkg_name"
return 1
fi
rm $OPTWARE_PATH/$optware_ipkg_name
# Configure as the default feed:
echo "* Adding default feed \"src $OPTWARE_FEED_NAME $OPTWARE_FEED\" to /opt/etc/ipkg.conf"
echo "src $OPTWARE_FEED_NAME $OPTWARE_FEED" >> /opt/etc/ipkg.conf
# Create a profile file that will set PATH to include optware.
# This is executed when a shell is created by ffp 0.5.
if [ -d $FFP_PROFILE_DIR ]; then
cat > $OPTWARE_PROFILE << "profile"
# Profile for optware
# Created automatically by /ffp/start/optware.sh for ffp 0.5
if [ -d "/opt" ]; then
PATH=/opt/bin:$PATH
if [ $(/ffp/bin/id -u) -eq 0 ]; then
PATH=/opt/sbin:$PATH
fi
export PATH
fi
profile
# Make sure it is executable
chmod +x $OPTWARE_PROFILE
# Now load it
$FFP_PROFILE_DIR/$OPTWARE_PROFILE
echo "* Installed optware profile at $OPTWARE_PROFILE"
else
echo "* WARNING: Unable to install optware's profile $OPTWARE_PROFILE"
fi
# List available packages
if [ -x /opt/bin/ipkg ]; then
echo "* Retrieving optware packages currently available:"
echo " /opt/bin/ipkg update"
/opt/bin/ipkg update
echo "* Optware packages available for installation:"
echo " /opt/bin/ipkg list"
echo "* To install an optware package:"
echo " /opt/bin/ipkg install <package_name>"
echo " Replace <package_name> with package name(s) you want to install. ipkg automatically manages"
echo " dependencies. For example, installing rtorrent will automatically install libtorrent."
else
echo "* WARNING: $ipkg_path/opt/bin/ipkg is not executable!"
fi
}
optware_uninstall()
{
echo "* Uninstalling optware..."
if [ -f $OPTWARE_PROFILE ]; then
echo "* Removing optware profile $OPTWARE_PROFILE"
rm -f $OPTWARE_PROFILE
fi
if [ -L /opt ]; then
echo "* Removing optware link /opt"
rm -f /opt
elif [ -d /opt ]; then
echo "* Unmounting and removing optware directory /opt"
umount /opt
rmdir /opt
fi
if [ -d $OPTWARE_PATH ]; then
echo "* Deleting optware directory $OPTWARE_PATH"
rm -rf $OPTWARE_PATH
fi
echo "* Changing ffp optware script $0 to not be executable"
chmod -x $0
echo "* To reinstall optware simply make $0 executable and reboot"
}
optware_start()
{
if [ ! -d $OPTWARE_PATH ]; then
optware_install
else
# Create /opt
func_optware_createpath
fi
if [ -d $OPTWARE_PATH ]; then
# Start all init scripts in /opt/etc/init.d
# executing them in numerical order.
# (Derived from http://trac.nslu2-linux.org/optware/browser/trunk/sources/ipkg-opt/rc.optware )
if [ -d "/opt/etc/init.d" ]; then
for f in /opt/etc/init.d/S??* ; do
if [ -x "$f" ]; then
echo "* $f ..."
$f start
else
echo "* $f inactive"
fi
done
fi
else
echo "* optware not installed"
fi
}
optware_stop()
{
for f in $(func_reverse_list /opt/etc/init.d/S??*); do
if [ -x "$f" ]; then
$f stop
fi
done
if [ -d /opt ]; then
umount /opt
rmdir /opt
fi
}
case "$1" in
uninstall)
optware_uninstall
;;
*)
run_rc_command "$1"
;;
esac
root@DLink-323:/mnt/HD_a2/ffp/home/root#
@adamlwgriffiths

This comment has been minimized.

Copy link
Owner Author

adamlwgriffiths commented Jan 18, 2012

The solution to these problems is listed here under the "Installing Optware" and "Previous optware.sh script" sections.
http://twistedpairdevelopment.wordpress.com/dlink-323-ops-manual/

The issue was the script uses repositories that are not compatible with the DLink-323 (but work on many other DLink NAS).
Editing the file to use the 323 repository instead of the other repositories works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.