diff --git a/src/install/ykfde b/src/install/ykfde index f4bbd11..33d2252 100644 --- a/src/install/ykfde +++ b/src/install/ykfde @@ -28,18 +28,18 @@ build() { add_file $file done - python_ver=$(python -V | awk '{print $2}') - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/zipp" - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/cryptography" - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/cffi" - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/smartcard" - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/fido2" - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/importlib_metadata" - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/ykman" - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/yubikit" - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/click" - add_full_dir "/usr/lib/python${python_ver::-2}/site-packages/keyring" - add_binary "/usr/lib/python${python_ver::-2}/site-packages/_cffi_backend.cpython-311-x86_64-linux-gnu.so" + python_ver=$(python -V | awk -F'[" ",.]' '{print $2"."$3}') + add_full_dir "/usr/lib/python${python_ver}/site-packages/zipp" + add_full_dir "/usr/lib/python${python_ver}/site-packages/cryptography" + add_full_dir "/usr/lib/python${python_ver}/site-packages/cffi" + add_full_dir "/usr/lib/python${python_ver}/site-packages/smartcard" + add_full_dir "/usr/lib/python${python_ver}/site-packages/fido2" + add_full_dir "/usr/lib/python${python_ver}/site-packages/importlib_metadata" + add_full_dir "/usr/lib/python${python_ver}/site-packages/ykman" + add_full_dir "/usr/lib/python${python_ver}/site-packages/yubikit" + add_full_dir "/usr/lib/python${python_ver}/site-packages/click" + add_full_dir "/usr/lib/python${python_ver}/site-packages/keyring" + add_binary "/usr/lib/python${python_ver}/site-packages/_cffi_backend.cpython-311-x86_64-linux-gnu.so" add_binary "/usr/lib/libssl.so.3" add_binary "cryptsetup" diff --git a/testrun.sh b/testrun.sh index 617b7bc..3b3c3b4 100755 --- a/testrun.sh +++ b/testrun.sh @@ -37,6 +37,7 @@ truncate -s 20M "$YKFDE_TMPFILE" cleanup() { rm -f "$YKFDE_TMPFILE" + rm -rf initramfs } trap cleanup EXIT @@ -55,6 +56,22 @@ bash "$(pwd)/src/ykfde-open" -d "$YKFDE_TMPFILE" -n ykfde-test -v cryptsetup close ykfde-test echo "Test 'ykfde-open' script successfully passed." -echo "All tests successfully passed." - +echo "INFO: Testing initramfs..." +mkdir -p "$(pwd)/initramfs" +mkinitcpio -d "$(pwd)/initramfs" +status=1 +status=$(chroot "$(pwd)/initramfs" /bin/sh -c "export CRYPTOGRAPHY_OPENSSL_NO_LEGACY=1; ykman otp info; exit 0" 2>&1 | awk ' + { + if ($0 ~ /No YubiKey detected/) { + print "0"; + exit 0; + } + }' +) +if [[ "$status" == 0 ]] +then + echo "All tests successfully passed." +else + echo "The image didnot pass the test, please file a bug report to: https://github.com/agherzan/yubikey-full-disk-encryption/issues" +fi exit 0