dotfiles/.bin/umount-cryptoffs
2025-01-01 10:04:08 +01:00

11 lines
324 B
Bash
Executable File

#!/bin/sh
_dev=${1:-sd3}
doas umount /mnt 2>&1 | grep -q busy && echo "/mnt is busy" && exit 1
_biodev=$(doas bioctl softraid0 | grep -C1 sd3 | grep CRYPTO | awk '{ print $5 }')
if [ -n "$_biodev" ]
then
doas bioctl -d ${_biodev} && echo "bioctl: $_dev detached"
else
echo "bioctl: $_dev: currently not attached"
fi