2009-03-12 11:16:08 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Registers or unregisters info files for a package.
|
|
|
|
#
|
|
|
|
# Arguments: $1 = action [run/targets]
|
|
|
|
# $2 = target [post-install/pre-remove]
|
|
|
|
# $3 = pkgname
|
|
|
|
#
|
2009-05-19 02:13:58 +02:00
|
|
|
xbps_metadir=var/db/xbps/metadata
|
|
|
|
finfometa=$xbps_metadir/$3/info-files
|
|
|
|
installinfo=usr/bin/install-info
|
|
|
|
infodir=usr/share/info
|
2009-03-12 11:16:08 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
cat $finfometa | while read line; do
|
|
|
|
[ ! -f ./$line ] && continue
|
2009-03-17 04:30:32 +01:00
|
|
|
[ "$line" = "/usr/share/info/dir" ] && continue
|
2009-03-12 11:16:08 +01:00
|
|
|
|
|
|
|
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
|