From aaf997b46057b6d3407056083edd76b56d98880e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 14 Feb 2012 16:22:35 -0500 Subject: [PATCH] add umount-tree helper --- .bin/umount-tree | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 .bin/umount-tree diff --git a/.bin/umount-tree b/.bin/umount-tree new file mode 100755 index 0000000..bcf866f --- /dev/null +++ b/.bin/umount-tree @@ -0,0 +1,22 @@ +#!/bin/bash + +root=$1 +if [[ -z $1 ]] ; then + echo "Usage: $0 " + exit 1 +fi + +mounts=$(mount | grep " on ${root%/}/" | awk '{print $3}' | tac) +if [[ -z ${mounts} ]] ; then + echo "No mounts found ..." + echo + mount + exit 0 +fi + +echo "Unmounting: " +printf '\t%s\n' ${mounts} + +printf "OK? [y/N] " +read v +[[ ${v} == "y" ]] && sudo umount -v ${mounts} -- 2.39.2