summaryrefslogtreecommitdiff
path: root/recipes/nslu2-binary-only/unslung-rootfs/rc.bootdisk
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/nslu2-binary-only/unslung-rootfs/rc.bootdisk
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/nslu2-binary-only/unslung-rootfs/rc.bootdisk')
-rwxr-xr-xrecipes/nslu2-binary-only/unslung-rootfs/rc.bootdisk70
1 files changed, 70 insertions, 0 deletions
diff --git a/recipes/nslu2-binary-only/unslung-rootfs/rc.bootdisk b/recipes/nslu2-binary-only/unslung-rootfs/rc.bootdisk
new file mode 100755
index 0000000000..c83881a333
--- /dev/null
+++ b/recipes/nslu2-binary-only/unslung-rootfs/rc.bootdisk
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# If the nobootdisk flag is set, exit.
+if ( [ -f /.nobootdisk ] ) ; then return 0 ; fi
+
+# 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" = "default" ] ) ; 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 the value of i is the string with the wildcards, no match occurred.
+ if ( [ "$i" = '/share/*/data/HDD_*' ] ) ; then break ; fi
+
+ echo "====> searching $i..."
+
+ # Now check inside directories named for the Linksys hostname, the real
+ # hostname, and finally the name "default"...
+ for j in $linksys_hostname $real_hostname "default" ; do
+
+ echo "====> checking $i/bootdisk/$j ..."
+ if ( [ -d "$i/bootdisk/$j" ] ) ; then
+
+ # We have the correct subdirectory...
+ for k in "$i/bootdisk/$j"/S??* ; do
+
+ # Bail out if no match in that directory
+ if ( [ "$k" = "$i/bootdisk/$j"'/S??*' ] ) ; then break ; fi
+
+ echo "====> found $k ..."
+ [ ! -f "$k" ] && continue
+
+ # Check to see if we need to copy or run in-place..
+ nocopy=`grep "^#bootdisk:nocopy" "$k"`
+ if ( [ -z "$nocopy" ] ) ; then
+
+ # copy and strip the MSDOS-style line endings, then execute.
+ echo "====> running copy: /tmp/tmpscript $k $i"
+ dos2unix -u <"$k" >/tmp/tmpscript
+ /bin/sh /tmp/tmpscript "$k" "$i"
+ rm -f /tmp/tmpscript
+
+ else
+
+ # execute in place
+ echo "====> running in-place $k $k $i"
+ /bin/sh "$k" "$k" "$i"
+
+ fi
+
+ done
+
+ fi
+
+ done
+
+done