Improve the info-files and register-shell triggers.

This avoids the need of having to create a new file in pkg metadata
dir with a few lines and puts all them in the INSTALL/REMOVE
scripts.

--HG--
extra : convert_revision : 2dc1d3f6ddcc6aec7dadf14df475c32959df0aba
This commit is contained in:
Juan RP 2009-07-30 12:34:31 +02:00
parent 8a31007139
commit 76c23bbd96
6 changed files with 71 additions and 54 deletions

View file

@ -28,7 +28,8 @@ xbps_write_metadata_scripts_pkg()
local action="$1"
local metadir="${DESTDIR}/var/db/xbps/metadata/$pkgname"
local tmpf=$(mktemp -t xbps-install.XXXXXXXXXX) || exit 1
local targets found
local fpattern="s|${DESTDIR}||g;s|^\./$||g;/^$/d"
local targets found info_files
case "$action" in
install) ;;
@ -60,6 +61,32 @@ VERSION="\$3"
_EOF
#
# Handle GNU Info files.
#
if [ -d "${DESTDIR}/usr/share/info" ]; then
unset info_files
for f in $(find ${DESTDIR}/usr/share/info -type f); do
j=$(echo $f|sed -e "$fpattern")
[ "$j" = "" ] && continue
[ "$j" = "/usr/share/info/dir" ] && continue
if [ -z "$info_files" ]; then
info_files="$j"
else
info_files="$info_files $j"
fi
done
if [ -n "${info_files}" ]; then
for f in ${triggers}; do
[ "$f" = "info-files" ] && found=1
done
[ -z "$found" ] && triggers="$triggers info-files"
unset found
echo "export info_files=\"${info_files}\"" >> $tmpf
echo >> $tmpf
fi
fi
#
# Handle OpenRC services.
#
@ -68,6 +95,19 @@ _EOF
echo >> $tmpf
fi
#
# (Un)Register a shell in /etc/shells.
#
if [ -n "${register_shell}" ]; then
for f in ${triggers}; do
[ "$f" = "register-shell" ] && found=1
done
[ -z "$found" ] && triggers="$triggers register-shell"
unset found
echo "export register_shell=\"${register_shell}\"" >> $tmpf
echo >> $tmpf
fi
#
# Handle SGML/XML catalog entries via xmlcatmgr.
#