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 /bash/aliases-Zenith | |
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 'bash/aliases-Zenith')
-rw-r--r-- | bash/aliases-Zenith | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/bash/aliases-Zenith b/bash/aliases-Zenith index ac794c9..419de1d 100644 --- a/bash/aliases-Zenith +++ b/bash/aliases-Zenith @@ -1,17 +1,20 @@ # -*- shell-script -*- mount-crypt () { - sudo printf '' && \ - device="$(sudo losetup --show -f -P /media/Secondary/.crypt/crypt.img)" && \ - printf '%s\n' "${device}" > "${XDG_RUNTIME_DIR}/CryptCrypt" && \ - gpg --decrypt /media/Secondary/.crypt/crypt.key | sudo cryptsetup -d - open "${device}" CryptCrypt && \ - mkdir -p ~/Crypt && \ - sudo mount /dev/mapper/CryptCrypt ~/Crypt + asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" CRYPT_DIR=~/Crypt sh -ec ' + device="$(losetup --show -f -P /media/Secondary/.crypt/crypt.img)" + printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/CryptCrypt" + gpg --decrypt /media/Secondary/.crypt/crypt.key | cryptsetup -d - open "${device}" CryptCrypt + mkdir -p "${CRYPT_DIR}" + mount /dev/mapper/CryptCrypt "${CRYPT_DIR}" + ' } umount-crypt () { - sudo umount ~/Crypt - rmdir ~/Crypt - sudo cryptsetup close CryptCrypt - sudo losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/CryptCrypt")" + asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" CRYPT_DIR=~/Crypt sh -c ' + umount "${CRYPT_DIR}" + rmdir "${CRYPT_DIR}" + cryptsetup close CryptCrypt + losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/CryptCrypt")" + ' } |