aboutsummaryrefslogblamecommitdiffstats
path: root/signal-desktop/bash-aliases
blob: 34a23b9985885ee9657a8824921e4cb1d2ee7f5e (plain) (tree)
1
2
3
4
5
6
7
8
9


                      





                                                                                                            


                  




                                                                                        
 
# -*- shell-script -*-

mount-signal () {
	asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" SIGNAL_DIR=~/.var/signal sh -ec '
		device="$(losetup --show -f -P "${SIGNAL_DIR}/SignalCrypt.img")"
		printf "%s\n" "${device}" > "${XDG_RUNTIME_DIR}/SignalCrypt"
		gpg --decrypt "${SIGNAL_DIR}/SignalCrypt.key" | cryptsetup -d - open "${device}" SignalCrypt
		mount /dev/mapper/SignalCrypt "${SIGNAL_DIR}/SignalCrypt.d"
		'
}

umount-signal () {
	asroot env XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}" SIGNAL_DIR=~/.var/signal sh -c '
		umount "${SIGNAL_DIR}/SignalCrypt.d"
		cryptsetup close SignalCrypt
		losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/SignalCrypt")"
		'
}