diff options
Diffstat (limited to 'packages/nslu2-binary-only/unslung-rootfs/unsling')
-rw-r--r-- | packages/nslu2-binary-only/unslung-rootfs/unsling | 106 |
1 files changed, 19 insertions, 87 deletions
diff --git a/packages/nslu2-binary-only/unslung-rootfs/unsling b/packages/nslu2-binary-only/unslung-rootfs/unsling index 6e5a5ef8c3..b784378812 100644 --- a/packages/nslu2-binary-only/unslung-rootfs/unsling +++ b/packages/nslu2-binary-only/unslung-rootfs/unsling @@ -12,40 +12,22 @@ fi if [ $# -eq 1 ] ; 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 elif [ "$1" = "hdd-data" ] ; then targ=/share/hdd/data - copy=true flag=.sda1root elif [ "$1" = "hdd-conf" ] ; then targ=/share/hdd/conf - copy=true flag=.sda2root elif [ "$1" = "flash-data" ] ; then targ=/share/flash/data - 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-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 @@ -68,86 +50,36 @@ fi cd / -if [ -z "$copy" ] ; then +# Save the existing ipkg database. - # Ensure /opt is there. - - if [ ! -d $targ/opt ] ; then - echo "Creating new /opt directory on target disk." - mkdir -p $targ/opt - else - echo "Preserving existing /opt directory on target disk." - fi - - if [ -d /opt -a ! -h /opt ] ; then - echo "Copying existing /opt directory from root disk to target disk." - tar cf - opt | ( cd $targ ; tar xf - ) - mv /opt /opt.old - fi - - echo "Linking /opt directory from target disk to root disk." - rm -f /opt ; ln -s $targ/opt /opt - - # Ensure /usr/lib/ipkg is there. - - if [ ! -d $targ/usr/lib/ipkg ] ; then - echo "Creating new /usr/lib/ipkg directory on target disk." - mkdir -p $targ/usr/lib/ipkg - fi - - if [ ! -f $targ/usr/lib/ipkg/status -a -d /usr/lib/ipkg -a ! -h /usr/lib/ipkg ] ; then - echo "Copying existing /usr/lib/ipkg directory from root disk to target disk." - tar cf - usr/lib/ipkg | ( cd $targ ; tar xf - ) - else - echo "Preserving existing ipkg database on target disk." - fi - - if [ -d /usr/lib/ipkg -a ! -h /usr/lib/ipkg ] ; then - echo "Saving /usr/lib/ipkg directory on root disk in /usr/lib/ipkg.old" - rm -rf /usr/lib/ipkg.old - mv /usr/lib/ipkg /usr/lib/ipkg.old - fi - - echo "Linking /usr/lib/ipkg directory from target disk to root disk." - rm -f /usr/lib/ipkg ; ln -s $targ/usr/lib/ipkg /usr/lib/ipkg - - echo "Linking /usr/bin/ipkg executable on root disk." - rm -f /usr/bin/ipkg ; ln -s /usr/bin/ipkg-cl /usr/bin/ipkg - -else - - # Save the existing ipkg database. - - rm -rf $targ/usr/lib/ipkg.old - if [ -f $targ/usr/lib/ipkg/status ] ; then +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 +fi - # Copy the complete rootfs to the target. +# 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 +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. +# Copy over the existing ipkg database. - if [ -f $targ/usr/lib/ipkg.old/status ] ; then +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 +fi - # Create the boot flag file. +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 - rm -f /.sd??root $targ/.sd??root /.ramdisk $targ/.ramdisk +# Create the boot flag file. - echo "Creating /$flag to direct switchbox to boot from $targ." - echo > /$flag - echo > $targ/$flag +rm -f /.sd??root $targ/.sd??root -fi +echo "Creating /$flag to direct switchbox to boot from $targ." +echo > /$flag +echo > $targ/$flag exit 0 |