diff options
-rw-r--r-- | element-desktop/Makefile | 19 | ||||
-rw-r--r-- | element-desktop/bash-aliases | 42 | ||||
-rwxr-xr-x | element-desktop/element-desktop | 4 | ||||
-rwxr-xr-x | element-desktop/mount-element | 22 | ||||
-rwxr-xr-x | element-desktop/umount-element | 17 | ||||
-rw-r--r-- | signal-desktop/Makefile | 19 | ||||
-rw-r--r-- | signal-desktop/bash-aliases | 42 | ||||
-rwxr-xr-x | signal-desktop/mount-signal | 22 | ||||
-rwxr-xr-x | signal-desktop/signal-desktop | 4 | ||||
-rwxr-xr-x | signal-desktop/umount-signal | 17 | ||||
-rw-r--r-- | wire-desktop/Makefile | 19 | ||||
-rw-r--r-- | wire-desktop/bash-aliases | 42 | ||||
-rwxr-xr-x | wire-desktop/mount-wire | 22 | ||||
-rwxr-xr-x | wire-desktop/umount-wire | 17 | ||||
-rwxr-xr-x | wire-desktop/wire-desktop | 5 |
15 files changed, 169 insertions, 144 deletions
diff --git a/element-desktop/Makefile b/element-desktop/Makefile index ce7b6d2..acc013c 100644 --- a/element-desktop/Makefile +++ b/element-desktop/Makefile @@ -9,12 +9,19 @@ install: ../check-installed gnupg ../check-installed cryptsetup ../check-installed key2root - mkdir -p -- ~/.config/bash/aliases.d - test ! -e ~/.config/bash/aliases.d/element-desktop || \ - test -L ~/.config/bash/aliases.d/element-desktop - ln -sf -- ~/.dotfiles/element-desktop/bash-aliases ~/.config/bash/aliases.d/element-desktop + ../check-installed-shebang mount-element + ../check-installed-shebang umount-element + ../check-installed-shebang element-desktop + mkdir -p -- ~/.local/bin/ + test ! -e ~/.local/bin/mount-element || test -L ~/.local/bin/mount-element + ln -sf -- ~/.dotfiles/element-desktop/mount-element ~/.local/bin/ + test ! -e ~/.local/bin/umount-element || test -L ~/.local/bin/umount-element + ln -sf -- ~/.dotfiles/element-desktop/umount-element ~/.local/bin/ + test ! -e ~/.local/bin/element-desktop || test -L ~/.local/bin/element-desktop + ln -sf -- ~/.dotfiles/element-desktop/element-desktop ~/.local/bin/ uninstall: +! ../check-installed element-desktop - -unlink -- ~/.config/bash/aliases.d/element-desktop - -rmdir -- ~/.config/bash/aliases.d + -unlink -- ~/.local/bin/mount-element + -unlink -- ~/.local/bin/umount-element + -unlink -- ~/.local/bin/element-desktop diff --git a/element-desktop/bash-aliases b/element-desktop/bash-aliases deleted file mode 100644 index 1a5362b..0000000 --- a/element-desktop/bash-aliases +++ /dev/null @@ -1,42 +0,0 @@ -# -*- shell-script -*- - -mount-element () { - if mountpoint -q -- ~/.var/opt/element/ElementCrypt.d; then - printf '%s\n' 'mount-element: already mounted' >&2 - elif test -e /dev/mapper/ElementCrypt; then - asroot env ELEMENT_DIR=~/.var/opt/element sh -ec \ - 'mount -- /dev/mapper/ElementCrypt "${ELEMENT_DIR}/ElementCrypt.d"' - else - gpg --decrypt ~/.var/opt/element/ElementCrypt.key | \ - key2root -k ElementCrypt env \ - ELEMENT_IMG=~/.var/opt/element/ElementCrypt.img \ - ELEMENT_DIR=~/.var/opt/element \ - ELEMENT_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ - sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/element/ElementCrypt.img)"'$#\1#p' | sed 1q)" \ - sh -ec ' - if test -z "${ELEMENT_DEV}"; then - ELEMENT_DEV="$(losetup --show -f -P "${ELEMENT_IMG}")" - fi - cryptsetup -d - open "${ELEMENT_DEV}" ElementCrypt - mount -- /dev/mapper/ElementCrypt "${ELEMENT_DIR}/ElementCrypt.d" - ' - fi -} - -umount-element () { - asroot env \ - ELEMENT_DIR=~/.var/opt/element \ - ELEMENT_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ - sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/element/ElementCrypt.img)"'$#\1#p' | sed 1q)" \ - sh -c ' - if mountpoint -q -- "${ELEMENT_DIR}/ElementCrypt.d"; then - umount -- "${ELEMENT_DIR}/ElementCrypt.d" - fi - if test -e /dev/mapper/ElementCrypt; then - cryptsetup close ElementCrypt - fi - if test -n "${ELEMENT_DEV}"; then - losetup -d "${ELEMENT_DEV}" - fi - ' -} diff --git a/element-desktop/element-desktop b/element-desktop/element-desktop new file mode 100755 index 0000000..87f1f17 --- /dev/null +++ b/element-desktop/element-desktop @@ -0,0 +1,4 @@ +#!/bin/dash +set -e +mount-element +exec /usr/bin/element-desktop "$@" diff --git a/element-desktop/mount-element b/element-desktop/mount-element new file mode 100755 index 0000000..1d3c03c --- /dev/null +++ b/element-desktop/mount-element @@ -0,0 +1,22 @@ +#!/bin/dash + +if mountpoint -q -- "${HOME}/.var/opt/element/ElementCrypt.d"; then + printf '%s\n' 'mount-element: already mounted' >&2 +elif test -e /dev/mapper/ElementCrypt; then + asroot env ELEMENT_DIR="${HOME}/.var/opt/element" sh -ec \ + 'mount -- /dev/mapper/ElementCrypt "${ELEMENT_DIR}/ElementCrypt.d"' +else + gpg --decrypt -- "${HOME}/.var/opt/element/ElementCrypt.key" | \ + key2root -k ElementCrypt env \ + ELEMENT_IMG="${HOME}/.var/opt/element/ElementCrypt.img" \ + ELEMENT_DIR="${HOME}/.var/opt/element" \ + ELEMENT_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- "${HOME}/.var/opt/element/ElementCrypt.img")"'$#\1#p' | sed 1q)" \ + sh -ec ' + if test -z "${ELEMENT_DEV}"; then + ELEMENT_DEV="$(losetup --show -f -P -- "${ELEMENT_IMG}")" + fi + cryptsetup -d - -- open "${ELEMENT_DEV}" ElementCrypt + mount -- /dev/mapper/ElementCrypt "${ELEMENT_DIR}/ElementCrypt.d" + ' +fi diff --git a/element-desktop/umount-element b/element-desktop/umount-element new file mode 100755 index 0000000..eb9fbdd --- /dev/null +++ b/element-desktop/umount-element @@ -0,0 +1,17 @@ +#!/bin/dash + +asroot env \ + ELEMENT_DIR="${HOME}/.var/opt/element" \ + ELEMENT_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- "${HOME}/.var/opt/element/ElementCrypt.img")"'$#\1#p' | sed 1q)" \ + sh -c ' + if mountpoint -q -- "${ELEMENT_DIR}/ElementCrypt.d"; then + umount -- "${ELEMENT_DIR}/ElementCrypt.d" + fi + if test -e /dev/mapper/ElementCrypt; then + cryptsetup close ElementCrypt + fi + if test -n "${ELEMENT_DEV}"; then + losetup -d -- "${ELEMENT_DEV}" + fi + ' diff --git a/signal-desktop/Makefile b/signal-desktop/Makefile index ce08e1d..570a254 100644 --- a/signal-desktop/Makefile +++ b/signal-desktop/Makefile @@ -9,12 +9,19 @@ install: ../check-installed gnupg ../check-installed cryptsetup ../check-installed key2root - mkdir -p -- ~/.config/bash/aliases.d - test ! -e ~/.config/bash/aliases.d/signal-desktop || \ - test -L ~/.config/bash/aliases.d/signal-desktop - ln -sf -- ~/.dotfiles/signal-desktop/bash-aliases ~/.config/bash/aliases.d/signal-desktop + ../check-installed-shebang mount-signal + ../check-installed-shebang umount-signal + ../check-installed-shebang signal-desktop + mkdir -p -- ~/.local/bin/ + test ! -e ~/.local/bin/mount-signal || test -L ~/.local/bin/mount-signal + ln -sf -- ~/.dotfiles/signal-desktop/mount-signal ~/.local/bin/ + test ! -e ~/.local/bin/umount-signal || test -L ~/.local/bin/umount-signal + ln -sf -- ~/.dotfiles/signal-desktop/umount-signal ~/.local/bin/ + test ! -e ~/.local/bin/signal-desktop || test -L ~/.local/bin/signal-desktop + ln -sf -- ~/.dotfiles/signal-desktop/signal-desktop ~/.local/bin/ uninstall: +! ../check-installed signal-desktop - -unlink -- ~/.config/bash/aliases.d/signal-desktop - -rmdir -- ~/.config/bash/aliases.d + -unlink -- ~/.local/bin/mount-signal + -unlink -- ~/.local/bin/umount-signal + -unlink -- ~/.local/bin/signal-desktop diff --git a/signal-desktop/bash-aliases b/signal-desktop/bash-aliases deleted file mode 100644 index a50c8f6..0000000 --- a/signal-desktop/bash-aliases +++ /dev/null @@ -1,42 +0,0 @@ -# -*- shell-script -*- - -mount-signal () { - if mountpoint -q -- ~/.var/opt/signal/SignalCrypt.d; then - printf '%s\n' 'mount-signal: already mounted' >&2 - elif test -e /dev/mapper/SignalCrypt; then - asroot env SIGNAL_DIR=~/.var/opt/signal sh -ec \ - 'mount -- /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d"' - else - gpg --decrypt ~/.var/opt/signal/SignalCrypt.key | \ - key2root -k SignalCrypt env \ - SIGNAL_IMG=~/.var/opt/signal/SignalCrypt.img \ - SIGNAL_DIR=~/.var/opt/signal \ - SIGNAL_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ - sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/signal/SignalCrypt.img)"'$#\1#p' | sed 1q)" \ - sh -ec ' - if test -z "${SIGNAL_DEV}"; then - SIGNAL_DEV="$(losetup --show -f -P "${SIGNAL_IMG}")" - fi - cryptsetup -d - open "${SIGNAL_DEV}" SignalCrypt - mount -- /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d" - ' - fi -} - -umount-signal () { - asroot env \ - SIGNAL_DIR=~/.var/opt/signal \ - SIGNAL_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ - sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/signal/SignalCrypt.img)"'$#\1#p' | sed 1q)" \ - sh -c ' - if mountpoint -q -- "${SIGNAL_DIR}/SignalCrypt.d"; then - umount -- "${SIGNAL_DIR}/SignalCrypt.d" - fi - if test -e /dev/mapper/SignalCrypt; then - cryptsetup close SignalCrypt - fi - if test -n "${SIGNAL_DEV}"; then - losetup -d "${SIGNAL_DEV}" - fi - ' -} diff --git a/signal-desktop/mount-signal b/signal-desktop/mount-signal new file mode 100755 index 0000000..6754d0f --- /dev/null +++ b/signal-desktop/mount-signal @@ -0,0 +1,22 @@ +#!/bin/dash + +if mountpoint -q -- "${HOME}/.var/opt/signal/SignalCrypt.d"; then + printf '%s\n' 'mount-signal: already mounted' >&2 +elif test -e /dev/mapper/SignalCrypt; then + asroot env SIGNAL_DIR="${HOME}/.var/opt/signal" sh -ec \ + 'mount -- /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d"' +else + gpg --decrypt -- "${HOME}/.var/opt/signal/SignalCrypt.key" | \ + key2root -k SignalCrypt env \ + SIGNAL_IMG="${HOME}/.var/opt/signal/SignalCrypt.img" \ + SIGNAL_DIR="${HOME}/.var/opt/signal" \ + SIGNAL_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- "${HOME}/.var/opt/signal/SignalCrypt.img")"'$#\1#p' | sed 1q)" \ + sh -ec ' + if test -z "${SIGNAL_DEV}"; then + SIGNAL_DEV="$(losetup --show -f -P "${SIGNAL_IMG}")" + fi + cryptsetup -d - -- open "${SIGNAL_DEV}" SignalCrypt + mount -- /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d" + ' +fi diff --git a/signal-desktop/signal-desktop b/signal-desktop/signal-desktop new file mode 100755 index 0000000..54f4b99 --- /dev/null +++ b/signal-desktop/signal-desktop @@ -0,0 +1,4 @@ +#!/bin/dash +set -e +mount-signal +exec /usr/bin/signal-desktop "$@" diff --git a/signal-desktop/umount-signal b/signal-desktop/umount-signal new file mode 100755 index 0000000..03e4a85 --- /dev/null +++ b/signal-desktop/umount-signal @@ -0,0 +1,17 @@ +#!/bin/dash + +asroot env \ + SIGNAL_DIR="${HOME}/.var/opt/signal" \ + SIGNAL_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- "${HOME}/.var/opt/signal/SignalCrypt.img")"'$#\1#p' | sed 1q)" \ + sh -c ' + if mountpoint -q -- "${SIGNAL_DIR}/SignalCrypt.d"; then + umount -- "${SIGNAL_DIR}/SignalCrypt.d" + fi + if test -e /dev/mapper/SignalCrypt; then + cryptsetup close SignalCrypt + fi + if test -n "${SIGNAL_DEV}"; then + losetup -d -- "${SIGNAL_DEV}" + fi + ' diff --git a/wire-desktop/Makefile b/wire-desktop/Makefile index 60a1b18..a8f6186 100644 --- a/wire-desktop/Makefile +++ b/wire-desktop/Makefile @@ -9,12 +9,19 @@ install: ../check-installed gnupg ../check-installed cryptsetup ../check-installed key2root - mkdir -p -- ~/.config/bash/aliases.d - test ! -e ~/.config/bash/aliases.d/wire-desktop || \ - test -L ~/.config/bash/aliases.d/wire-desktop - ln -sf -- ~/.dotfiles/wire-desktop/bash-aliases ~/.config/bash/aliases.d/wire-desktop + ../check-installed-shebang mount-wire + ../check-installed-shebang umount-wire + ../check-installed-shebang wire-desktop + mkdir -p -- ~/.local/bin/ + test ! -e ~/.local/bin/mount-wire || test -L ~/.local/bin/mount-wire + ln -sf -- ~/.dotfiles/wire-desktop/mount-wire ~/.local/bin/ + test ! -e ~/.local/bin/umount-wire || test -L ~/.local/bin/umount-wire + ln -sf -- ~/.dotfiles/wire-desktop/umount-wire ~/.local/bin/ + test ! -e ~/.local/bin/wire-desktop || test -L ~/.local/bin/wire-desktop + ln -sf -- ~/.dotfiles/wire-desktop/wire-desktop ~/.local/bin/ uninstall: +! ../check-installed wire-desktop - -unlink -- ~/.config/bash/aliases.d/wire-desktop - -rmdir -- ~/.config/bash/aliases.d + -unlink -- ~/.local/bin/mount-wire + -unlink -- ~/.local/bin/umount-wire + -unlink -- ~/.local/bin/wire-desktop diff --git a/wire-desktop/bash-aliases b/wire-desktop/bash-aliases deleted file mode 100644 index dfc0d2b..0000000 --- a/wire-desktop/bash-aliases +++ /dev/null @@ -1,42 +0,0 @@ -# -*- shell-script -*- - -mount-wire () { - if mountpoint -q -- ~/.var/opt/wire/WireCrypt.d; then - printf '%s\n' 'mount-wire: already mounted' >&2 - elif test -e /dev/mapper/WireCrypt; then - asroot env WIRE_DIR=~/.var/opt/wire sh -ec \ - 'mount -- /dev/mapper/WireCrypt "${WIRE_DIR}/WireCrypt.d"' - else - gpg --decrypt ~/.var/opt/wire/WireCrypt.key | \ - key2root -k WireCrypt env \ - WIRE_IMG=~/.var/opt/wire/WireCrypt.img \ - WIRE_DIR=~/.var/opt/wire \ - WIRE_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ - sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/wire/WireCrypt.img)"'$#\1#p' | sed 1q)" \ - sh -ec ' - if test -z "${WIRE_DEV}"; then - WIRE_DEV="$(losetup --show -f -P "${WIRE_IMG}")" - fi - cryptsetup -d - open "${WIRE_DEV}" WireCrypt - mount -- /dev/mapper/WireCrypt "${WIRE_DIR}/WireCrypt.d" - ' - fi -} - -umount-wire () { - asroot env \ - WIRE_DIR=~/.var/opt/wire \ - WIRE_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ - sed -n 's#\(/[^ ]*\) '"$(realpath -- ~/.var/opt/wire/WireCrypt.img)"'$#\1#p' | sed 1q)" \ - sh -c ' - if mountpoint -q -- "${WIRE_DIR}/WireCrypt.d"; then - umount -- "${WIRE_DIR}/WireCrypt.d" - fi - if test -e /dev/mapper/WireCrypt; then - cryptsetup close WireCrypt - fi - if test -n "${WIRE_DEV}"; then - losetup -d "${WIRE_DEV}" - fi - ' -} diff --git a/wire-desktop/mount-wire b/wire-desktop/mount-wire new file mode 100755 index 0000000..a6dde57 --- /dev/null +++ b/wire-desktop/mount-wire @@ -0,0 +1,22 @@ +#!/bin/dash + +if mountpoint -q -- "${HOME}/.var/opt/wire/WireCrypt.d"; then + printf '%s\n' 'mount-wire: already mounted' >&2 +elif test -e /dev/mapper/WireCrypt; then + asroot env WIRE_DIR="${HOME}/.var/opt/wire" sh -ec \ + 'mount -- /dev/mapper/WireCrypt "${WIRE_DIR}/WireCrypt.d"' +else + gpg --decrypt -- "${HOME}/.var/opt/wire/WireCrypt.key" | \ + key2root -k WireCrypt env \ + WIRE_IMG="${HOME}/.var/opt/wire/WireCrypt.img" \ + WIRE_DIR="${HOME}/.var/opt/wire" \ + WIRE_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- "${HOME}/.var/opt/wire/WireCrypt.img")"'$#\1#p' | sed 1q)" \ + sh -ec ' + if test -z "${WIRE_DEV}"; then + WIRE_DEV="$(losetup --show -f -P -- "${WIRE_IMG}")" + fi + cryptsetup -d - -- open "${WIRE_DEV}" WireCrypt + mount -- /dev/mapper/WireCrypt "${WIRE_DIR}/WireCrypt.d" + ' +fi diff --git a/wire-desktop/umount-wire b/wire-desktop/umount-wire new file mode 100755 index 0000000..0301326 --- /dev/null +++ b/wire-desktop/umount-wire @@ -0,0 +1,17 @@ +#!/bin/dash + +asroot env \ + WIRE_DIR="${HOME}/.var/opt/wire" \ + WIRE_DEV="$(losetup | sed 's/\s\+/ /g' | cut -d ' ' -f 1,6 | \ + sed -n 's#\(/[^ ]*\) '"$(realpath -- "${HOME}/.var/opt/wire/WireCrypt.img")"'$#\1#p' | sed 1q)" \ + sh -c ' + if mountpoint -q -- "${WIRE_DIR}/WireCrypt.d"; then + umount -- "${WIRE_DIR}/WireCrypt.d" + fi + if test -e /dev/mapper/WireCrypt; then + cryptsetup close WireCrypt + fi + if test -n "${WIRE_DEV}"; then + losetup -d -- "${WIRE_DEV}" + fi + ' diff --git a/wire-desktop/wire-desktop b/wire-desktop/wire-desktop new file mode 100755 index 0000000..d57bda2 --- /dev/null +++ b/wire-desktop/wire-desktop @@ -0,0 +1,5 @@ +#!/bin/dash +set -e +mount-wire +export ALSA_CARD=Microphone +exec /usr/bin/wire-desktop "$@" |