dntpd: Fix typo.
[dragonfly.git] / share / initrd / etc / rcmount_crypt
blobfc612f81c980afb7e69c423f8fc169997e7e0eaa
1 #!/bin/sh
3 if [ ! -x /sbin/cryptsetup ]; then
4 return 1;
5 fi
7 FSTYPE=$2
8 MOUNTFROM=$3
9 VOLUME=$4
10 OPTIONS=$5
12 # Make sure that MOUNTFROM starts with /dev/
13 substr="${MOUNTFROM##/dev/}"
14 if [ "$substr" = "$MOUNTFROM" ]; then
15 MOUNTFROM="/dev/$MOUNTFROM"
18 # Check if the volume is really a luks volume
19 /sbin/cryptsetup isLuks $MOUNTFROM
20 if [ "$?" -ne "0" ]; then
21 return 1;
24 # Open crypto volume
25 /sbin/cryptsetup $OPTIONS luksOpen $MOUNTFROM $VOLUME
26 if [ "$?" -ne "0" ]; then
27 return 2;
30 # Mount, as is expected, onto /new_root
31 mount -o ro -t $FSTYPE /dev/mapper/$VOLUME /new_root
32 if [ "$?" -ne "0" ]; then
33 return 3;