aboutsummaryrefslogblamecommitdiffstats
path: root/bash/aliases-Zenith
blob: ac794c9e2f3a38dc8c2b4ab5f9e0cf79a7b47bba (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                                                               
# -*- shell-script -*-

mount-crypt () {
	sudo printf '' && \
	device="$(sudo losetup --show -f -P /media/Secondary/.crypt/crypt.img)" && \
	printf '%s\n' "${device}" > "${XDG_RUNTIME_DIR}/CryptCrypt" && \
	gpg --decrypt /media/Secondary/.crypt/crypt.key | sudo cryptsetup -d - open "${device}" CryptCrypt && \
	mkdir -p ~/Crypt && \
	sudo mount /dev/mapper/CryptCrypt ~/Crypt
}

umount-crypt () {
	sudo umount ~/Crypt
	rmdir ~/Crypt
	sudo cryptsetup close CryptCrypt
	sudo losetup --detach "$(cat -- "${XDG_RUNTIME_DIR}/CryptCrypt")"
}