You are not logged in.

#1 2022-04-18 05:50:00

Rayshabh
Member
From: Proxima Centauri b
Registered: 2022-04-07
Posts: 38

[SOLVED] Disabling Pacman Hook!!

Suppose I create a pacman hook to automate a task and save it in /etc/pacman.d/hooks directory. If at some point in the future, I don't want that task to execute automatically using that pacman hook, can I just delete that .hook file to prevent that task from being executed automatically next time?

I did read about “Overriding the Hook” https://archlinux.org/pacman/alpm-hooks … ding_hooks......
I understood the working, but I just want to know if simply deleting the .hook file would work or not!


#JUSTCURIOUS!

Last edited by Rayshabh (2022-04-18 07:01:35)

Offline

#2 2022-04-18 06:06:31

Ferdinand
Member
From: Norway
Registered: 2020-01-02
Posts: 338

Re: [SOLVED] Disabling Pacman Hook!!

Yes. If you delete the hook file it will not be run any more.
Another way to disable a hook can be just to rename the file, eg. from something.hook to something.inactive

Offline

#3 2022-04-18 06:29:48

Rayshabh
Member
From: Proxima Centauri b
Registered: 2022-04-07
Posts: 38

Re: [SOLVED] Disabling Pacman Hook!!

Ferdinand wrote:

Yes. If you delete the hook file it will not be run any more.
Another way to disable a hook can be just to rename the file, eg. from something.hook to something.inactive


Yeah, renaming the file feels a lot simpler and quicker approach than overriding the file. Also, I don't have to delete the hook file (in case if I need it back again).

Thank you for your suggestion! smile

Offline

#4 2022-04-18 07:02:49

Ferdinand
Member
From: Norway
Registered: 2020-01-02
Posts: 338

Re: [SOLVED] Disabling Pacman Hook!!

Uhm.. don't know if you misunderstood me - I ment renaming hook files you have placed in /etc/pacman.d/hooks, either to add your own hooks or to override hooks in /usr/share/libalpm/hooks.

It's not a good idea to rename or delete hooks in /usr/share/libalpm/hooks as these are added by installed packages and will be overwritten or recreated when the packages are updated.

If you want to disable or override a hook in /usr/share/libalpm/hooks, you create a hook file with the same name in /etc/pacman.d/hooks.
A similarly named file in /etc/pacman.d/hooks will be run instead of the hook file in /usr/share/libalpm/hooks.
If you want to plain disable the hook file in /usr/share/libalpm/hooks, the right way to do that will be to let the file in /etc/pacman.d/hooks be a symbolic link to /dev/null.

Check out the description in the wiki: https://wiki.archlinux.org/title/Pacman#Hooks

Last edited by Ferdinand (2022-04-18 07:04:34)

Offline

#5 2022-04-18 07:19:14

Rayshabh
Member
From: Proxima Centauri b
Registered: 2022-04-07
Posts: 38

Re: [SOLVED] Disabling Pacman Hook!!

Ferdinand wrote:

Uhm.. don't know if you misunderstood me - I ment renaming hook files you have placed in /etc/pacman.d/hooks, either to add your own hooks or to override hooks in /usr/share/libalpm/hooks.

It's not a good idea to rename or delete hooks in /usr/share/libalpm/hooks as these are added by installed packages and will be overwritten or recreated when the packages are updated.

If you want to disable or override a hook in /usr/share/libalpm/hooks, you create a hook file with the same name in /etc/pacman.d/hooks.
A similarly named file in /etc/pacman.d/hooks will be run instead of the hook file in /usr/share/libalpm/hooks.
If you want to plain disable the hook file in /usr/share/libalpm/hooks, the right way to do that will be to let the file in /etc/pacman.d/hooks be a symbolic link to /dev/null.

Check out the description in the wiki: https://wiki.archlinux.org/title/Pacman#Hooks



Understood! Thanks a ton! smile

Offline

Board footer

Powered by FluxBB