blob: 419de1df212cf3eee95e48c9b19b1ae51ec1c9b6 (
plain) (
tree)
|
|
# -*- shell-script -*-
mount-crypt () {
asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" CRYPT_DIR=~/Crypt sh -ec '
device="$(losetup --show -f -P /media/Secondary/.crypt/crypt.img)"
printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/CryptCrypt"
gpg --decrypt /media/Secondary/.crypt/crypt.key | cryptsetup -d - open "${device}" CryptCrypt
mkdir -p "${CRYPT_DIR}"
mount /dev/mapper/CryptCrypt "${CRYPT_DIR}"
'
}
umount-crypt () {
asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" CRYPT_DIR=~/Crypt sh -c '
umount "${CRYPT_DIR}"
rmdir "${CRYPT_DIR}"
cryptsetup close CryptCrypt
losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/CryptCrypt")"
'
}
|