summaryrefslogtreecommitdiffstats
path: root/.local/bin/fathddmnt
blob: 62bfff6e9366325ac2bfda84dc01373c1e5f5cb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh -e

if ! diskinfo da0 >/dev/null; then
	notify-send -u critical 'fathdd' '  HDD not detected'
	exit 1
fi
if mount | grep -F /dev/da0p1; then
	notify-send -u critical \
		'fathdd' \
		"  HDD already mounted to \
<b>$(mount | grep -F '/dev/da0p1' | awk '{print $3}')</b>"
	exit 1
fi
if ! dmenu -p 'Enter password: ' -P |
	geli attach -k /root/geli_keys/fathdd_ext.key -j - da0p1; then
	notify-send -u critical 'fathdd' '  Failed to mount HDD'
	exit 1
fi
mkdir -p "$HOME"/hdd
mount /dev/da0p1.eli "$HOME"/hdd
notify-send -t 5000 'fathdd' '  HDD mounted to <b>~/hdd</b>'