summaryrefslogtreecommitdiffstats
path: root/.local/bin/fathddmnt
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2022-05-21 01:29:54 +0200
committerJoe <bousset.rudy@gmail.com>2022-05-21 01:29:54 +0200
commitff3ac54b6a212c1bad572fd318acc4f378fa0302 (patch)
tree88f09af226f3626a240a09cfccdce385608fc126 /.local/bin/fathddmnt
parentupdate (diff)
downloaddotfiles-bsd-ff3ac54b6a212c1bad572fd318acc4f378fa0302.tar.gz
dotfiles-bsd-ff3ac54b6a212c1bad572fd318acc4f378fa0302.tar.bz2
dotfiles-bsd-ff3ac54b6a212c1bad572fd318acc4f378fa0302.tar.xz
dotfiles-bsd-ff3ac54b6a212c1bad572fd318acc4f378fa0302.tar.zst
dotfiles-bsd-ff3ac54b6a212c1bad572fd318acc4f378fa0302.zip
cool updates
Diffstat (limited to '.local/bin/fathddmnt')
-rwxr-xr-x.local/bin/fathddmnt22
1 files changed, 17 insertions, 5 deletions
diff --git a/.local/bin/fathddmnt b/.local/bin/fathddmnt
index 27278d9..62bfff6 100755
--- a/.local/bin/fathddmnt
+++ b/.local/bin/fathddmnt
@@ -1,9 +1,21 @@
#!/bin/sh -e
-tmp=$(mktemp)
-
-dmenu -p "Enter password: " -nb '#1d2021' -nf '#1d2021' <&- >"$tmp"
-geli attach -k /root/geli_keys/fathdd_ext.key -j "$tmp" /dev/da0p1
+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
-rm "$tmp"
mount /dev/da0p1.eli "$HOME"/hdd
+notify-send -t 5000 'fathdd' ' HDD mounted to <b>~/hdd</b>'