diff options
author | John Bowler <jbowler@nslu2-linux.org> | 2005-07-19 15:03:47 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-07-19 15:03:47 +0000 |
commit | b992eedcc577867859d8ae2757a2a06f1b7b6460 (patch) | |
tree | 38e68e27c7c5c0453f7a3483eb076e5c46a3e03f /packages/openslug-init/openslug-init-0.10/reflash | |
parent | a6f5f86d2c6f1ed05ab471bbc719f5365efa1e7a (diff) | |
parent | aa33ec8c089b6e0ed964f3f345e73c6fe9f4ba38 (diff) |
propagate from branch 'org.openembedded.dev' (head a84100b19e514d33f6c1ebe63173f106d9b09026)
to branch 'org.openembedded.nslu2-linux' (head 37a0ff9ee9b45b44e556016ce81b5cba475a2b3f)
Diffstat (limited to 'packages/openslug-init/openslug-init-0.10/reflash')
-rw-r--r-- | packages/openslug-init/openslug-init-0.10/reflash | 54 |
1 files changed, 5 insertions, 49 deletions
diff --git a/packages/openslug-init/openslug-init-0.10/reflash b/packages/openslug-init/openslug-init-0.10/reflash index 504e78f694..bcf51fc606 100644 --- a/packages/openslug-init/openslug-init-0.10/reflash +++ b/packages/openslug-init/openslug-init-0.10/reflash @@ -213,59 +213,15 @@ then exit 1 } fi -# -# find the device number of the flash partition then make sure it isn't -# mounted anywhere. -if test -n "$ffsdev" -then - ffsno="$(devio "<<$ffsdev" prd)" - test -n "$ffsno" -a "$ffsno" -ge 0 || { - echo "reflash: $ffsdev: device number $ffsno is not valid, cannot continue." >&2 - exit 1 - } - # - # Make sure that Flashdisk isn't mounted on / - if test "$(devio "<</etc/init.d/sysconfsetup" prd)" -eq "$ffsno" - then - echo "reflash: $ffsdev is mounted on /, use turnup ram to reflash" >&2 - exit 1 - fi -fi + # # INPUTS OK, ENVIRONMENT OK, UMOUNT ANY EXISTING MOUNT OF THE FLASHDISK # --------------------------------------------------------------------- # This is only required if the device is going to be used if test -n "$ffsdev" then - echo "reflash: umounting any existing mount of $ffsdev" >&2 - # - # check each mount point, do this last first because otherwise nested - # mounts of ffsdev cannot be umounted. - ffs_umount() { - local device mp type options stuff - - read device mp type options stuff - test -z "$device" && return 0 - - # handle following entries first - ffs_umount || return 1 - - # handle this entry - case "$type" in - jffs2) test "$(devio "<<$mp/etc/init.d/sysconfsetup" prd)" -ne "$ffsno" || - umount "$mp" || { - echo "reflash: $mp: unable to umount $ffsdev" >&2 - return 1 - };; - esac - - return 0 - } - # - ffs_umount </proc/mounts || { - echo "reflash: umount $ffsdev from all mount points then re-run reflash" >&2 - exit 1 - } + # -r causes this to fail if the flash device is mounted on / + umountflash -r "$ffsdev" || exit 1 # # Everything is umounted, now remount on a temporary directory. ffsdir="/tmp/flashdisk.$$" @@ -274,7 +230,7 @@ then exit 1 } # - mountflash "$ffsdir" -o ro || { + mountflash "$ffsdev" "$ffsdir" -o ro || { rmdir "$ffsdir" exit 1 } @@ -471,7 +427,7 @@ echo "reflash: restoring saved configuration files" >&2 # /etc/rcS.d/S99finish on first boot (if it does not exist). We need # a timestamp earlier than any files we create so touch it here, this # also acts as a test on the mounted file system -mountflash "$ffsdir" && :>"$ffsdir/etc/.configured" || { +mountflash "$ffsdev" "$ffsdir" && :>"$ffsdir/etc/.configured" || { rmdir "$ffsdir" echo "reflash: mount of new flash root file system failed" >&2 if test -d "$ffsdir/etc" |