diff options
author | Mattias Andrée <maandree@kth.se> | 2021-06-25 14:33:06 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-06-25 14:33:06 +0200 |
commit | 564263512e6425ae68ef431350edcfde8a3f1075 (patch) | |
tree | 2e483266b85a032d7425ec838dd7ac0283dd19c5 /signal-desktop/bash-aliases | |
parent | First commit (diff) | |
download | dotfiles-564263512e6425ae68ef431350edcfde8a3f1075.tar.gz dotfiles-564263512e6425ae68ef431350edcfde8a3f1075.tar.bz2 dotfiles-564263512e6425ae68ef431350edcfde8a3f1075.tar.xz |
Use asroot instead of sudo and add emacs configs
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | signal-desktop/bash-aliases | 19 |
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")" + ' } |