#! /bin/sh
### BEGIN INIT INFO
# Provides:          cryptfs
# Required-Start:    checkroot
# Required-Stop:     umountroot
# Should-Start:      checkfs udev mdadm lvm2
# Default-Start:     S
# Default-Stop:
# Short-Description: Decrypt filesystems
# Description:
### END INIT INFO

if [ ! -r /etc/cryptfs.xml ] || [ ! -x /sbin/cryptfs ]; then
    exit 1
fi

if [ -e /etc/environment ]; then
    . /etc/environment
    export LC_ALL
fi
	
modprobe dm-mod > /dev/null 2>&1

echo "Setting up encrypted filesystems and swap..."

# Finish initrd-Stuff.
/sbin/cryptfs -in root

# Do swap and other things.
/sbin/cryptfs -i swap boot

: exit 0
