X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=rpm-hrmib-cache;h=8ee25bb410e2bfff1b92a9531faefcd1d2f6becf;hb=0ffaea8bcbe38f0e29f90d8807c1fe09b5bf50bb;hp=1f96c6e53d6d644ad1dd2a45eeecffbf15ce220a;hpb=fcab2bdecd477af8b469546238694f9d2f11fb1e;p=packages%2Frpm.git diff --git a/rpm-hrmib-cache b/rpm-hrmib-cache index 1f96c6e..8ee25bb 100644 --- a/rpm-hrmib-cache +++ b/rpm-hrmib-cache @@ -1,19 +1,22 @@ #!/bin/sh -export LC_ALL=C -umask 002 +build_hrmib_cache() { + # skip if no rpm(1), touch(1), xargs(1) + [ -x /bin/rpm -a -x /bin/touch -a -x /bin/xargs ] || return -mydir=/var/cache/hrmib -mkdir -p $mydir || exit 1 -rm -f $mydir/* + export LC_ALL=C + umask 002 -buf=$(rpm --nodigest --nosignature -qa --qf '%{name}-%{version}-%{release}.%{arch} %{installtime:date}\n') -echo "$buf" | while read nvra idate; do - case $nvra in - gpg-pubkey-*) - ;; - *) - touch -d "$idate" "$mydir/$nvra" - ;; - esac -done -touch $mydir + 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