You are not logged in.

#1 2021-06-02 22:53:35

equalizer876
Member
Registered: 2018-09-11
Posts: 78

Pacman hook on makepkg command

I've done some hooks which run on pacman -Syu. But how to create hooks which trigger whenever I execute makepkg? It's meant for installing/updating AUR packages.

Last edited by equalizer876 (2021-06-02 22:54:40)

Offline

#2 2021-06-03 04:46:59

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,073

Re: Pacman hook on makepkg command

What do you mean by "hook"? How would you use this?

Certainly, makepkg won't run libalpm hooks.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2021-06-03 10:25:32

equalizer876
Member
Registered: 2018-09-11
Posts: 78

Re: Pacman hook on makepkg command

I want to create a hook to copy files from one place to another. When I use 'makepkg -i' would it also run pacman -U? Should I use pacman -U to trigger a hook?

Last edited by equalizer876 (2021-06-03 10:26:00)

Offline

#4 2021-06-03 12:09:43

seth
Member
Registered: 2012-09-03
Posts: 21,150

Re: Pacman hook on makepkg command

"makepkg -i" will [ i ]nstall the package w/ pacman and that will trigger pacman hooks you have.
Your answer however doesn't really describe the problem - do you need some action for the build process or for the installation of the package?
For the latter: that has nothing to do w/ makepkg.

Online

#5 2021-06-03 14:11:47

equalizer876
Member
Registered: 2018-09-11
Posts: 78

Re: Pacman hook on makepkg command

The actions are for the installation of the package. Whenever I update an AUR package, I want to automatically copy some files to another place and avoid to trigger this simple command whenever I install/update packages from official repositories.

Offline

#6 2021-06-03 14:17:11

seth
Member
Registered: 2012-09-03
Posts: 21,150

Re: Pacman hook on makepkg command

seth wrote:

that has nothing to do w/ makepkg

I want to automatically copy some files to another place and avoid to trigger this simple command whenever I install/update packages from official repositories.

That's not a thing. Your hook could check whether the package is in the repo, but it still has to be called.
Or: your properly match the hooks type/target.
Or: you just run "makepkg -i && copy_some_files.sh"

Online

#7 2021-06-03 14:18:50

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 8,582

Re: Pacman hook on makepkg command

makepkg builds packages. pacman installs them. No matter where they come from. Start with understanding that, then the rest should follow.

Offline

#8 2021-06-03 14:39:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,286

Re: Pacman hook on makepkg command

equalizer876 wrote:

The actions are for the installation of the package... I want to automatically copy some files to another place and avoid to trigger this simple command whenever I install/update packages from official repositories.

This has been extremely vague - or even an X-Y question - from the start.  Stop making everyone ask for more details.  I'm quite confident that your goals are not a national security issue.

What package?  What files?  From what place to what other place, and why?  Why would this be triggered when you install / update packages from the repos?  Does the AUR package you are referring to conflict with a repo package that you also have installed?  Is that why you want to move files?  If so, this will fail and there are much easier solutions (i.e., fix the PKGBUILD).

Last edited by Trilby (2021-06-03 14:45:48)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#9 2021-06-03 15:24:01

equalizer876
Member
Registered: 2018-09-11
Posts: 78

Re: Pacman hook on makepkg command

Trilby wrote:

This has been extremely vague - or even an X-Y question - from the start.  Stop making everyone ask for more details.  I'm quite confident that your goals are not a national security issue.

I'll be screwed if I post all informations, but let's do it anyway. A Flatpak application can't open files in /usr/share. I installed some extensions from AUR and those are placed in /usr/share. Now I just need to cp those extensions into my home folder and the Flatpak application is able to open them. I already asked on the Github page of that Flatpak application and they answered it couldn't be helped.

Now to automate this cp command whenever the extensions are updated. I don't use AUR helpers. Only doing 'makepkg -sirc' to update AUR packages Maybe this would do?

[Trigger]
Type = Path
Operation = Install
Target = usr/share/extension1
Target = usr/share/extension2
Target = usr/share/extension3

[Action]
Description = Copy extensions to home...
When = PostTransaction
Exec = /.../CopyExtensions.sh

I guess NeedsTargets in [Action] would require to meet all Target conditions at the same time?

When I look into https://archlinux.org/pacman/alpm-hooks.5.html then I could also do Type = Package and Operation = Upgrade.

Last edited by equalizer876 (2021-06-03 15:33:26)

Offline

#10 2021-06-03 18:45:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,286

Re: Pacman hook on makepkg command

equalizer876 wrote:

I'll be screwed if I post all informations

More so if you don't.  Why can't the flatpak application open files in /usr/share?  Do you need to change their ownership or group membership?  Again, be specific.  What flatpak, what are the actual error messages?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#11 2021-06-03 20:05:41

loqs
Member
Registered: 2014-03-06
Posts: 13,452

Re: Pacman hook on makepkg command

Linking to the bug report on github would save repeating all the information included there and avoid some of this guesswork.

Offline

#12 2021-06-03 21:23:36

equalizer876
Member
Registered: 2018-09-11
Posts: 78

Re: Pacman hook on makepkg command

https://github.com/flathub/com.github.E … /issues/26
Now happy? One workaround would be the pacman hook I think. Another one?

Offline

#13 2021-06-03 21:31:31

seth
Member
Registered: 2012-09-03
Posts: 21,150

Re: Pacman hook on makepkg command

You could symlink or bind-mount the relevant paths.
Or you use https://aur.archlinux.org/packages/ungoogled-chromium/

Also this isn't to make anyone "happy" but to avoid dances around the problem, check the stickies in the newbie corner.

Online

#14 2021-06-03 22:30:09

equalizer876
Member
Registered: 2018-09-11
Posts: 78

Re: Pacman hook on makepkg command

seth wrote:

You could symlink or bind-mount the relevant paths.
Or you use https://aur.archlinux.org/packages/ungoogled-chromium/

Symlink didn't work, but I'll try bind-mount next time. Compiling a whole browser takes a lot of computing time so I figured why not just using a compiled package. Then I would trust flathub more than pacman binaries of single users.


seth wrote:

Also this isn't to make anyone "happy"

I know and I'm thankful for your help, but I still couldn't resist it. yikes Sorry

Last edited by equalizer876 (2021-06-03 22:31:56)

Offline

Board footer

Powered by FluxBB