diff options
Diffstat (limited to '')
-rw-r--r-- | element-desktop/Makefile | 19 | ||||
-rw-r--r-- | element-desktop/bash-aliases | 18 | ||||
-rw-r--r-- | signal-desktop/Makefile | 4 | ||||
-rw-r--r-- | wire-desktop/Makefile | 19 | ||||
-rw-r--r-- | wire-desktop/bash-aliases | 18 |
5 files changed, 78 insertions, 0 deletions
diff --git a/element-desktop/Makefile b/element-desktop/Makefile new file mode 100644 index 0000000..60aeb57 --- /dev/null +++ b/element-desktop/Makefile @@ -0,0 +1,19 @@ +.POSIX: + +install: + test -f ~/.var/element/ElementCrypt.img + test -f ~/.var/element/ElementCrypt.key + mkdir -p -- ~/.var/element/ElementCrypt.d + test -e ~/.config/Element || ln -s -- ../.var/element/ElementCrypt.d/Element ~/.config/Element + 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/element-desktop + ln -sf -- ~/.dotfiles/element-desktop/bash-aliases ~/.config/bash/aliases.d/element-desktop + +uninstall: + -unlink -- ~/.config/bash/aliases.d/element-desktop + -rmdir -- ~/.config/bash/aliases.d + +.PHONY: install uninstall diff --git a/element-desktop/bash-aliases b/element-desktop/bash-aliases new file mode 100644 index 0000000..b58dfbd --- /dev/null +++ b/element-desktop/bash-aliases @@ -0,0 +1,18 @@ +# -*- shell-script -*- + +mount-element () { + asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" ELEMENT_DIR=~/.var/element sh -ec ' + device="$(losetup --show -f -P "${ELEMENT_DIR}/ElementCrypt.img")" + printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/ElementCrypt" + gpg --decrypt "${ELEMENT_DIR}/ElementCrypt.key" | cryptsetup -d - open "${device}" ElementCrypt + mount /dev/mapper/ElementCrypt "${ELEMENT_DIR}/ElementCrypt.d" + ' +} + +umount-element () { + asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" ELEMENT_DIR=~/.var/element sh -c ' + umount "${ELEMENT_DIR}/ElementCrypt.d" + cryptsetup close ElementCrypt + losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/ElementCrypt")" + ' +} diff --git a/signal-desktop/Makefile b/signal-desktop/Makefile index b3cfa61..9dd157d 100644 --- a/signal-desktop/Makefile +++ b/signal-desktop/Makefile @@ -1,6 +1,10 @@ .POSIX: install: + test -f ~/.var/signal/SignalCrypt.img + test -f ~/.var/signal/SignalCrypt.key + mkdir -p -- ~/.var/signal/SignalCrypt.d + test -e ~/.config/Signal || ln -s -- ../.var/signal/SignalCrypt.d/Signal ~/.config/Signal pacman -Qq -- asroot </dev/null >/dev/null pacman -Qq -- gnupg </dev/null >/dev/null pacman -Qq -- cryptsetup </dev/null >/dev/null diff --git a/wire-desktop/Makefile b/wire-desktop/Makefile new file mode 100644 index 0000000..ee40a34 --- /dev/null +++ b/wire-desktop/Makefile @@ -0,0 +1,19 @@ +.POSIX: + +install: + test -f ~/.var/wire/WireCrypt.img + test -f ~/.var/wire/WireCrypt.key + mkdir -p -- ~/.var/wire/WireCrypt.d + test -e ~/.config/Wire || ln -s -- ../.var/wire/WireCrypt.d/Wire ~/.config/Wire + 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/wire-desktop + ln -sf -- ~/.dotfiles/wire-desktop/bash-aliases ~/.config/bash/aliases.d/wire-desktop + +uninstall: + -unlink -- ~/.config/bash/aliases.d/wire-desktop + -rmdir -- ~/.config/bash/aliases.d + +.PHONY: install uninstall diff --git a/wire-desktop/bash-aliases b/wire-desktop/bash-aliases new file mode 100644 index 0000000..00cd7a1 --- /dev/null +++ b/wire-desktop/bash-aliases @@ -0,0 +1,18 @@ +# -*- shell-script -*- + +mount-wire () { + asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" WIRE_DIR=~/.var/wire sh -ec ' + device="$(losetup --show -f -P "${WIRE_DIR}/WireCrypt.img")" + printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/WireCrypt" + gpg --decrypt "${WIRE_DIR}/WireCrypt.key" | cryptsetup -d - open "${device}" WireCrypt + mount /dev/mapper/WireCrypt "${WIRE_DIR}/WireCrypt.d" + ' +} + +umount-wire () { + asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" WIRE_DIR=~/.var/wire sh -c ' + umount "${WIRE_DIR}/WireCrypt.d" + cryptsetup close WireCrypt + losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/WireCrypt")" + ' +} |