Ajouter l'option -c à umountr
This commit is contained in:
parent
278bf5a2d0
commit
3d5aeb2be0
21
umountr
21
umountr
|
@ -11,10 +11,18 @@ USAGE
|
|||
|
||||
Démonter tous les systèmes de fichiers qui sont montés en-dessous de mountpoint
|
||||
puis démonter mountpoint. Démonter aussi tous les systèmes de fichiers
|
||||
bind-montés à partir d'un sous-répertoire de mountpoint."
|
||||
bind-montés à partir d'un sous-répertoire de mountpoint.
|
||||
|
||||
OPTION
|
||||
-c, --continuous
|
||||
Continuer même en cas d'erreur"
|
||||
}
|
||||
|
||||
args=(--help '$exit_with display_help')
|
||||
continuous=
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
-c,--continuous continuous=1
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
mountp="$1"
|
||||
|
@ -22,7 +30,7 @@ mountp="$1"
|
|||
[ -d "$mountp" ] || die "$mountp: répertoire introuvable"
|
||||
setx mountp=abspath "$mountp"
|
||||
|
||||
run_as_root "$@"
|
||||
run_as_root ${continuous:+-c} "$@"
|
||||
|
||||
setx -a mountps=findmnt -nlo TARGET
|
||||
array_contains mountps "$mountp" || die "Vous devez spécifier un répertoire de montage valide"
|
||||
|
@ -31,12 +39,17 @@ function show_all() {
|
|||
findmnt -T "$mountp" -Rnlo TARGET
|
||||
findmnt -nlo TARGET | awkrun mountp="$mountp" '{ if (substr($0, 1, length(mountp) + 1) == (mountp "/")) print }'
|
||||
}
|
||||
function die_maybe() {
|
||||
[ -n "$continuous" ] && return
|
||||
die "$@"
|
||||
}
|
||||
|
||||
setx -a mounts=evalp show_all // sort -u // \
|
||||
awk '{print length($0) "," $0}' // \
|
||||
sort -nr // \
|
||||
awk '{sub(/[0-9]+,/, ""); print}'
|
||||
|
||||
for mount in "${mounts[@]}"; do
|
||||
estep "$mount"
|
||||
umount "$mount" || die
|
||||
umount "$mount" || die_maybe
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue