Comment 5 for bug 1172014

Revision history for this message
Colin Watson (cjwatson) wrote :

And in fact it'd need to look up the LUKS UUID anyway in order to write it to crypttab. Compare partman-crypto:

        # Use UUID for LUKS devices
        if cryptsetup isLuks "$source"; then
                local uuid=$(cryptsetup luksUUID "$source")
                source="UUID=$uuid"
        fi

        # Add entry to crypttab
        echo "$target $source $keyfile $opts" >> /target/etc/crypttab

and ecryptfs-setup-swap:

        info `gettext "Setting up swap:"` "[$swap]"
        uuid=$(blkid -o value -s UUID $swap)
        for target in "UUID=$uuid" $swap; do
                if [ -n "$target" ] && grep -qs "^$target " /etc/fstab; then
                        sed -i "s:^$target :\#$target :" /etc/fstab
                        warn "Commented out your unencrypted swap from /etc/fstab"
                fi
        done

        while :; do
                i=$((i+1))
                [ -e "/dev/mapper/cryptswap$i" ] || break
        done
        # Add crypttab entry
        echo "cryptswap$i $swap /dev/urandom swap,cipher=aes-cbc-essiv:sha256" >> /etc/crypttab