2013-04-05 07:05:07 +00:00
|
|
|
#!/bin/sh
|
2010-11-04 12:53:46 +00:00
|
|
|
#
|
|
|
|
# Registers or unregisters info files for a package.
|
|
|
|
#
|
|
|
|
# Arguments: $ACTION = [run/targets]
|
|
|
|
# $TARGET = [post-install/pre-remove]
|
|
|
|
# $PKGNAME
|
|
|
|
# $VERSION
|
|
|
|
# $UPDATE = [yes/no]
|
|
|
|
#
|
|
|
|
ACTION="$1"
|
|
|
|
TARGET="$2"
|
|
|
|
PKGNAME="$3"
|
|
|
|
VERSION="$4"
|
|
|
|
UPDATE="$5"
|
|
|
|
|
|
|
|
installinfo=usr/bin/install-info
|
|
|
|
infodir=usr/share/info
|
|
|
|
|
|
|
|
case "$ACTION" in
|
|
|
|
targets)
|
|
|
|
echo "post-install pre-remove"
|
|
|
|
;;
|
|
|
|
run)
|
|
|
|
[ ! -x "$installinfo" ] && exit 0
|
|
|
|
|
|
|
|
if [ -z "$info_files" ]; then
|
|
|
|
echo "Trigger info-files: empty info_files."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-02-25 18:13:44 +00:00
|
|
|
HOSTARCH=$(uname -m)
|
|
|
|
|
2010-11-04 12:53:46 +00:00
|
|
|
for f in ${info_files}; do
|
2013-04-05 07:05:07 +00:00
|
|
|
if [ "$f" = "/usr/share/info/dir" ]; then
|
|
|
|
continue
|
|
|
|
elif [ ! -f ".$f" ]; then
|
|
|
|
echo "WARNING: $f does not exist! skipping..."
|
|
|
|
continue
|
|
|
|
fi
|
2010-11-04 12:53:46 +00:00
|
|
|
|
|
|
|
case "$TARGET" in
|
|
|
|
post-install)
|
|
|
|
echo -n "Registering info file: $f... "
|
|
|
|
;;
|
|
|
|
pre-remove)
|
|
|
|
echo -n "Unregistering info file: $f... "
|
|
|
|
infoargs="--delete"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2013-02-25 18:13:44 +00:00
|
|
|
if [ "$XBPS_TARGET_ARCH" != "$HOST_ARCH" ]; then
|
|
|
|
# Use host utility
|
|
|
|
installinfo=install-info
|
|
|
|
fi
|
2010-11-04 12:53:46 +00:00
|
|
|
$installinfo $infoargs ./$f $infodir/dir 2>/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "done."
|
|
|
|
else
|
|
|
|
echo "failed!"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|