You are not logged in.
Hi,
I just followed the tip from Nvidia page from Wiki, about use a Pacman hook in order to always update initramfs after a Nvidia driver upgrade. So, I created the following file:
$ cat /etc/pacman.d/hooks/nvidia.hook
[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia
Target=linux
[Action]
Description=Update Nvidia module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux} exit 0; esac; done; /usr/bin/mkinitcpio -P'Now, when I update the driver , I get the following message:
( 4/10) Update Nvidia module in initcpio
/bin/sh: -c: line 0: syntax error near unexpected token `exit'
/bin/sh: -c: line 0: `while read -r trg; do case $trg in linux} exit 0; esac; done; /usr/bin/mkinitcpio -P'
error: command failed to execute correctlyMessage suggests that there is something wrong with the "Exec" line of the hook file, but I don't have enough knowledge to figure out what is wrong. What am I supposed to do to correct that?
Thanks for your attention.
Last edited by lucas2santos (2019-08-10 02:14:18)
Offline
It's not the same as in the wiki. } is not ).
Though that whole Exec line could be replaced by the following:
Exec=/bin/sh -c 'grep -q "^linux$" || mkinitcpio -P'Unless of course a zero exit code is important, then
Exec=/bin/sh -c 'grep -q "^linux$" && exit 0; mkinitcpio -P'Last edited by Trilby (2019-08-10 00:16:26)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thanks!!
Offline