diff options
author | Rod Whitby <rod@whitby.id.au> | 2005-08-11 10:14:41 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-08-11 10:14:41 +0000 |
commit | 0654a007425b7b7b4d7646bd5cc2edeb1375d622 (patch) | |
tree | f476d1a9f4097abcdf7145e46136d3e500d5dfe9 /packages/nslu2-binary-only/unslung-rootfs-2.3r63/unsling | |
parent | 5db530540a094f96b52245c5896ef40009e6db6b (diff) |
Added unslung-binary-kernel.conf distro for NSLU2 Linksys V2.3R63 firmware with NTFS read/write support.
Diffstat (limited to 'packages/nslu2-binary-only/unslung-rootfs-2.3r63/unsling')
-rwxr-xr-x | packages/nslu2-binary-only/unslung-rootfs-2.3r63/unsling | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/packages/nslu2-binary-only/unslung-rootfs-2.3r63/unsling b/packages/nslu2-binary-only/unslung-rootfs-2.3r63/unsling new file mode 100755 index 0000000000..ce2e528c92 --- /dev/null +++ b/packages/nslu2-binary-only/unslung-rootfs-2.3r63/unsling @@ -0,0 +1,73 @@ +#!/bin/sh + +usage="Usage: $0 disk1|disk2" + +# Set target disk + +if [ $# -gt 1 ] ; then + echo $usage + exit 1 +fi + +if [ $# -eq 1 ] ; then + if [ "$1" = "disk1" ] ; then + targ=/share/hdd/data + flag=.sda1root + elif [ "$1" = "disk2" ] ; then + targ=/share/flash/data + flag=.sdb1root + else + echo $usage + exit 1 + fi +else + echo $usage + exit 1 +fi + +# Check it's a real mount point + +if grep $targ /proc/mounts >/dev/null 2>&1 ; then + echo "Target disk is $targ" +else + echo "Error: $targ is not a mounted disk" + exit 1 +fi + +# Start at the root directory + +cd / + +# Save the existing ipkg database. + +rm -rf $targ/usr/lib/ipkg.old +if [ -f $targ/usr/lib/ipkg/status ] ; then + mv $targ/usr/lib/ipkg $targ/usr/lib/ipkg.old +fi + +# Copy the complete rootfs to the target. + +echo "Copying the complete rootfs from / to $targ." +/usr/bin/find / -print0 -mount | /usr/bin/cpio -p -0 -d -m -u $targ +rm -rf $targ/dev ; mv $targ/dev.state $targ/dev +rm -rf $targ/var ; mv $targ/var.state $targ/var + +# Copy over the existing ipkg database. + +if [ -f $targ/usr/lib/ipkg.old/status ] ; then + echo "Preserving existing ipkg database on target disk." + ( cd $targ/usr/lib/ipkg.old ; tar cf - . ) | ( cd $targ/usr/lib/ipkg ; tar xf - ) +fi + +echo "Linking /usr/bin/ipkg executable on target disk." +rm -f $targ/usr/bin/ipkg ; ln -s /usr/bin/ipkg-cl $targ/usr/bin/ipkg + +# Create the boot flag file. + +rm -f /.sd??root $targ/.sd??root + +echo "Creating /$flag to direct switchbox to boot from $targ." +echo > /$flag +echo > $targ/$flag + +exit 0 |