SOURCES: dokuwiki-find-lang.sh - do not use subshell, so the exit code coul...

glen glen at pld-linux.org
Fri Jan 30 15:24:01 CET 2009


Author: glen                         Date: Fri Jan 30 14:24:01 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- do not use subshell, so the exit code could be propagated

---- Files affected:
SOURCES:
   dokuwiki-find-lang.sh (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/dokuwiki-find-lang.sh
diff -u SOURCES/dokuwiki-find-lang.sh:1.4 SOURCES/dokuwiki-find-lang.sh:1.5
--- SOURCES/dokuwiki-find-lang.sh:1.4	Wed Jan 28 14:47:59 2009
+++ SOURCES/dokuwiki-find-lang.sh	Fri Jan 30 15:23:55 2009
@@ -2,9 +2,13 @@
 PROG=${0##*/}
 dir=$RPM_BUILD_ROOT/usr/share/dokuwiki
 langfile=$1
+tmp=$(mktemp) || exit 1
+rc=0
+
+find $dir -type d -name lang > $tmp
 
 echo '%defattr(644,root,root,755)' > $langfile
-find $dir -type d -name lang | while read dir; do
+while read dir; do
 	echo "%dir ${dir#$RPM_BUILD_ROOT}" >> $langfile
 	for dir in $dir/*; do
 		lang=${dir##*/}
@@ -23,15 +27,18 @@
 			lang=id_NI
 		;;
 		*-*)
-			echo >&2 "Need mapping for $lang!"
-			exit 1
+			echo >&2 "ERROR: Need mapping for $lang!"
+			rc=1
 		;;
 		esac
 		echo "%lang($lang) ${dir#$RPM_BUILD_ROOT}" >> $langfile
 	done
-done
+done < $tmp
 
 if [ "$(egrep -v '(^%defattr|^$)' $langfile | wc -l)" -le 0 ]; then
 	echo >&2 "$PROG: Error: international files not found!"
-	exit 1
+	rc=1
 fi
+
+rm -f $tmp
+exit $rc
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/dokuwiki-find-lang.sh?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list