Fixed encrypted partition support
This commit is contained in:
parent
9e2a71d6bd
commit
d9e58a5c3b
1 changed files with 15 additions and 8 deletions
23
tools/qmnt
23
tools/qmnt
|
@ -115,14 +115,15 @@ get_mapped () {
|
||||||
if ! cryptsetup open "${TARGET}" "${MAPPED_NAME}"; then
|
if ! cryptsetup open "${TARGET}" "${MAPPED_NAME}"; then
|
||||||
echo -e "\e[1;31mCould not unlock target \"${TARGET}\"!""\e[0m" 1>&2
|
echo -e "\e[1;31mCould not unlock target \"${TARGET}\"!""\e[0m" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
TARGET="/dev/mapper/${MAPPED_NAME}"
|
|
||||||
|
|
||||||
NEW_LABEL=$(blkid -o value -s LABEL "${TARGET}")
|
|
||||||
[[ -z $NEW_LABEL ]] && LABEL=$NEW_LABEL
|
|
||||||
|
|
||||||
TYPE=$(blkid -o value -s TYPE "${TARGET}")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
TARGET="/dev/mapper/${MAPPED_NAME}"
|
||||||
|
|
||||||
|
trap "cryptsetup close ${TARGET}" EXIT
|
||||||
|
|
||||||
|
[[ ! -z $(blkid -o value -s LABEL "${TARGET}") ]] && LABEL=$(blkid -o value -s LABEL "${TARGET}")
|
||||||
|
|
||||||
|
TYPE=$(blkid -o value -s TYPE "${TARGET}" || true) # Fuck you bash
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "$#" -eq 0 ]]; then
|
if [[ "$#" -eq 0 ]]; then
|
||||||
|
@ -157,6 +158,8 @@ if [[ -z $TARGET ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
MAPPED_NAME=""
|
||||||
|
|
||||||
LABEL=$(blkid -o value -s LABEL "${TARGET}")
|
LABEL=$(blkid -o value -s LABEL "${TARGET}")
|
||||||
[[ -z $LABEL ]] && LABEL=$(basename "${TARGET}")
|
[[ -z $LABEL ]] && LABEL=$(basename "${TARGET}")
|
||||||
|
|
||||||
|
@ -167,6 +170,8 @@ if [[ -z $TYPE ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
trap - EXIT
|
||||||
|
|
||||||
if [[ -z "${DEFAULT_MOUNT_OPTS["$TYPE"]}" ]]; then
|
if [[ -z "${DEFAULT_MOUNT_OPTS["$TYPE"]}" ]]; then
|
||||||
MOUNT_OPTS="${DEFAULT_MOUNT_OPTS["OTHER"]}""${MOUNT_OPTS}"
|
MOUNT_OPTS="${DEFAULT_MOUNT_OPTS["OTHER"]}""${MOUNT_OPTS}"
|
||||||
else
|
else
|
||||||
|
@ -192,7 +197,9 @@ fi
|
||||||
done
|
done
|
||||||
|
|
||||||
rmdir "${1}"
|
rmdir "${1}"
|
||||||
' -- "${MOUNT_FOLDER}/${LABEL}" >/dev/null 2>&1 &
|
|
||||||
|
[ -b /dev/mapper/"${2}" ] && cryptsetup close /dev/mapper/"${2}"
|
||||||
|
' -- "${MOUNT_FOLDER}/${LABEL}" "${MAPPED_NAME}" >/dev/null 2>&1 &
|
||||||
) &
|
) &
|
||||||
|
|
||||||
echo -e "\e[1;32mDevice \"${TARGET}\" successfully mounted at \"${MOUNT_FOLDER}/${LABEL}\"""\e[0m"
|
echo -e "\e[1;32mDevice \"${TARGET}\" successfully mounted at \"${MOUNT_FOLDER}/${LABEL}\"""\e[0m"
|
||||||
|
|
Loading…
Reference in a new issue