if [ -f /etc/crypttab ]; then # we need luks support! if ! /sbin/cryptsetup --help | grep -q luksFormat ; then echo "Error: We need cryptsetup luks" else # open luks devices sed 's/#.*$//g' /etc/crypttab | tr '\t' ' ' | grep -v -e '^$' | while read DEVICE MAPPING do if [ -z "$DEVICE" ] || [ ! -e "$DEVICE" ] ; then echo "Unable to find \"$DEVICE\"" continue elif ! /sbin/cryptsetup isLuks "$DEVICE" ; then echo "\"$DEVICE\" doesn't seem to be a Luks encrypted volume" continue fi run_with_msg "Opening device $DEVICE:\n" "/sbin/cryptsetup luksOpen $DEVICE $MAPPING" done fi fi