summaryrefslogtreecommitdiff
path: root/packages/nslu2-binary-only/unslung-rootfs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/nslu2-binary-only/unslung-rootfs')
-rw-r--r--packages/nslu2-binary-only/unslung-rootfs/NOTES7
-rw-r--r--packages/nslu2-binary-only/unslung-rootfs/rc.1-diversion.patch2
-rwxr-xr-xpackages/nslu2-binary-only/unslung-rootfs/rc.bootdisk41
-rw-r--r--packages/nslu2-binary-only/unslung-rootfs/rc.lan-shell.patch7
-rwxr-xr-xpackages/nslu2-binary-only/unslung-rootfs/unsling112
5 files changed, 128 insertions, 41 deletions
diff --git a/packages/nslu2-binary-only/unslung-rootfs/NOTES b/packages/nslu2-binary-only/unslung-rootfs/NOTES
index de4d8b00bf..34d319d656 100644
--- a/packages/nslu2-binary-only/unslung-rootfs/NOTES
+++ b/packages/nslu2-binary-only/unslung-rootfs/NOTES
@@ -546,3 +546,10 @@ maintenance; easier than plugging and unplugging disks.
Empty the /etc/win_share.info file on boot (fixes problem with multiple
identical shares appearing on a system).
+
+Upgraded slingbox to v1.2.2 busybox base; enabled fdisk.
+
+Replaced Linksys busybox with slingbox entirely.
+
+Modified "unsling" script to use tar instead of find and cpio; removed
+obsolete and untested unsling utilities (eg: resling).
diff --git a/packages/nslu2-binary-only/unslung-rootfs/rc.1-diversion.patch b/packages/nslu2-binary-only/unslung-rootfs/rc.1-diversion.patch
index 35015d6c82..d0d769931c 100644
--- a/packages/nslu2-binary-only/unslung-rootfs/rc.1-diversion.patch
+++ b/packages/nslu2-binary-only/unslung-rootfs/rc.1-diversion.patch
@@ -13,7 +13,7 @@
/bin/echo "Starting Rest Task :"; . /etc/rc.d/rc.local
+/bin/echo "Starting Optware Packages:"; ( . /etc/rc.d/rc.optware-start )
-+
++/bin/echo "Starting Bootdisk scripts:"; ( . /etc/rc.d/rc.bootdisk )
/usr/bin/Set_Led ready
/usr/bin/Set_Led beep1
/bin/echo "Checking disk status :"; /usr/sbin/CheckDiskFull 2 >/dev/null
diff --git a/packages/nslu2-binary-only/unslung-rootfs/rc.bootdisk b/packages/nslu2-binary-only/unslung-rootfs/rc.bootdisk
new file mode 100755
index 0000000000..3055c1a6c4
--- /dev/null
+++ b/packages/nslu2-binary-only/unslung-rootfs/rc.bootdisk
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# If we're not booting from flash, exit.
+i=`grep "/dev/root / jffs2" /proc/mounts`
+if ( [ -z "$i" ] ) ; then return 0 ; fi
+
+# Establish our identity
+linksys_hostname=`grep "^default_server_name=" /etc/CGI_ds.conf | sed s/default_server_name=//`
+real_hostname=`hostname`
+echo "====> linksys_hostname is $linksys_hostname"
+echo "====> real_hostname is $real_hostname"
+
+# but don't duplicate
+if ( [ "$linksys_hostname" = `hostname` ] ) ; then linksys_hostname= ; fi
+if ( [ "$real_hostname" = "unslung" ] ) ; then real_hostname= ; fi
+
+# Search all FAT/NTFS filesystem in order.
+# (heavily borrowed from the rc.start-optware script).
+for i in /share/*/data/HDD_* ; do
+ if ( [ "$i" = '/share/*/data/HDD_*' ] ) ; then break ; fi
+ echo "====> searching $i..."
+ for j in $linksys_hostname $real_hostname "unslung" ; do
+ echo "====> checking $i/bootdisk/$j ..."
+ if ( [ -d "$i"/bootdisk/"$j" ] ) ; then
+ for k in "$i"/bootdisk/"$j"/S??* ; do
+ echo "====> found $k ..."
+ [ ! -f "$k" ] && continue
+ nocopy=`grep "^#unslung-nocopy" "$k"`
+ if ( [ -z "$nocopy" ] ) ; then
+ echo "====> running copy: /tmp/tmpscript $k $i"
+ dos2unix -u <"$k" >/tmp/tmpscript
+ /bin/sh /tmp/tmpscript "$k" "$i"
+ rm -f /tmp/tmpscript
+ else
+ echo "====> running in-place $k $k $i"
+ /bin/sh "$k" "$k" "$i"
+ fi
+ done
+ fi
+ done
+done
diff --git a/packages/nslu2-binary-only/unslung-rootfs/rc.lan-shell.patch b/packages/nslu2-binary-only/unslung-rootfs/rc.lan-shell.patch
new file mode 100644
index 0000000000..5d25788fdf
--- /dev/null
+++ b/packages/nslu2-binary-only/unslung-rootfs/rc.lan-shell.patch
@@ -0,0 +1,7 @@
+--- nslu2-linksys-ramdisk-2.3r63/etc/rc.d/rc.lan.orig 2006-11-10 20:07:27.000000000 -0600
++++ nslu2-linksys-ramdisk-2.3r63/etc/rc.d/rc.lan 2006-11-10 20:07:35.000000000 -0600
+@@ -1,3 +1,3 @@
+-#!/bin/bash
++#!/bin/sh
+ #echo "set network driver to operate in auto-sense mode"
+ #/sbin/insmod /lib/modules/sk98lin.o
diff --git a/packages/nslu2-binary-only/unslung-rootfs/unsling b/packages/nslu2-binary-only/unslung-rootfs/unsling
index 400c7d0ad2..79584df8b7 100755
--- a/packages/nslu2-binary-only/unslung-rootfs/unsling
+++ b/packages/nslu2-binary-only/unslung-rootfs/unsling
@@ -36,6 +36,9 @@ else
exit 1
fi
+# MJW - The new "tar" method of unslinging does not care if the device
+# has already been unslung. The following test has been removed.
+#
# Check that we can unsling at all! An unsling operation creates a new
# rootfs, but it also marks the flash rootfs (with a flag file such as
# ".sda1root") so that subsequent boots do not create the "var.state"
@@ -45,39 +48,39 @@ fi
# making sure that we are in a state in which we are capable of
# performing the unsling operation.
-echo "Checking if able to unsling..."
-echo
-m1="/dev/root /dev.state jffs2 rw 0 0"
-m2="/dev/root /var.state jffs2 rw 0 0"
-if ! grep "$m1" /proc/mounts >/dev/null 2>&1 || ! grep "$m2" /proc/mounts >/dev/null 2>&1 ; then
- echo "Error: This system is unable to properly unsling because certain"
- echo "required mounts (dev.state and/or var.state) are not available."
- echo "This is most probably because you have already unslung this system."
- echo
-
- if [ -f /.sda1root ] ; then
- rm -f /.sda1root
- elif [ -f /.sdb1root ] ; then
- rm -f /.sdb1root
- elif [ -f /.sda2root ] ; then
- rm -f /.sda2root
- elif [ -f /.sdb2root ] ; then
- rm -f /.sdb2root
- else
- echo "However, in this case, the flags that indicate an already-unslung"
- echo "system seem to be missing. Try restarting your NSLU2 to correct,"
- echo "but if the problem persists, try re-flashing your NSLU2."
- exit 1
- fi
- echo "The flags that indicate an already-unslung system have now been"
- echo "removed and the required mounts should now become present after"
- echo "reboot of the NSLU2."
- echo
- echo "1) Please unplug all drives from the NSLU2,"
- echo "2) reboot,"
- echo "3) and retry the unslinging process."
- exit 1
-fi
+#echo "Checking if able to unsling..."
+#echo
+#m1="/dev/root /dev.state jffs2 rw 0 0"
+#m2="/dev/root /var.state jffs2 rw 0 0"
+#if ! grep "$m1" /proc/mounts >/dev/null 2>&1 || ! grep "$m2" /proc/mounts >/dev/null 2>&1 ; then
+# echo "Error: This system is unable to properly unsling because certain"
+# echo "required mounts (dev.state and/or var.state) are not available."
+# echo "This is most probably because you have already unslung this system."
+# echo
+#
+# if [ -f /.sda1root ] ; then
+# rm -f /.sda1root
+# elif [ -f /.sdb1root ] ; then
+# rm -f /.sdb1root
+# elif [ -f /.sda2root ] ; then
+# rm -f /.sda2root
+# elif [ -f /.sdb2root ] ; then
+# rm -f /.sdb2root
+# else
+# echo "However, in this case, the flags that indicate an already-unslung"
+# echo "system seem to be missing. Try restarting your NSLU2 to correct,"
+# echo "but if the problem persists, try re-flashing your NSLU2."
+# exit 1
+# fi
+# echo "The flags that indicate an already-unslung system have now been"
+# echo "removed and the required mounts should now become present after"
+# echo "reboot of the NSLU2."
+# echo
+# echo "1) Please unplug all drives from the NSLU2,"
+# echo "2) reboot,"
+# echo "3) and retry the unslinging process."
+# exit 1
+#fi
# Check it's a real mount point
@@ -138,8 +141,16 @@ if [ "$nopw" -eq 0 ] ; then
echo "Error setting password."
exit 1
fi
+# Quick sanity check, something may have gone wrong while we were
+# waiting at the passwd prompt...
+ if ! [ -d $targ/public ] || ! [ -f $targconf/.dongle ] || ! [ -f $targconf/passwd ] ; then
+ echo
+ echo "Error: $targ appears to have vanished into thin air."
+ echo "This would indicate some type of problem with the USB cable,"
+ echo "the device, or the formatting of the device."
+ exit 1
+ fi
cp /etc/passwd /usr/local/passwd
-# cp /etc/passwd $targconf/passwd
grep "^root:" /etc/passwd >$targconf/passwd.new
grep -v "^root:" $targconf/passwd >>$targconf/passwd.new
mv $targconf/passwd $targconf/passwd.save
@@ -161,10 +172,28 @@ fi
# Copy the complete rootfs to the target.
echo
-echo "Copying the complete rootfs from / to $targ ..."
-/usr/bin/find / -xdev -print | /usr/bin/cpio -p -d -m -u $targ
-rm -rf $targ/dev ; mv $targ/dev.state $targ/dev
-rm -rf $targ/var ; mv $targ/var.state $targ/var
+echo "Copying the complete rootfs from / to $targ ... "
+echo " (this will take just a couple of minutes)"
+# Quick sanity check to avoid filling the flash...
+if ! [ -d $targ/public ] || ! [ -f $targconf/.dongle ] || ! [ -f $targconf/passwd ] ; then
+ echo
+ echo "Error: $targ appears to have vanished into thin air."
+ echo "This would indicate some type of problem with the USB cable,"
+ echo "the device, or the formatting of the device."
+ exit 1
+fi
+# /usr/bin/find / -xdev -print | /usr/bin/cpio -p -d -m -u $targ
+# rm -rf $targ/dev ; mv $targ/dev.state $targ/dev
+# rm -rf $targ/var ; mv $targ/var.state $targ/var
+echo "./var/tmp" > /tmp/xfile
+echo "./dev.state" >> /tmp/xfile
+echo "./var.state" >> /tmp/xfile
+mkdir -p /tmp/tmprootfs
+/bin/mount /dev/mtdblock4 /tmp/tmprootfs
+/bin/tar -c -C /tmp/tmprootfs -X /tmp/xfile -f - . | (cd $targ; /bin/tar -x -f -)
+/bin/umount /tmp/tmprootfs
+echo "Copy complete ..."
+echo
# Copy over the existing ipkg database.
@@ -191,6 +220,8 @@ touch $targ/var/log/wtmp
chmod 644 $targ/var/log/wtmp
touch $targ/var/run/utmp
chmod 644 $targ/var/run/utmp
+mkdir -p $targ/var/tmp
+chmod 777 $targ/var/tmp
# The "user password" Linksys utility is hard-coded to /share/hdd; also the
# QuickSet utility seems to have some difficulty as well. Ugly fix is to
@@ -227,7 +258,8 @@ echo > $targ/$flag
echo
echo "Unsling complete."
echo
-echo "Leave the device $htmlinfo plugged in, and reboot"
-echo "in order to boot this system up into unslung mode."
+echo "Leave the device $htmlinfo, plugged in and reboot (using"
+echo "either the Web GUI, or the command \"DO_Reboot\") in order to boot"
+echo "this system up into unslung mode."
exit 0