Mercurial > repos > other > usr-local-bin
view umount-crypt @ 34:fb4dd1974129
Ensure fixed ordering of values
Also ensures we don't get ACPI readings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 27 Feb 2021 15:57:09 +0000 |
parents | 14e726efe9b0 |
children |
line wrap: on
line source
#! /bin/bash if [ $# -ne 1 ]; then echo "Usage: $0 <filename>" >&2 exit 1 fi if [ ! -d "$1" ]; then echo "Directory doesn't exist" >&2 exit 2 fi ARG=${1%/} LOOP_DEV=${ARG##*/} if [ ! -d "/media/$LOOP_DEV" -o ! -b "/dev/mapper/$LOOP_DEV" ]; then echo "Not a crypto loop" >&2 exit 3 fi su -c "umount \"/media/$LOOP_DEV\" && rmdir \"/media/$LOOP_DEV\" && cryptsetup luksClose \"/dev/mapper/$LOOP_DEV\" && losetup -d \"/dev/$LOOP_DEV\""