Last active
August 21, 2018 06:32
-
-
Save jkhsjdhjs/228ddd6e961cec005e8efefcbcf4c52c to your computer and use it in GitHub Desktop.
nvidia hooks to trigger initramfs image generation on install/update/remove
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
workdir="$(cd "$(dirname "$0")" && pwd)" | |
xargs -I % rm "${workdir}/%" < "${workdir}/nvidia_hooks_filenames.txt" && rm "${workdir}/nvidia_hooks_filenames.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Trigger] | |
Type = Package | |
Operation = Install | |
Operation = Upgrade | |
Operation = Remove | |
Target = nvidia | |
[Action] | |
Description = Removing overwritten hook(s) | |
Depends = bash | |
Depends = coreutils | |
When = PostTransaction | |
Exec = /etc/pacman.d/hooks/nvidia_post.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
workdir="$(cd "$(dirname "$0")" && pwd)" | |
mkinitcpio_hooks="$(grep -Pl '^Exec\s*=\s*[/\w]*mkinitcpio' /usr/share/libalpm/hooks/*)" | |
mkinitcpio_hooks_basename="$(echo "$mkinitcpio_hooks" | xargs -I % basename %)" | |
echo "$mkinitcpio_hooks" | xargs -I % cp % "$workdir" \ | |
&& echo "$mkinitcpio_hooks_basename" | xargs -I % bash -c "cat ${workdir}/nvidia_trigger.txt >> ${workdir}/%" \ | |
&& echo "$mkinitcpio_hooks_basename" > "${workdir}/nvidia_hooks_filenames.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Trigger] | |
Type = Package | |
Operation = Install | |
Operation = Upgrade | |
Operation = Remove | |
Target = nvidia | |
[Action] | |
Description = Triggering mkinitcpio | |
Depends = bash | |
Depends = coreutils | |
Depends = grep | |
When = PreTransaction | |
Exec = /etc/pacman.d/hooks/nvidia_pre.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Trigger] | |
Type = Package | |
Operation = Install | |
Operation = Upgrade | |
Operation = Remove | |
Target = nvidia |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment