On 20/10/2015 11:21, Corinna Vinschen wrote:
On Oct 19 19:21, Achim Gratz wrote:
Corinna Vinschen writes:
I agree. Actually, considering that the info files are stored in just a
single well-known directory, /usr/share/info(*), and further considering
that updated files are rewritten when overwritten, shouldn't it be entirely
sufficient if the update_info_dir script performs a simple test like this:
- Does /usr/share/info/dirs exist?
No -> run install-info
Yes -> Is /usr/share/info/dirs mtime < /usr/share/info mtime?
No -> Do nothing
Yes -> run install-info
So, this is actually quite straightforward to write, and
/etc/postinstall/0p_update-info-dir.sh becomes the attached.
Can this be relied on for all possible file systems?
Not on FAT. But then again, FAT is not really a filesystem, rather just
a failed try.
But yes, this does nothing useful if /usr/share/info is on a FAT
filesystem, as the mtime doesn't change.
#!/bin/bash
# if /usr/share/info is newer than /usr/share/info/dir, an .info file has been
# added/removed/replaced since the last time we rebuilt the info directory
if [ /usr/share/info -nt /usr/share/info/dir ] ; then
echo "Rebuilding info directory"
rm -f /usr/share/info/dir.info /usr/share/info/dir
for f in /usr/share/info/*; do
case "$f" in
*\**)
;;
*/dir|*/dir.info*)
;;
*-[0123456789]*)
;;
*)
install-info $f /usr/share/info/dir ||
install-info --entry="* $$f ($f): $$f" $$f /usr/share/info/dir
;;
esac
done
fi