aboutsummaryrefslogtreecommitdiffstats
path: root/signal-desktop/bash-aliases
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--signal-desktop/bash-aliases19
1 files changed, 11 insertions, 8 deletions
diff --git a/signal-desktop/bash-aliases b/signal-desktop/bash-aliases
index 1e76a52..34a23b9 100644
--- a/signal-desktop/bash-aliases
+++ b/signal-desktop/bash-aliases
@@ -1,15 +1,18 @@
# -*- shell-script -*-
mount-signal () {
- sudo printf '' && \
- device="$(sudo losetup --show -f -P ~/.var/signal/SignalCrypt.img)" && \
- printf '%s\n' "${device}" > "${XDG_RUNTIME_DIR}/SignalCrypt" && \
- gpg --decrypt ~/.var/signal/SignalCrypt.key | sudo cryptsetup -d - open "${device}" SignalCrypt && \
- sudo mount /dev/mapper/SignalCrypt /home/mattias/.var/signal/SignalCrypt.d
+ 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"
+ gpg --decrypt "${SIGNAL_DIR}/SignalCrypt.key" | cryptsetup -d - open "${device}" SignalCrypt
+ mount /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d"
+ '
}
umount-signal () {
- sudo umount /home/mattias/.var/signal/SignalCrypt.d
- sudo cryptsetup close SignalCrypt
- sudo losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/SignalCrypt")"
+ 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")"
+ '
}