]> git.pld-linux.org Git - packages/rpm.git/blobdiff - rpm-hrmib-cache
- move to function as i plan to inline this script to %post
[packages/rpm.git] / rpm-hrmib-cache
index 37363f36e25f3ca150a114834bd92da339b960f3..3d7de1f87085bc98c71056202f3af2ad8849b0d3 100644 (file)
@@ -1,24 +1,26 @@
 #!/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
+       mkdir -p $mydir || return
+       rm -f $mydir/*
 
-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
+       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
+}
 
-exit 0
+build_hrmib_cache
This page took 0.039843 seconds and 4 git commands to generate.