lock encrypted device after mount fail, _then_ abort
This commit is contained in:
parent
c7238bec91
commit
fe314c0857
1 changed files with 6 additions and 2 deletions
8
gpgtool
8
gpgtool
|
@ -45,7 +45,7 @@ init () {
|
|||
if [[ ! -z "${dev}" ]] && udisksctl info -b ${dev} | grep -q org.freedesktop.UDisks2.Encrypted; then
|
||||
echo "Unlocking device ${dev} …"
|
||||
local mountdev=$(udisksctl unlock -b "${dev}")
|
||||
[[ $? != 0 ]] && echo "Error unlocking device ${dev}." && exit 1
|
||||
[[ $? != 0 ]] && echo "Error unlocking device ${dev}, aborting …" && exit 1
|
||||
|
||||
mountdev="$(echo $mountdev | awk '{ print $4 }')"
|
||||
mountdev=${mountdev:0:-1}
|
||||
|
@ -56,7 +56,11 @@ init () {
|
|||
if [[ ! -z ${mountdev} ]]; then
|
||||
echo "Mounting device ${mountdev} …"
|
||||
mountpath=$(udisksctl mount -b "${mountdev}")
|
||||
[[ $? != 0 ]] && echo "Error mounting device ${mount}." && exit 1
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error mounting device ${mount}, aborting …"
|
||||
[[ "${mountdev}" != "${dev}" ]] && udisksctl lock -b ${dev}
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mountpath="$(echo $mountpath | awk '{ print $4 }')"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue