You are not logged in.

#1 2015-12-19 20:09:42

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Some fun pacman hooks

I just installed pacman from git and now I'm like a kid in a candy store. Here's what my /etc/pacman.d/hooks looks like after some playing around. Some of the files require external scripts because the Exec line does not match wildcards.

complete_more_names.hook:
A bash-completion patch which will probably not be accepted upstream because it used to be applied and they reversed it.

[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = bash-completion

[Action]
When = PostTransaction
Exec = /usr/bin/sed -i -e 's/@(mk|rm)/rm/' /usr/share/bash-completion/bash_completion

update_vim_syntax.hook:
A vim-runtime patch which was not applied upstream because it would create the illusion that an unmaintained file is maintained. If I know too little about the syntax to volunteer.

[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = usr/share/vim/vim??/syntax/xf86conf.vim

[Action]
When = PostTransaction
Exec = /etc/pacman.d/hooks/update_vim_syntax.sh
NeedsTargets

update_vim_syntax.sh:

#!/bin/bash
read TARGET
/usr/bin/sed -i -e 's| Driver | Disable Driver |' -e 's| Accel | Accel AccelMethod |' -e 's| AllowClosedownGrabs | AllowClosedownGrabs AllowEmptyInput |' -e 's| AutoRepeat | AutoAddDevices AutoRepeat |' "/$TARGET"

mime_replace.hook:
This prevents any package from making itself the default MIME handler for any type. Some programs do this despite only barely being able to handle some formats. Instead, I assign handlers manually in ~/.local/share/applications.

[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = *.desktop

[Action]
When = PostTransaction
Exec = /etc/pacman.d/hooks/mime_replace.sh
NeedsTargets

mime_replace.sh:

#!/bin/bash

while read TARGET; do
	[[ -f "$TARGET" ]] || continue
	sed -i -e '/MimeType=/d' "/$TARGET"
done

lilo_bootloader.hook:

[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = linux

[Action]
Depends = lilo
When = PostTransaction
Exec = /usr/bin/lilo

lighten_matplotlib.hook:
Deletes 3/4 of this huge package.

[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = python2-matplotlib

[Action]
When = PostTransaction
Exec = /usr/bin/rm -r /usr/lib/python2.7/site-packages/matplotlib/tests

gnomeless_gstreamer.hook:
Gets rid of gconf parts distributed with the plugins. As far as I know, there is no way a hook can stop it from pulling in the gconf dependency. This, I do with a dummy PKGBUILD that provides gconf.

[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = gstreamer0.10-good-plugins

[Action]
When = PostTransaction
Exec = /usr/bin/rm /usr/share/gconf/schemas/gstreamer0.10-good-plugins.schemas /usr/lib/gstreamer-0.10/libgstsouphttpsrc.so /usr/lib/gstreamer-0.10/libgstgconfelements.so

6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#2 2015-12-20 00:10:08

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,392
Website

Re: Some fun pacman hooks

ConnorBehan wrote:

lighten_matplotlib.hook:
Deletes 3/4 of this huge package.

[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = python2-matplotlib

[Action]
When = PostTransaction
Exec = /usr/bin/rm -r /usr/lib/python2.7/site-packages/matplotlib/tests

That should be a bug report...   Also in combination with this:

ConnorBehan wrote:

gnomeless_gstreamer.hook:
Gets rid of gconf parts distributed with the plugins. As far as I know, there is no way a hook can stop it from pulling in the gconf dependency. This, I do with a dummy PKGBUILD that provides gconf.

[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = gstreamer0.10-good-plugins

[Action]
When = PostTransaction
Exec = /usr/bin/rm /usr/share/gconf/schemas/gstreamer0.10-good-plugins.schemas /usr/lib/gstreamer-0.10/libgstsouphttpsrc.so /usr/lib/gstreamer-0.10/libgstgconfelements.so

use pacman's NoExtract config option - then pacman knows why these are missing.

Offline

#3 2015-12-20 19:43:12

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Re: Some fun pacman hooks

Oops, that's much better after "s|matplotlib/tests|matplotlib/tests/*|". For some reason I thought NoExtract wasn't working because it didn't accept directory names.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

Board footer

Powered by FluxBB