DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2010-03-23 10:55:41

timezlicer
Member
Registered: 2008-09-02
Posts: 51
Website

fun_plug for optware (auto download+install)

fun_plug: http://www.megaupload.com/?d=1FGH3JFP
usb-storage.ko: http://www.megaupload.com/?d=YW6VSTO3

feedback and comments are welcomed

Code:

#!/bin/sh

cd /
exec >>/mnt/HD_a2/optware.log 2>&1
date

mknod /dev/random c 1 8
mknod -m 0666 /dev/ptmx c 5 2
mkdir /dev/pts
mount -t devpts devpts /dev/pts
chmod 0666 /dev/tty
chmod 1777 /tmp
if ! grep -wq utmp /etc/group; then
    groupadd -g 22 utmp
fi

echo 0 > /proc/sys/net/ipv4/tcp_timestamps
echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
echo 30 > /proc/sys/net/ipv4/tcp_keepalive_intvl
echo 5 > /proc/sys/net/ipv4/tcp_keepalive_probes

for i in `grep sd.1 /proc/swaps | grep -v sda | sed "s= .*=="`; do
    swapoff $i
done

mount -o remount,noatime /
for i in `mount | grep HD_ | sed "s= .*=="`; do
    mount -o remount,noatime $i
done

[ -f /mnt/HD_a2/usb-storage.ko ] && mv -f /mnt/HD_a2/usb-storage.ko /mnt/HD_a4
if [ -f /mnt/HD_a4/usb-storage.ko ] && [ x"`dmesg | grep ^usb.*new.*USB`" != 'x' ]; then
    insmod /mnt/HD_a4/usb-storage.ko

    for i in 0 1 2 3 4 5 6 7 8 9; do
        sleep 1
        USBDEV=`dmesg | grep "Attached SCSI removable disk" | sed "s=.*\[==g" | sed "s=].*==g"`
        if [ x$USBDEV != 'x' ]; then
            USBDEV=/dev/$USBDEV
            swapon -p0 ${USBDEV}2 && swapoff /dev/sda1
            echo n | e2fsck -pv ${USBDEV}1
            mkdir -p /mnt/usb && mount -o noatime ${USBDEV}1 /mnt/usb
            break
        fi
    done
fi

BASE_PATH=/mnt/HD_a4
if [ -d /mnt/usb/opt ]; then
    BASE_PATH=/mnt/usb
fi

ln -s /proc/self/fd /dev
ln -s $BASE_PATH/opt /
ln -s $BASE_PATH/opt/etc/profile /etc
ln -s /opt/bin/coreutils-sort /bin/sort
ln -s /opt/bin/coreutils-dirname /bin/dirname

if [ ! -d $BASE_PATH/opt ]; then
    cd $BASE_PATH
    IPKGOPT=`wget -O- http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/unstable/Packages | grep ipkg-opt | grep Filename | sed s/Filename:\ //g`
    wget -c http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/unstable/$IPKGOPT
    tar -zxOf $IPKGOPT ./data.tar.gz | tar -C$BASE_PATH -zxf -
    echo src cs05q3armel http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/unstable >> /opt/etc/ipkg.conf
    export PATH=/opt/sbin:/opt/bin:/sbin:/bin:/usr/sbin:/usr/bin
    ipkg update
    ipkg install coreutils
    ipkg install bash
    . $BASE_PATH/opt/etc/profile
    ipkg install util-linux-ng
    ipkg install sed
    ipkg install openssh
    cd /
    chmod 777 /mnt/HD_*
    touch /opt/var/run/utmp /opt/var/log/btmp /opt/var/log/lastlog /opt/var/log/wtmp
fi

ln -s /opt/var/run/utmp /var/run
ln -s /opt/var/log/btmp /var/log
ln -s /opt/var/log/lastlog /var/log
ln -s /opt/var/log/wtmp /var/log

echo '/opt/bin/bash' >>/etc/shells

#http://trac.nslu2-linux.org/optware/browser/trunk/sources/ipkg-opt/rc.optware
if [ -d "/opt/etc/init.d" ]; then
    for i in /opt/etc/init.d/S??*; do
        if [ -x "$i" ]; then
            $i start
        fi
    done
fi

echo .......

Last edited by timezlicer (2010-09-04 04:46:14)

Offline

 

#2 2010-04-09 10:57:16

caust1c
Member
Registered: 2010-01-03
Posts: 35

Re: fun_plug for optware (auto download+install)

Looks good, I would like to be able to run some optware packages but I can't use that fun_plug as I am running of a USB drive.  Will try to get optware working in cooperation with my USB fun_plug install!  Thanks for sharing!

Offline

 

#3 2010-04-09 11:15:43

timezlicer
Member
Registered: 2008-09-02
Posts: 51
Website

Re: fun_plug for optware (auto download+install)

thanks! :-)

do you see any necessary or good-to-have improvements?

e.g.
run ipkg update && ipkg upgrade every boot?
run e2fsck if errors is detected in dmesg?

Or is the script is already nice and lean?

Offline

 

#4 2010-04-15 00:01:16

robinson
Member
Registered: 2009-06-20
Posts: 19

Re: fun_plug for optware (auto download+install)

Does this reload the kernel? It would also be slick to have a version that runs off of the USB drive.

edit: I would also be game for just a reloaded kernel of any kind. No reason to use all that precious ram as a ram-drive.

Last edited by robinson (2010-04-15 00:03:34)

Offline

 

#5 2010-04-15 01:27:56

timezlicer
Member
Registered: 2008-09-02
Posts: 51
Website

Re: fun_plug for optware (auto download+install)

no, it does not reload the kernel, i don't have sufficient knowledge for that on DNS-343...
hmmm USB... good idea will try to find time to work on it

robinson wrote:

Does this reload the kernel? It would also be slick to have a version that runs off of the USB drive.

edit: I would also be game for just a reloaded kernel of any kind. No reason to use all that precious ram as a ram-drive.

Offline

 

#6 2010-09-04 04:41:53

timezlicer
Member
Registered: 2008-09-02
Posts: 51
Website

Re: fun_plug for optware (auto download+install)

added support for USB
assumes 1st partition for files and optionally 2nd partition for swap

robinson wrote:

Does this reload the kernel? It would also be slick to have a version that runs off of the USB drive.

edit: I would also be game for just a reloaded kernel of any kind. No reason to use all that precious ram as a ram-drive.

Offline

 

#7 2011-01-16 17:35:53

timezlicer
Member
Registered: 2008-09-02
Posts: 51
Website

Re: fun_plug for optware (auto download+install)

for those who need NTFS support
ntfs.ko is here

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB