summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-12-11 12:45:20 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-12-11 12:45:20 +0100
commit0df35eb24a7b7b12eba06eaf3bd17e1b233dc722 (patch)
tree6fca4db1a18076aa84ad36db9c169d55872e9bd1 /src
parent0bbeae5f0f6a295db40b17c3122a0bedd1b90c27 (diff)
target_umountall blend in the UI more + umount everything in correct order
Diffstat (limited to 'src')
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh
index 440c449..6d8401c 100644
--- a/src/core/libs/lib-blockdevices-filesystems.sh
+++ b/src/core/libs/lib-blockdevices-filesystems.sh
@@ -55,15 +55,17 @@ target_special_fs ()
}
-# taken from setup #TODO: we should be able to not need this function
-# Disable swap and all mounted partitions for the destination system. Unmount
-# the destination root partition last! TODO: only taking care of / is not enough, we can have the same problem on another level (eg /a/b/c and /a/b)
+# taken from setup #TODO: we should be able to not need this function. although it may still be useful. but maybe we shouldn't tie it to $var_TARGET_DIR, and let the user specify the base point as $1
+# Disable swap and umount all mounted filesystems for the target system in the correct order. (eg first $var_TARGET_DIR/a/b/c, then $var_TARGET_DIR/a/b, then $var_TARGET_DIR/a until lastly $var_TARGET_DIR
target_umountall()
{
- infofy "Disabling swapspace, unmounting already mounted disk devices..."
+ infofy "Disabling all swapspace..." disks
swapoff -a >/dev/null 2>&1
- umount $(mount | grep -v "${var_TARGET_DIR} " | grep "${var_TARGET_DIR}" | sed 's|\ .*||g') >/dev/null 2>&1
- umount $(mount | grep "${var_TARGET_DIR} " | sed 's|\ .*||g') >/dev/null 2>&1
+ for mountpoint in $(mount | awk "/\/$var_TARGET_DIR/ {print \$3}" | sort | tac )
+ do
+ infofy "Unmounting mountpoint $mountpoint" disks
+ umount $mountpoint >/dev/null 2>$LOG
+ done
}