From 636e40456e30053e39273565f4abe5797885bfa3 Mon Sep 17 00:00:00 2001 From: Tom Hiller Date: Sun, 18 Oct 2020 14:46:57 -0400 Subject: [PATCH] fix: update chesksums of filenames with spaces (#847) Signed-off-by: Tom Hiller --- initrd/bin/kexec-sign-config | 4 ++-- initrd/bin/oem-factory-reset | 4 ++-- initrd/etc/functions | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/initrd/bin/kexec-sign-config b/initrd/bin/kexec-sign-config index 1f8a6d72..34a19f19 100755 --- a/initrd/bin/kexec-sign-config +++ b/initrd/bin/kexec-sign-config @@ -25,9 +25,9 @@ confirm_gpg_card # update hashes in /boot before signing if [ "$update" = "y" ]; then - ( + ( cd /boot - find ./ -type f ! -name '*kexec*' | xargs sha256sum > /boot/kexec_hashes.txt + find ./ -type f ! -name '*kexec*' -print0 | xargs -0 sha256sum > /boot/kexec_hashes.txt if [ -e /boot/kexec_default_hashes.txt ]; then DEFAULT_FILES=$(cat /boot/kexec_default_hashes.txt | cut -f3 -d ' ') echo $DEFAULT_FILES | xargs sha256sum > /boot/kexec_default_hashes.txt diff --git a/initrd/bin/oem-factory-reset b/initrd/bin/oem-factory-reset index 17b3dce0..b55ba956 100755 --- a/initrd/bin/oem-factory-reset +++ b/initrd/bin/oem-factory-reset @@ -157,8 +157,8 @@ generate_checksums() set_default_boot_option # generate hashes - find /boot -type f ! -name '*kexec*' \ - | xargs sha256sum > /boot/kexec_hashes.txt 2>/dev/null \ + find /boot -type f ! -name '*kexec*' -print0 \ + | xargs -0 sha256sum > /boot/kexec_hashes.txt 2>/dev/null \ || whiptail_error_die "Error generating kexec hashes" param_files=`find /boot/kexec*.txt` diff --git a/initrd/etc/functions b/initrd/etc/functions index d7907e39..bc84840d 100755 --- a/initrd/etc/functions +++ b/initrd/etc/functions @@ -313,7 +313,7 @@ detect_boot_device() # generate list of possible boot devices fdisk -l | grep "Disk" | cut -f2 -d " " | cut -f1 -d ":" > /tmp/disklist - + # filter out extraneous options > /tmp/boot_device_list for i in `cat /tmp/disklist`; do @@ -325,7 +325,7 @@ detect_boot_device() ls $i* | tail -${DEV_NUM_PARTITIONS} >> /tmp/boot_device_list fi done - + # iterate thru possible options and check for grub dir for i in `cat /tmp/boot_device_list`; do umount /boot 2>/dev/null