summaryrefslogtreecommitdiff
path: root/packages/nslu2-binary-only/unslung-rootfs-2.3r25/unsling
diff options
context:
space:
mode:
Diffstat (limited to 'packages/nslu2-binary-only/unslung-rootfs-2.3r25/unsling')
-rw-r--r--packages/nslu2-binary-only/unslung-rootfs-2.3r25/unsling46
1 files changed, 35 insertions, 11 deletions
diff --git a/packages/nslu2-binary-only/unslung-rootfs-2.3r25/unsling b/packages/nslu2-binary-only/unslung-rootfs-2.3r25/unsling
index 120143d352..5a5d74d858 100644
--- a/packages/nslu2-binary-only/unslung-rootfs-2.3r25/unsling
+++ b/packages/nslu2-binary-only/unslung-rootfs-2.3r25/unsling
@@ -1,6 +1,6 @@
#!/bin/sh
-usage="Usage: $0 [hdd-data|flash-data|hdd-conf|flash-conf|jffs2-hdd-data|jffs2-flash-data|jffs2-hdd-conf|jffs2-flash-conf]"
+usage="Usage: $0 disk1|disk2"
# Set target disk
@@ -10,7 +10,11 @@ if [ $# -gt 1 ] ; then
fi
if [ $# -eq 1 ] ; then
- if [ "$1" = "flash-data" ] ; then
+ if [ "$1" = "disk1" ] ; then
+ targ=/share/hdd/data
+ copy=true
+ flag=.sda1root
+ elif [ "$1" = "disk2" ] ; then
targ=/share/flash/data
copy=true
flag=.sdb1root
@@ -18,26 +22,30 @@ if [ $# -eq 1 ] ; then
targ=/share/hdd/data
copy=true
flag=.sda1root
- elif [ "$1" = "flash-conf" ] ; then
- targ=/share/flash/conf
- copy=true
- flag=.sdb2root
elif [ "$1" = "hdd-conf" ] ; then
targ=/share/hdd/conf
copy=true
flag=.sda2root
- elif [ "$1" = "jffs2-flash-data" ] ; then
+ elif [ "$1" = "flash-data" ] ; then
targ=/share/flash/data
- copy=
+ copy=true
+ flag=.sdb1root
+ elif [ "$1" = "flash-conf" ] ; then
+ targ=/share/flash/conf
+ copy=true
+ flag=.sdb2root
elif [ "$1" = "jffs2-hdd-data" ] ; then
targ=/share/hdd/data
copy=
- elif [ "$1" = "jffs2-flash-conf" ] ; then
- targ=/share/flash/conf
- copy=
elif [ "$1" = "jffs2-hdd-conf" ] ; then
targ=/share/hdd/conf
copy=
+ elif [ "$1" = "jffs2-flash-data" ] ; then
+ targ=/share/flash/data
+ copy=
+ elif [ "$1" = "jffs2-flash-conf" ] ; then
+ targ=/share/flash/conf
+ copy=
else
echo $usage
exit 1
@@ -105,6 +113,13 @@ if [ -z "$copy" ] ; then
else
+ # 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."
@@ -112,6 +127,15 @@ else
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
+
+ # Create the boot flag file.
+
rm -f /.sd??root $targ/.sd??root
echo "Creating /$flag to direct switchbox to boot from $targ."