From 022f2b6c0b59c1d191e23cf232969d6a47586ad8 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 8 Jan 2018 17:15:39 -0500 Subject: [PATCH] cleanup: don't chattr if it's not immutable. On kernels without the fix for Samsung laptops, the cleanup script will fail because the efi variables in sysfs files aren't immutable. Don't try to unset the immutable flag if it's not set. This is discussed here: https://github.com/rhboot/fwupdate/issues/69#issuecomment-315844797 Signed-off-by: Peter Jones --- linux/cleanup.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux/cleanup.in b/linux/cleanup.in index 212e69c..da9fcc8 100755 --- a/linux/cleanup.in +++ b/linux/cleanup.in @@ -21,7 +21,9 @@ for x in @@ESPMOUNTPOINT@@/EFI/@@EFIDIR@@/fw/fwupdate-* ; do done for x in /sys/firmware/efi/efivars/fwupdate-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 ; do if [ "${x}" != "/sys/firmware/efi/efivars/fwupdate-*-0abba7dc-e516-4167-bbf5-4d9d1c739416" ]; then - chattr -i "${x}" + if lsattr "${x}" 2>/dev/null | cut -d\ -f1 | cut -d- -f5 | grep -q i ; then + chattr -i "${x}" + fi rm -f "${x}" fi done