From 564263512e6425ae68ef431350edcfde8a3f1075 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 25 Jun 2021 14:33:06 +0200 Subject: Use asroot instead of sudo and add emacs configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- signal-desktop/bash-aliases | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'signal-desktop/bash-aliases') 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")" + ' } -- cgit v1.2.3-70-g09d2