From 0f960d348e723d248db8dbdad6b00bf44ec80edb Mon Sep 17 00:00:00 2001 From: eshanized Date: Thu, 9 Jan 2025 15:38:33 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf:=20improve=20hook=20w?= =?UTF-8?q?ith=20error=20logging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- etc/pacman.d/hooks/kernel-linux.hook | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/etc/pacman.d/hooks/kernel-linux.hook b/etc/pacman.d/hooks/kernel-linux.hook index e773023..d61edec 100644 --- a/etc/pacman.d/hooks/kernel-linux.hook +++ b/etc/pacman.d/hooks/kernel-linux.hook @@ -23,6 +23,15 @@ Target = linux-jwrdegoede* [Action] Depends = grub -Description = Pacman hook to update-grub automatically +Description = Updating GRUB configuration automatically after kernel operations When = PostTransaction -Exec = /bin/sh -c "grub-mkconfig -o /boot/grub/grub.cfg" +Exec = /bin/sh -c " +if command -v grub-mkconfig >/dev/null 2>&1; then + echo 'Updating GRUB configuration...'; + grub-mkconfig -o /boot/grub/grub.cfg && \ + echo 'GRUB configuration updated successfully.' || \ + echo 'Error: Failed to update GRUB configuration.' >&2; +else + echo 'Error: grub-mkconfig not found. Ensure GRUB is installed.' >&2; + exit 1; +fi"