X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;ds=sidebyside;f=rpm-hrmib-cache;h=8ee25bb410e2bfff1b92a9531faefcd1d2f6becf;hb=6104726783760b84e6a8d305e2633caa66881518;hp=74af68d3e4eaffdbc7d7b06d5a32d937f926ebf8;hpb=265fe8d6a8d7564b46246bce6b794425148f36e0;p=packages%2Frpm.git diff --git a/rpm-hrmib-cache b/rpm-hrmib-cache index 74af68d..8ee25bb 100644 --- a/rpm-hrmib-cache +++ b/rpm-hrmib-cache @@ -1,16 +1,22 @@ #!/bin/sh -mydir=/var/cache/hrmib -mkdir -p $mydir || exit 1 -rm -f $mydir/* +build_hrmib_cache() { + # skip if no rpm(1), touch(1), xargs(1) + [ -x /bin/rpm -a -x /bin/touch -a -x /bin/xargs ] || return -rpm -qa --qf '%{name}-%{version}-%{release}.%{arch} %{installtime:date}\n' | \ -while read nvra idate ; do - case $nvra in - gpg-pubkey-*) - ;; - *) - touch -d "`echo $idate`" $mydir/$nvra - ;; - esac -done -touch $mydir + export LC_ALL=C + umask 002 + + mydir=/var/cache/hrmib + + echo >&2 "Populating $mydir with initial contents" + mkdir -p $mydir || return + echo $mydir/* | xargs rm -f + + buf=$(rpm --nodigest --nosignature -qa --qf '%{N}-%{V}-%{R}.%{ARCH} %{INSTALLTIME:date}\n') + echo "$buf" | while read nvra idate; do + touch -d "$idate" "$mydir/$nvra" + done + touch $mydir +} + +build_hrmib_cache