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


                      

                                                                                             

                                                                                
                                                            

                                                                           


                  
                                                                                            

                                                    

                                                                       
                 
 
# -*- shell-script -*-

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