| 1 |
#!/sbin/runscript
|
| 2 |
# Copyright 1999-2004 Gentoo Foundation
|
| 3 |
# Distributed under the terms of the GNU General Public License v2
|
| 4 |
# $Header$
|
| 5 |
|
| 6 |
loopconf="/etc/conf.d/crypto-loop"
|
| 7 |
|
| 8 |
depend() {
|
| 9 |
need checkroot modules
|
| 10 |
before localmount
|
| 11 |
}
|
| 12 |
|
| 13 |
start() {
|
| 14 |
local status="0"
|
| 15 |
|
| 16 |
ebegin "Starting crypto loop devices"
|
| 17 |
|
| 18 |
if [ -e ${loopconf} ]
|
| 19 |
then
|
| 20 |
egrep "^loop" ${loopconf} | \
|
| 21 |
while read loopline
|
| 22 |
do
|
| 23 |
eval ${loopline}
|
| 24 |
|
| 25 |
local configured="`awk -v MOUNT="${device}" \
|
| 26 |
'($2 == MOUNT) { print "yes" }' /proc/mounts`"
|
| 27 |
|
| 28 |
if [ "${configured}" != "yes" ]
|
| 29 |
then
|
| 30 |
einfo " Loop ${loop} on device ${device} (cipher ${cipher}, key size ${keysize}): "
|
| 31 |
if ! /sbin/losetup -e ${cipher} -k ${keysize} ${loop} ${device} ${other}
|
| 32 |
then
|
| 33 |
ewarn "Failure configuring ${loop}. Skipping."
|
| 34 |
status=1
|
| 35 |
fi
|
| 36 |
else
|
| 37 |
ewarn " Loop ${loop} on device ${device} are already configured"
|
| 38 |
fi
|
| 39 |
done
|
| 40 |
fi
|
| 41 |
ewend ${status} "Failed to start some loop devices."
|
| 42 |
|
| 43 |
# We do not fail if some loop devices did not start ...
|
| 44 |
return 0
|
| 45 |
}
|
| 46 |
|
| 47 |
# vim:ts=4
|