aboutsummaryrefslogtreecommitdiffstats
path: root/signal-desktop
diff options
context:
space:
mode:
Diffstat (limited to 'signal-desktop')
-rw-r--r--signal-desktop/Makefile3
-rw-r--r--signal-desktop/bash-aliases19
2 files changed, 14 insertions, 8 deletions
diff --git a/signal-desktop/Makefile b/signal-desktop/Makefile
index 1d82c40..b3cfa61 100644
--- a/signal-desktop/Makefile
+++ b/signal-desktop/Makefile
@@ -1,6 +1,9 @@
.POSIX:
install:
+ pacman -Qq -- asroot </dev/null >/dev/null
+ pacman -Qq -- gnupg </dev/null >/dev/null
+ pacman -Qq -- cryptsetup </dev/null >/dev/null
mkdir -p -- ~/.config/bash/aliases.d
test ! -d ~/.config/bash/aliases.d/signal-desktop
ln -sf -- ~/.dotfiles/signal-desktop/bash-aliases ~/.config/bash/aliases.d/signal-desktop
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")"
+ '
}