You are not logged in.
Pages: 1
Stupid hook title, but I'm sure some people remember the days when docs weren't included in Arch. And maybe some people even use "!docs" makepkg flags and configure pacman with "NoExtract = usr/share/doc/*". For the trickier stuff, I'm going to see how it goes using these hooks.
remove_gtk_doc.hook:
Deleting all docs in this directory is the same as deleting the directory itself *unless* you have gtk-doc installed. This puts some crucial files in it.
[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = usr/share/gtk-doc/*
[Action]
When = PostTransaction
Exec = /etc/pacman.d/hooks/remove_gtk_doc.sh
NeedsTargets
remove_gtk_doc.sh:
#!/bin/bash
OWNER=""
while read TARGET; do
[[ -f "$TARGET" ]] || continue
if [[ $OWNER == "" ]]; then
OWNER=`pacman -Qoq "$TARGET"`
fi
if [[ $OWNER != "gtk-doc" ]]; then
rm "/$TARGET"
fi
done
info_convert.hook:
Instead of deleting info pages, this first produces a corresponding man page using info2man.
[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = usr/share/info/*.info{,.gz}
[Action]
Depends = info2man
When = PostTransaction
Exec = /etc/pacman.d/hooks/info_convert.sh
NeedsTargets
info_convert.sh:
#!/bin/bash
while read TARGET; do
[[ -f "$TARGET" ]] || continue
if [[ $TARGET == *.gz ]]; then
gunzip "$TARGET"
TARGET=${TARGET/.gz/}
fi
NAME=`basename "$TARGET"`
info2man "/$TARGET" > /usr/share/man/manm/$NAME
gzip /usr/share/man/manm/$NAME
rm "/$TARGET"
done
manm_empty.hook:
Since I arbitrarily decided that "manm" was a good place to put "info turned man" files, I should keep that directory free of other stuff. Fortunately, the only files I know that get placed in manm are from openmotif. These can be put in mann instead. That way mann becomes the "slightly non-conforming toolkit documentation dir" instead of just the "Tcl/Tk documentation dir".
[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = usr/share/man/manm/*
[Action]
When = PostTransaction
Exec = /usr/bin/mv /usr/share/man/manm/* /usr/share/man/mann/
man_sort.hook:
I don't feel like deleting non-English man pages, but I still want them moved so that everything immediately inside /usr/share/man starts with "man". If you use one of these locales, just tweak the script so that it replaces the English version or backs it up as $NAM-en.$NUM.gz.
[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = usr/share/man/[!man]*
[Action]
When = PostTransaction
Exec = /etc/pacman.d/hooks/man_sort.sh
NeedsTargets
man_sort.sh:
#!/bin/bash
while read TARGET; do
[[ -f "$TARGET" ]] || continue
FIL=`basename "$TARGET"`
DIR=`echo $TARGET | sed -e 's|/usr/share/man/||' | sed -e 's|/.*||'`
# Split this into "NAM.NUM.gz"
NUM=`echo $FIL | sed -e 's|\.gz$||' | rev | sed -e 's|\..*||' | rev`
NAM=`echo $FIL | sed -e "s|.$NUM.gz||"`
mv "/$TARGET" /usr/share/man/man$NUM/$NAM-$DIR.$NUM.gz
done
Last edited by ConnorBehan (2015-12-21 03:24:52)
6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.
Offline
remove_gtk_doc.hook:
NoExtract = usr/share/gtk-doc/* !usr/share/gtk-doc/data/*
info_convert.hook:
This will require another hook to remove the man packages when the phantom info file is "removed" by pacman (that should work!)
man_sort.hook - easy just not to extract them:
NoExtract = usr/share/man/* !usr/share/man/man*
Also, I'm guessing there is about a handful of people on the forums who actually know what these files are...
Offline
Also, I'm guessing there is about a handful of people on the forums who actually know what these files are...
Maybe more... you have been talking up the imminent arrival of pacman hooks for some time now. Perl have delivered 6, Drupal 8: the pressure is on!
Offline
Within a month...
Offline
Pacman hooks: An opportunity for me to indirectly ask Allan for configuration tips that I could've learned years ago. Here's the info removal stuff by the way.
info_remove.hook:
[Trigger]
Operation = Remove
Type = File
Target = usr/share/info/*.info{,.gz}
[Action]
When = PostTransaction
Exec = /etc/pacman.d/hooks/info_remove.sh
NeedsTargets
info_remove.sh:
#!/bin/bash
while read TARGET; do
TARGET=${TARGET/.gz/}
NAME=`basename "$TARGET"`
rm /usr/share/man/manm/$NAME.gz
done
6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.
Offline
Pages: 1