[projects/pld-ftp-admin] no bash needed, document and readability fixes

glen glen at pld-linux.org
Sat Sep 5 22:22:52 CEST 2015


commit 2ef952ab2f6d0462eaf027b965ec741f682db0de
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Sat Sep 5 23:21:51 2015 +0300

    no bash needed, document and readability fixes

 wwwbin/checkrepo.sh | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/wwwbin/checkrepo.sh b/wwwbin/checkrepo.sh
index f391039..db2cff1 100755
--- a/wwwbin/checkrepo.sh
+++ b/wwwbin/checkrepo.sh
@@ -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
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/2ef952ab2f6d0462eaf027b965ec741f682db0de



More information about the pld-cvs-commit mailing list