On Thu, 29 Jul 2010 13:38:18 +0200
Jan Stary <[email protected]> wrote:
> I have found myself replicating a tiny script that sets up crypto
> on most of my recent machines, either in rc.local directly or calling
> it from rc.local. Is this the right way to do it, or is there some
> support for it in rc(8) already that I missed?
>
> Jan
>
>
> #!/bin/sh
>
> RAIDPART=/dev/sd0o
> CRYPTOFS=/dev/sd1a
> MOUNTDIR=/crypto
>
> bioctl softraid0 | grep CRYPTO \
> || bioctl -v -c C -l $RAIDPART softraid0 \
> && fsck $CRYPTOFS \
> && mount -v -s -o rw,nodev,nosuid,noatime,softdep $CRYPTOFS $MOUNTDIR
>
>
I use following, right after swapctl in /etc/rc, I'm happy with that ;)
for try in 1 2 3 ; do
bioctl -c C -l /dev/sd0d softraid0 2>/dev/null ; rc=$?
if [ $rc -eq 0 ]; then
break
elif [ $try -eq 3 ]; then
halt -qp
else
:
fi
done