I was about to file a similar wishlist and found that there was already a well-evolved set of scripts in this one.  Rather than rely on partition types (luks is a partition type?), I had my init-premount script use cryptsetup and an encrypted= cmdline, as follows:

export ENCRYPTED=
for x in $(cat /proc/cmdline); do
        case $x in
        encrypted=*)
                ENCRYPTED=${x#encrypted=}
                if cryptsetup isLuks ${ENCRYPTED}
                then
                        cryptsetup luksOpen ${ENCRYPTED} ${ROOT#/dev/mapper/}
                fi
                ;;
        esac
done



Reply via email to