X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm.git;a=blobdiff_plain;f=rpm-hrmib-cache;h=096e7d84cbf6ac503b630e6c9bebf654c5d0ab25;hp=37363f36e25f3ca150a114834bd92da339b960f3;hb=3f450bf0ee978615bb17b0743cf32ad902d8ffcb;hpb=b678ebfd04fa584aab9647518b424d0d45472240 diff --git a/rpm-hrmib-cache b/rpm-hrmib-cache index 37363f3..096e7d8 100644 --- a/rpm-hrmib-cache +++ b/rpm-hrmib-cache @@ -1,24 +1,22 @@ #!/bin/sh -# skip if no rpm(1) or touch(1) -[ -x /bin/rpm -a -x /bin/touch ] || exit 0 +build_hrmib_cache() { + # skip if no rpm(1) or touch(1) + [ -x /bin/rpm -a -x /bin/touch ] || return -export LC_ALL=C -umask 002 + export LC_ALL=C + umask 002 -mydir=/var/cache/hrmib -mkdir -p $mydir || exit 0 -rm -f $mydir/* + mydir=/var/cache/hrmib -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 + echo >&2 "Populating $mydir with initial contents" + mkdir -p $mydir || return + rm -f $mydir/* -exit 0 + 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