From 1bb6d2e88f8c29fecbb70f931a6f0cf44ef0d273 Mon Sep 17 00:00:00 2001 From: Cabopust <70815399+Cabopust@users.noreply.github.com> Date: Fri, 8 Oct 2021 17:52:35 +0300 Subject: [PATCH] Adding a hook to automatically update initramfs images (#63) * Add a hook to automatically update initramfs images * Removing the warning about manually updating initramfs --- PKGBUILD | 6 ++++++ system/nvidia-tkg.hook | 16 ++++++++++++++++ system/nvidia-tkg.install | 7 ------- 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 system/nvidia-tkg.hook diff --git a/PKGBUILD b/PKGBUILD index fed7d43..a4e4c42 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -252,6 +252,7 @@ fi source=($_source_name '10-nvidia-drm-outputclass.conf' 'nvidia-utils-tkg.sysusers' + 'nvidia-tkg.hook' 'linux-version.diff' # include linux version '01-ipmi-vm.diff' # ipmi & vm patch for older than 415.22 releases (2018.12.7) (396.xx) '02-ipmi-vm.diff' # ipmi & vm patch for older than 415.22 releases (2018.12.7) (addon for 410+) @@ -287,6 +288,7 @@ msg2 "Selected driver integrity check behavior (md5sum or SKIP): $_md5sum" # If md5sums=("$_md5sum" 'cb27b0f4a78af78aa96c5aacae23256c' '3d2894e71d81570bd00bce416d3e547d' + 'f2166eb150cfdc9d2dd8ec380c3e5583' '7a825f41ada7e106c8c0b713a49b3bfa' 'd961d1dce403c15743eecfe3201e4b6a' '14460615a9d4e247c8d9bcae8776ed48' @@ -1338,6 +1340,8 @@ if [ "$_dkms" = "false" ] || [ "$_dkms" = "full" ]; then install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf" echo "nvidia-uvm" | install -Dm644 /dev/stdin "${pkgdir}/etc/modules-load.d/${pkgname}.conf" + + install -Dm644 "${srcdir}/nvidia-tkg.hook" "${pkgdir}/usr/share/libalpm/hooks/nvidia-tkg.hook" } package_nvidia-tkg() { nvidia-tkg @@ -1456,6 +1460,8 @@ if [ "$_dkms" = "true" ] || [ "$_dkms" = "full" ]; then echo "nvidia-uvm" | install -Dm644 /dev/stdin "${pkgdir}/etc/modules-load.d/${pkgname}.conf" + install -Dm644 "${srcdir}/nvidia-tkg.hook" "${pkgdir}/usr/share/libalpm/hooks/nvidia-tkg.hook" + install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 "${srcdir}/${_pkg}/LICENSE" } package_nvidia-dkms-tkg() { diff --git a/system/nvidia-tkg.hook b/system/nvidia-tkg.hook new file mode 100644 index 0000000..9f595e4 --- /dev/null +++ b/system/nvidia-tkg.hook @@ -0,0 +1,16 @@ +[Trigger] +Operation=Install +Operation=Upgrade +Operation=Remove +Type=Package +Target=nvidia-tkg +Target=nvidia-dkms-tkg +Target=nvidia-dev-tkg +Target=nvidia-dev-dkms-tkg + +[Action] +Description=Update Nvidia modules in initcpio +Depends=mkinitcpio +When=PostTransaction +NeedsTargets +Exec=/usr/bin/mkinitcpio -P diff --git a/system/nvidia-tkg.install b/system/nvidia-tkg.install index d01636f..1b60399 100644 --- a/system/nvidia-tkg.install +++ b/system/nvidia-tkg.install @@ -29,13 +29,6 @@ post_install() { if pidof Xorg >/dev/null; then echo ":: Please reboot or exit X to unload the current module." fi - echo "" - echo -e "\e[31m###########################################################\e[0m" - echo "" - echo -e "\e[31m It is recommended to run mkinitcpio -P after installation\e[0m" - echo "" - echo -e "\e[31m###########################################################\e[0m" - echo "" } post_upgrade() {