dotfiles/.bin/umount-cryptoffs

11 lines
324 B
Plaintext
Raw Normal View History

#!/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