]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
no bash needed, document and readability fixes
authorElan Ruusamäe <glen@pld-linux.org>
Sat, 5 Sep 2015 20:21:51 +0000 (23:21 +0300)
committerElan Ruusamäe <glen@pld-linux.org>
Sat, 5 Sep 2015 20:22:23 +0000 (23:22 +0300)
wwwbin/checkrepo.sh

index f391039eb1b10280da561f1044c41942df7e44fe..db2cff1bc34739323513d2f7b17956d6fc9964f7 100755 (executable)
@@ -1,14 +1,27 @@
-#!/bin/bash
-# it's bash because mksh can do only 32bit arithemtic
+#!/bin/sh
+# stat(1) each file in .info to see if they exist
 
 REPODIR=${1:-/home/pld/admins/th/ftp/test}
 
+# expand files from .info file
+expand_info() {
+       awk -F ':' -vD="$REPODIR/" '
+               /file:/ {
+                       if (/-debuginfo-/) {
+                               print D $2 "/debuginfo/" $3
+                       } else {
+                               print D $2 "/RPMS/" $3
+                       }
+               }
+       ' "$@"
+}
+
 i=0
 nn=
 ls -1 $REPODIR/SRPMS/RPMS | sed -rne "s/^((.+)-[^-]+-[^-]+\.src\.rpm)$/\1.info/p" | \
-while read pkg ; do
-       for f in `awk -F ':' -vD="$REPODIR/" '/file:/ { if ($0 ~ /-debuginfo-/) { print D $2 "/debuginfo/" $3 } else { print D $2 "/RPMS/" $3 }}' $REPODIR/SRPMS/.metadata/$pkg` ; do
-               if ! stat $f &>/dev/null ; then
+while read pkg; do
+       for f in $(expand_info $REPODIR/SRPMS/.metadata/$pkg); do
+               if ! stat $f >/dev/null; then
                        echo "!!!: $pkg : $f" >&2
                fi
        done
This page took 0.936508 seconds and 4 git commands to generate.