From 60203948cfc5a343dec3c3766209d4dafce0805e Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 15 Jan 2018 01:34:29 +0100 Subject: Init crypted mount scripts --- cumount.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 cumount.sh (limited to 'cumount.sh') diff --git a/cumount.sh b/cumount.sh new file mode 100755 index 0000000..3a45c06 --- /dev/null +++ b/cumount.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +if [ -z "$1" ] ; then + echo 'Need a name to umount' + exit 1 +fi + +name="${1}" + +mountpoint=$(lsblk -lo NAME,MOUNTPOINT | grep "${1}" | tr -s ' ' | cut -d' ' -f 2) + +if [ -z "${mountpoint}" ] ; then + echo "${name} not found" + exit 1 +fi + +if sudo umount "${mountpoint}" ; then + if sudo cryptsetup luksClose "${name}" ; then + echo 'Finish' + else + echo "Error : ${name} can't be closed" + exit 2 + fi +else + echo "Error : ${mountpoint} can't be umounted" + exit 3 +fi + + + + + -- cgit v1.2.3