blob: a7c3b8a3d7bc6a6c23747ce550c64a429267cfa7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/bin/sh -e
devname="exthdd"
mountpoint="$HOME/$devname"
case "$(hostname -s)" in
mother|po-rbo)
dev=$(find /dev/sd* -type b -exec bash -c 'doas cryptsetup isLuks {} && echo {}' \; | head -n1)
if [ -z "$dev" ]; then
herbe ' crypt dev not detected'
exit 1
fi
if ! doas cryptsetup open "$dev" "$devname"; then
herbe " failed to uncrypt dev $dev"
exit 1
fi
mkdir -p "$mountpoint"
if ! doas mount /dev/mapper/"$devname" "$mountpoint"; then
herbe " failed to mount dev $dev"
exit 1
fi
herbe " crypt dev mounted to $mountpoint"
;;
mars)
if ! diskinfo da0 >/dev/null; then
herbe ' HDD not detected'
exit 1
fi
if mount | grep -F /dev/da0p1; then
herbe \
" HDD already mounted to \
$(mount | grep -F '/dev/da0p1' | awk '{print $3}')"
exit 1
fi
if ! dmenu -m 0 -p 'Enter password: ' -P |
geli attach -k /root/geli_keys/fathdd_ext.key -j - da0p1; then
herbe ' Failed to mount HDD'
exit 1
fi
mkdir -p "$HOME"/hdd
mount /dev/da0p1.eli "$HOME"/hdd
herbe ' HDD mounted to ~/hdd'
;;
esac
|