[PATCH setup 0/3] Setup replacement for incver_ifdep

Jon Turney jon.turney@dronecode.org.uk
Tue Nov 24 16:59:00 GMT 2015


On 23/11/2015 18:54, Achim Gratz wrote:
> Jon Turney writes:
>> 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.
>
> So, should we try to guard against that (installations on a USB stick
> are probably the only practical occurence these days)?  I wouldn't mind
> if we just unconditionally rebuild on FAT(32).

Thinking this over, it doesn't seem that hard to use a hash to determine 
if the directory has changed.

How about the attached?

(This will add a dependency on diffutils for cmp)

> Otherwise, it looks good and thanks for writing up a script.

-------------- next part --------------
#!/bin/bash

# If an .info file has been added/removed/replaced in /usr/share/info since the 
# last time this script ran, rebuild the info directory.  We don't simply check 
# /usr/share/info's mtime, as that isn't correctly maintained on a FAT 
# filesystem.

ls -n /usr/share/info/*info* | md5sum >/usr/share/info/.stamp.tmp

if ! cmp -s /usr/share/info/.stamp.tmp /usr/share/info/.stamp ; 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
    mv /usr/share/info/.stamp.tmp /usr/share/info/.stamp
else
    rm /usr/share/info/.stamp.tmp
fi


More information about the Cygwin-apps mailing list