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 | |
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 'signal-desktop')
-rw-r--r-- | signal-desktop/Makefile | 3 | ||||
-rw-r--r-- | signal-desktop/bash-aliases | 19 |
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")" + ' } |