void-packages/triggers/info-files
Juan RP bbcc9c4b13 Add a trigger for creating/updating the initramfs.
It's activated at post-install time, and only if template uses:
triggers="initramfs-tools". Use it in the kernel package.

Also print a message when a trigger is being run.

--HG--
extra : convert_revision : 3f2a0c113ed523e4b09822665cf6d94e30b7d1e4
2009-03-12 11:50:46 +01:00

56 lines
988 B
Bash
Executable file

#!/bin/sh
#
# Registers or unregisters info files for a package.
#
# Arguments: $1 = action [run/targets]
# $2 = target [post-install/pre-remove]
# $3 = pkgname
#
trigger="info-files"
xbps_metadir="./var/db/xbps/metadata"
finfometa="$xbps_metadir/$3/$trigger"
installinfo="./usr/bin/install-info"
infodir="./usr/share/info"
case "$1" in
targets)
echo "post-install pre-remove"
;;
run)
[ ! -x $installinfo ] && exit 0
if [ ! -r $finfometa ]; then
echo "$trigger: can't find info-files in metadata directory!"
exit 1
fi
echo "Running $trigger trigger..."
cat $finfometa | while read line; do
[ ! -f ./$line ] && continue
case "$2" in
post-install)
echo -n "Registering info file: $line... "
;;
pre-remove)
echo -n "Unregistering info file: $line... "
infoargs="--delete"
;;
esac
$installinfo $infoargs ./$line $infodir/dir 2>/dev/null
if [ $? -eq 0 ]; then
echo "done."
else
echo "failed!"
fi
done
;;
*)
exit 1
;;
esac
exit 0