blob: b58dfbd3118eb67243a95bfb24a0624d550c6ad5 (
plain) (
tree)
|
|
# -*- shell-script -*-
mount-element () {
asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" ELEMENT_DIR=~/.var/element sh -ec '
device="$(losetup --show -f -P "${ELEMENT_DIR}/ElementCrypt.img")"
printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/ElementCrypt"
gpg --decrypt "${ELEMENT_DIR}/ElementCrypt.key" | cryptsetup -d - open "${device}" ElementCrypt
mount /dev/mapper/ElementCrypt "${ELEMENT_DIR}/ElementCrypt.d"
'
}
umount-element () {
asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" ELEMENT_DIR=~/.var/element sh -c '
umount "${ELEMENT_DIR}/ElementCrypt.d"
cryptsetup close ElementCrypt
losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/ElementCrypt")"
'
}
|