[OE-core] [PATCH 1/2] scripts/postinst-intercepts: add update_info_dir

Hongxu Jia hongxu.jia at windriver.com
Sat Oct 11 02:50:53 UTC 2014


We need to run it after all packages have been installed. Here is details:

NAME
  update_info_dir - update or create index file from all installed
  info files in directory

SYNOPSIS
  update_info_dir [options] [directory]

DESCRIPTION
  Update, or create, the index file dir of available documentation
  in $D/${infodir} (the default) or in given DIRECTORY. The index
  file info is the directory is usually presented by info browsers
  on startup.

OPTIONS
  -h,--help
    Display help and exit.

SEE ALSO
  emacs(1) info(1) install-info(1)

AUTHOR
  This manual page was written by Norbert Preining <preining at logic.at>,
  for the Debian GNU/Linux system (but may be used by others). This
  manual page was written for the Debian GNU/Linux distribution because
  the original script was designed  for  Debian  packaging system.

Signed-off-by: Norbert Preining <preining at logic.at>

Backport update-info-dir from ubuntu 1404, and add xz/bz2 compression support

[YOCTO #6751]

Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
---
 scripts/postinst-intercepts/update_info_dir | 77 +++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 scripts/postinst-intercepts/update_info_dir

diff --git a/scripts/postinst-intercepts/update_info_dir b/scripts/postinst-intercepts/update_info_dir
new file mode 100644
index 0000000..983d54f
--- /dev/null
+++ b/scripts/postinst-intercepts/update_info_dir
@@ -0,0 +1,77 @@
+#!/bin/sh
+# update-info-dir
+# create a dir file from all installed info files
+# Copyright 2009 Norbert Preining
+# GPLv2
+
+INFODIR=$D${infodir}
+
+set -e
+
+#
+# since user's environment is taken over into root account when sudo-ing
+# we don't want that one's user LANGUAGE setting changes the messages in
+# the dir file. Force it to C. See bug #536476
+LANGUAGE="C"
+LANG="C"
+
+Help ()
+{
+    echo "\
+SYNOPSIS: update-info-dir [-h,--help] [info-directory]
+
+(re-)creates the index of available documentation in info format
+(the file /usr/share/info/dir) which is usually presented by info browsers
+on startup."
+
+    exit 0
+}
+
+
+if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+    Help
+fi
+
+if [ -n "$1" ] ; then
+  INFODIR="$1"
+fi
+
+if [ ! -d "$INFODIR" ] ; then
+  echo "Not a directory: $INFODIR."
+  exit 0
+fi
+
+if [ -r "$INFODIR/dir" ] ; then
+  rm -f "$INFODIR/dir.old"
+  cp $INFODIR/dir $INFODIR/dir.old
+fi
+
+# we have to remove the dir file not make ginstall-info being surprised
+rm -f "$INFODIR/dir"
+
+errors=0
+find "$INFODIR" -type f | while read file ; do
+  case $file in
+    */dir|*/dir.old| \
+    *-[0-9]|*-[0-9].gz|*-[0-9].xz|*-[0-9].bz2| \
+    *-[1-9][0-9]|*-[1-9][0-9].gz|*-[1-9][0-9].xz|*-[1-9][0-9].bz2| \
+    *.png)
+      # these files are ignored
+      continue
+      ;;
+    *)
+      ${STAGING_BINDIR_NATIVE}/install-info "$file" "$INFODIR/dir" || {
+        errors=`expr $errors + 1`
+      }
+      ;;
+  esac
+done
+
+if [ $errors -gt 0 ] ; then
+  echo "Updating the index of info documentation produced $errors errors."
+  exit 1
+fi
+
+exit 0
+
+# vim:set expandtab tabstop=2: #
-- 
1.9.1




More information about the Openembedded-core mailing list