summaryrefslogtreecommitdiff
path: root/packages/nslu2-binary-only/unslung-rootfs/rc.bootdisk
diff options
context:
space:
mode:
authorMike Westerhof <mwester@dls.net>2006-11-11 07:12:54 +0000
committerMike Westerhof <mwester@dls.net>2006-11-11 07:12:54 +0000
commit2498ea82a3a37cf46a8063bd712b9cda49645534 (patch)
treecacaeb1a46f87515304968c756d1280d727b28a1 /packages/nslu2-binary-only/unslung-rootfs/rc.bootdisk
parent3d95f2b6df01d65fe26857c57e638b8480668c53 (diff)
Unslung: major change - Linksys busybox now subsumed by slingbox; cpio and find
are no longer required; rc.bootdisk functionality introduced in unslung-rootfs
Diffstat (limited to 'packages/nslu2-binary-only/unslung-rootfs/rc.bootdisk')
-rwxr-xr-xpackages/nslu2-binary-only/unslung-rootfs/rc.bootdisk41
1 files changed, 41 insertions, 0 deletions
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