aboutsummaryrefslogblamecommitdiffstats
path: root/wire-desktop/bash-aliases
blob: 09f473352313d29ca9d0b3dd6d369cf406c35852 (plain) (tree)
1
2
3
4
5
6
7
8


                      

                                                                                         

                                                                            
                                                          




                                                                     
                                                                                        




                                                                           
# -*- shell-script -*-

mount-wire () {
	gpg --decrypt ~/.var/opt/wire/WireCrypt.key | \
	asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" WIRE_DIR=~/.var/opt/wire sh -ec '
		device="$(losetup --show -f -P "${WIRE_DIR}/WireCrypt.img")"
		printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/WireCrypt"
		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/opt/wire sh -c '
		umount "${WIRE_DIR}/WireCrypt.d"
		cryptsetup close WireCrypt
		losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/WireCrypt")"
		'
}