From a645f23e498d7a7501de66a00153dc86fd7e23fb Mon Sep 17 00:00:00 2001 From: Thuan Duong Date: Fri, 21 Jun 2019 14:29:56 +0700 Subject: [PATCH] Automatticlly add keyscript to crypttab #52 --- yubikey-luks-enroll | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/yubikey-luks-enroll b/yubikey-luks-enroll index e88e7e8..67e645a 100755 --- a/yubikey-luks-enroll +++ b/yubikey-luks-enroll @@ -109,4 +109,17 @@ else if [ "$DBG" = "1" ]; then echo "LUKS key: $R"; fi fi +# add keyscript to /etc/crypttab +if [ -b "${DISK}" ] +then + echo "${DISK} searching from disk/by-uuid" + UUID="$( blkid -s UUID -o value "$DISK" )" +fi + +if ! grep 'keyscript=/usr/share/yubikey-luks/ykluks-keyscript' /etc/crypttab +then + sed -i "/${UUID}/ s/$/,keyscript=\/usr\/share\/yubikey-luks\/ykluks-keyscript/" /etc/crypttab + update-initramfs -u +fi + exit 0