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