[PATCH] kernel.filetrigger: ucode support

Konstantin A. Lepikhov lakostis на altlinux.ru
Ср Сен 6 14:49:26 MSK 2017


We need to rebuild initramfs on CPU ucode changes otherwise everything
will continue use outdated version till next kernel update.
---
 kernel.filetrigger | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/kernel.filetrigger b/kernel.filetrigger
index 9cdf01e..3f14faf 100755
--- a/kernel.filetrigger
+++ b/kernel.filetrigger
@@ -9,6 +9,7 @@
 BOOTDIR=/boot
 VMLINUZ_PREFIX=/boot/vmlinuz
 MODULES_PREFIX=/lib/modules
+UCODE_PREFIX=/lib/firmware
 INITRD_AUTOUPDATE=
 
 . /etc/sysconfig/installkernel
@@ -99,6 +100,7 @@ $VERSION"
 	last_added="$VERSION"
 }
 
+ucode_detected=
 while read f; do
 	case "$f" in
 		$VMLINUZ_PREFIX-[0-9].*-*-*)
@@ -107,6 +109,9 @@ while read f; do
 		$MODULES_PREFIX/*-*-*/*/*.ko*)
 			handle_module "$f"
 			;;
+		$UCODE_PREFIX/*-ucode/*)
+			ucode_detected=1
+			;;
 	esac
 done
 
@@ -119,6 +124,10 @@ if [ -n "$kernel_versions_handled" -a "$INITRD_AUTOUPDATE" = all ]; then
 		# regenerate initrd image without updating symlinks
 		/sbin/installkernel $INSTALLKERNEL_ARGS --nodefault --noflavour "$VERSION"
 	done
+elif [ -n "$ucode_detected" ]; then
+	VERSION=$(uname -r)
+	# regenerate initrd image without updating symlinks
+	/sbin/installkernel $INSTALLKERNEL_ARGS --nodefault --noflavour "$VERSION"
 elif [ -n "$module_versions_handled" ]; then
 	module_versions_handled="$(printf '%s\n' "$module_versions_handled" |sort -u)"
 	for m in $module_versions_handled; do
-- 
2.10.4


--aVD9QWMuhilNxW9f--


Подробная информация о списке рассылки Devel