On 12/8/2014 11:48 AM, Achim Gratz wrote:
Ken Brown writes:
I'm not convinced that we need to worry so much about all these
details.  What if we just check (based on timestamps of files in
/etc/setup/*.lst.gz) whether anything has been installed into
/usr/info or /usr/share/info since we last did this check.  If so,
then just do exactly what the current update-info-dir.sh does.

We also need to track if something was deinstalled.  Unless we want to
force all packages to do the appropriate install-info calls themselves
in preremove and postinstall, of course.

autorebase can't get away with anything so simple, but it seems to me
that this is good enough for update_info_dir.

We can always fall back to what we are doing now, yes.  But I'd like to
see if it can be improved.

The attached script is what I had in mind. It's better than what we have now and could be a starting point.

Ken

#!/bin/bash

update () {
    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 --quiet $f /usr/share/info/dir
                ;;
        esac
    done
}

update_needed=no
marker_file=/usr/share/info/.updated
if [ ! -f ${marker_file} ]
then
    update_needed=yes
else
    for f in $(find /etc/setup -type f -name '*.lst.gz' -newer ${marker_file})
    do
        if gzip -d -c ${f} | grep -q usr/share/info -
        then
            update_needed=yes
            break
        fi
    done
fi
if [ ${update_needed} = "yes" ]
then
    update
fi
touch ${marker_file}

Reply via email to