]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm-hrmib-cache
- teach rpm how to read /proc files
[packages/rpm.git] / rpm-hrmib-cache
index 1f96c6e53d6d644ad1dd2a45eeecffbf15ce220a..8ee25bb410e2bfff1b92a9531faefcd1d2f6becf 100644 (file)
@@ -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
This page took 0.02603 seconds and 4 git commands to generate.