summaryrefslogtreecommitdiffstats
path: root/.local/bin/hddumnt
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2023-10-31 02:14:13 +0100
committerJoe <bousset.rudy@gmail.com>2023-10-31 02:14:13 +0100
commit5f43b704980023fe4e2b76d7888559e87c2ebef2 (patch)
treed4d4f6364a6091f3b2bb1cedc639c5a45c8c40f6 /.local/bin/hddumnt
parentup (diff)
downloaddotfiles-bsd-5f43b704980023fe4e2b76d7888559e87c2ebef2.tar.gz
dotfiles-bsd-5f43b704980023fe4e2b76d7888559e87c2ebef2.tar.bz2
dotfiles-bsd-5f43b704980023fe4e2b76d7888559e87c2ebef2.tar.xz
dotfiles-bsd-5f43b704980023fe4e2b76d7888559e87c2ebef2.tar.zst
dotfiles-bsd-5f43b704980023fe4e2b76d7888559e87c2ebef2.zip
up
Diffstat (limited to '.local/bin/hddumnt')
-rwxr-xr-x.local/bin/hddumnt39
1 files changed, 28 insertions, 11 deletions
diff --git a/.local/bin/hddumnt b/.local/bin/hddumnt
index 4a883f7..75c6570 100755
--- a/.local/bin/hddumnt
+++ b/.local/bin/hddumnt
@@ -1,13 +1,30 @@
#!/bin/sh -e
-if ! mount | grep -F /dev/da0p1; then
- notify-send -u critical 'fathdd' ' HDD not mounted'
- exit 1
-fi
-if ! umount /dev/da0p1.eli; then
- notify-send -u critical 'fathdd' ' Failed to dismount HDD'
- exit 1
-fi
-geli detach da0p1.eli
-rmdir "$HOME"/hdd
-notify-send -t 5000 'fathdd' ' HDD dismounted from <b>~/hdd</b>'
+devname="exthdd"
+mountpoint="$HOME/$devname"
+
+case "$(hostname -s)" in
+ mother|po-rbo)
+ if ! doas umount "$mountpoint"; then
+ notify-send -u critical 'exthdd' " failed to dismount $mountpoint"
+ fi
+ if ! doas cryptsetup close "$devname"; then
+ notify-send -u critical 'exthdd' " failed to close crypt dev $devname"
+ fi
+ rmdir "$mountpoint"
+ notify-send -t 5000 'exthdd' " crypt dev dismounted from $mountpoint"
+ ;;
+ mars)
+ if ! mount | grep -F /dev/da0p1; then
+ notify-send -u critical 'fathdd' ' HDD not mounted'
+ exit 1
+ fi
+ if ! umount /dev/da0p1.eli; then
+ notify-send -u critical 'fathdd' ' Failed to dismount HDD'
+ exit 1
+ fi
+ geli detach da0p1.eli
+ rmdir "$HOME"/hdd
+ notify-send -t 5000 'fathdd' ' HDD dismounted from <b>~/hdd</b>'
+ ;;
+esac