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