diff --git a/shutils/metadata.sh b/shutils/metadata.sh index c44bbcb4e22..f08fbd0a994 100644 --- a/shutils/metadata.sh +++ b/shutils/metadata.sh @@ -115,7 +115,6 @@ xbps_write_metadata_pkg_real() # Write the files.plist file. TMPFLIST=$(mktemp -t flist.XXXXXXXXXX) || exit 1 TMPFPLIST=$(mktemp -t fplist.XXXXXXXXXX) || exit 1 - TMPINFOLIST=$(mktemp -t infolist.XXXXXXXXXX) || exit 1 # # Find out if this package contains info files and compress @@ -245,18 +244,6 @@ xbps_write_metadata_pkg_real() echo "" >> $TMPFPLIST sed -i -e /^$/d $TMPFLIST - # - # Find out if this package contains info files and write - # a list will all them in a file. - # - if [ -d "${DESTDIR}/usr/share/info" ]; then - for f in $(find ${DESTDIR}/usr/share/info -type f); do - j=$(echo $f|sed -e "$fpattern") - [ "$j" = "" ] && continue - echo "$j" >> $TMPINFOLIST - done - fi - # Write the props.plist file. local TMPFPROPS=$(mktemp -t fprops.XXXXXXXXXX) || exit 1 @@ -345,19 +332,6 @@ _EOF fi mv -f $TMPFPLIST $metadir/files.plist mv -f $TMPFPROPS $metadir/props.plist - if [ -s $TMPINFOLIST ]; then - mv -f $TMPINFOLIST $metadir/info-files - else - rm -f $TMPINFOLIST - fi - - # Register the shells into /etc/shells if requested. - if [ -n "${register_shell}" ]; then - triggers="$triggers register-shell" - for f in ${register_shell}; do - echo $f >> $metadir/shells - done - fi $XBPS_REGPKGDB_CMD sanitize-plist $metadir/files.plist $XBPS_REGPKGDB_CMD sanitize-plist $metadir/props.plist diff --git a/shutils/metadata_scripts.sh b/shutils/metadata_scripts.sh index 80ecd4a3c25..85d7a8c1e10 100644 --- a/shutils/metadata_scripts.sh +++ b/shutils/metadata_scripts.sh @@ -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. # diff --git a/templates/texinfo/INSTALL b/templates/texinfo/INSTALL index 2ba5fb58f8a..5506a5a7359 100644 --- a/templates/texinfo/INSTALL +++ b/templates/texinfo/INSTALL @@ -1,8 +1,8 @@ # # This script registers all currently installed info files. # -texinfo_files="info.info.gz info-stnd.info.gz texinfo.gz - texinfo-1.gz texinfo-2.gz texinfo-3.gz" +texinfo_files="info.info.gz info-stnd.info.gz texinfo.gz" +texinfo_files="${texinfo_files} texinfo-1.gz texinfo-2.gz texinfo-3.gz" case "${ACTION}" in pre) @@ -20,6 +20,9 @@ post) continue fi echo -n "Registering info file: ${file#.}... " + if [ "${file#.}" = "/usr/share/info/dir" ]; then + continue + fi install-info $file ./usr/share/info/dir 2> /dev/null if [ $? -eq 0 ]; then echo "done." diff --git a/templates/xbps-base-files/template b/templates/xbps-base-files/template index 45d1ea462de..8f1a53c6398 100644 --- a/templates/xbps-base-files/template +++ b/templates/xbps-base-files/template @@ -1,6 +1,6 @@ # Template file for 'xbps-base-files' pkgname=xbps-base-files -version=0.18 +version=0.19 build_style=custom-install short_desc="xbps base system files" maintainer="Juan RP " diff --git a/triggers/info-files b/triggers/info-files index 124d64423f4..9abfeb4ba69 100755 --- a/triggers/info-files +++ b/triggers/info-files @@ -6,8 +6,6 @@ # $2 = target [post-install/pre-remove] # $3 = pkgname # -xbps_metadir=var/db/xbps/metadata -finfometa=$xbps_metadir/$3/info-files installinfo=usr/bin/install-info infodir=usr/share/info @@ -16,28 +14,27 @@ targets) echo "post-install pre-remove" ;; run) - [ ! -x $installinfo ] && exit 0 + [ ! -x "$installinfo" ] && exit 0 - if [ ! -r $finfometa ]; then - echo "$trigger: can't find info-files in metadata directory!" + if [ -z "$info_files" ]; then + echo "Trigger info-files: empty info_files." exit 1 fi - cat $finfometa | while read line; do - [ ! -f ./$line ] && continue - [ "$line" = "/usr/share/info/dir" ] && continue + for f in ${info_files}; do + [ "$f" = "/usr/share/info/dir" ] && continue case "$2" in post-install) - echo -n "Registering info file: $line... " + echo -n "Registering info file: $f... " ;; pre-remove) - echo -n "Unregistering info file: $line... " + echo -n "Unregistering info file: $f... " infoargs="--delete" ;; esac - $installinfo $infoargs ./$line $infodir/dir 2>/dev/null + $installinfo $infoargs ./$f $infodir/dir 2>/dev/null if [ $? -eq 0 ]; then echo "done." else diff --git a/triggers/register-shell b/triggers/register-shell index 1669f47f6e5..6b1a46783d4 100755 --- a/triggers/register-shell +++ b/triggers/register-shell @@ -7,7 +7,6 @@ # $3 = pkgname # $4 = version # -shells_file=var/db/xbps/metadata/$3/shells case "$1" in targets) @@ -15,21 +14,25 @@ targets) ;; run) [ "$2" != "post-install" -a "$2" != "post-remove" ] && exit 1 - [ ! -f ${shells_file} ] && exit 1 + + if [ -z "$register_shell" ]; then + echo "Trigger register-shell: empty \$register_shell!" + exit 1 + fi case "$2" in post-install) if [ ! -f etc/shells ]; then - cat ${shells_file} | while read line; do - echo $line >> etc/shells - echo "Registered $line into /etc/shells." + for f in ${register_shell}; do + echo $f >> etc/shells + echo "Registered $f into /etc/shells." done chmod 644 etc/shells else - cat ${shells_file} | while read line; do - if ! grep -q $line etc/shells; then - echo $line >> etc/shells - echo -n "Registered $line into " + for f in ${register_shell}; do + if ! grep -q $f etc/shells; then + echo $f >> etc/shells + echo -n "Registered $f into " echo "/etc/shells." fi done @@ -37,11 +40,11 @@ run) ;; post-remove) if [ -f etc/shells ]; then - cat ${shells_file} | while read line; do - if grep -q $line etc/shells; then - shell=$(echo $line|sed "s|\\/|\\\/|g") + for f in ${register_shell}; do + if grep -q $f etc/shells; then + shell=$(echo $f|sed "s|\\/|\\\/|g") sed -i -e "/$shell/d" etc/shells - echo -n "Unregistered $line from " + echo -n "Unregistered $f from " echo "/etc/shells." fi done