diff options
author | Ryan Kavanagh <rak@rak.ac> | 2022-01-12 11:27:51 -0500 |
---|---|---|
committer | Ryan Kavanagh <rak@rak.ac> | 2022-01-12 11:27:51 -0500 |
commit | 63ad2ef4fe6198826baf862b1617576a0ccfc4e3 (patch) | |
tree | 8749b0e68290c655b31ea6d86ea1bea260ada157 | |
parent | fix whitespace in .ssh/config template (diff) |
make wd-mount/umount portable
-rwxr-xr-x | bin/executable_wd-mount | 43 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/executable_wd-umount | 22 |
2 files changed, 44 insertions, 21 deletions
diff --git a/bin/executable_wd-mount b/bin/executable_wd-mount index 8a8ee3f..2d0d6aa 100755 --- a/bin/executable_wd-mount +++ b/bin/executable_wd-mount @@ -1,19 +1,30 @@ #!/bin/sh -if ! mount | grep -w /media/t > /dev/null ; then - if [ -e /dev/disk/by-uuid/0c5bcd92-bf08-4a21-a117-0ba9c0c31862 ]; then - sudo cryptdisks_start tosh && \ - sudo zpool import ztosh && \ - sudo mount /var/lib/mpd/music - sudo vgimport tosh - sudo vgchange -ay tosh - fi -fi +case `uname` in + OpenBSD) + doas bioctl -c C -l sd2a softraid0 + doas mount /mnt/wd + ;; + Linux) + if ! mount | grep -w /media/t > /dev/null ; then + if [ -e /dev/disk/by-uuid/0c5bcd92-bf08-4a21-a117-0ba9c0c31862 ]; then + sudo cryptdisks_start tosh && \ + sudo zpool import ztosh && \ + sudo mount /var/lib/mpd/music + sudo vgimport tosh + sudo vgchange -ay tosh + fi + fi -if ! mount | grep -w /media/wd-bak > /dev/null ; then - if [ -e /dev/disk/by-uuid/68b52a2b-2be5-4d40-98ba-c8469da50f1f ]; then - sudo cryptdisks_start wd-bak-work && mount /dev/mapper/wd-bak-work - elif [ -e /dev/disk/by-uuid/49491f12-45ec-4f3f-9f70-73a94149aaf2 ]; then - sudo cryptdisks_start wd-bak && mount /dev/mapper/wd-bak - fi -fi + if ! mount | grep -w /media/wd-bak > /dev/null ; then + if [ -e /dev/disk/by-uuid/68b52a2b-2be5-4d40-98ba-c8469da50f1f ]; then + sudo cryptdisks_start wd-bak-work && mount /dev/mapper/wd-bak-work + elif [ -e /dev/disk/by-uuid/49491f12-45ec-4f3f-9f70-73a94149aaf2 ]; then + sudo cryptdisks_start wd-bak && mount /dev/mapper/wd-bak + fi + fi + ;; + *) + echo "Unknown host" + exit 1 +esac diff --git a/bin/executable_wd-umount b/bin/executable_wd-umount index 8b1ec47..6d9ecbe 100755..100644 --- a/bin/executable_wd-umount +++ b/bin/executable_wd-umount @@ -1,7 +1,19 @@ #!/bin/sh -sudo umount --lazy -f /var/lib/mpd/music -sudo zpool export -f ztosh -sudo cryptdisks_stop tosh -sudo vgchange -an tosh -sudo vgexport tosh +case `uname` in + OpenBSD) + doas umount /mnt/wd + doas bioctl -d sd3 + ;; + Linux) + sudo umount --lazy -f /var/lib/mpd/music + sudo zpool export -f ztosh + sudo cryptdisks_stop tosh + sudo vgchange -an tosh + sudo vgexport tosh + ;; + *) + echo "Unknown host" + exit 1 + ;; +esac |