blob: 44d425bf4a6e72dcd33cb81061ce2f360c802b09 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
'
|