From: Elan Ruusamäe Date: Fri, 30 Jan 2009 14:23:55 +0000 (+0000) Subject: - do not use subshell, so the exit code could be propagated X-Git-Tag: auto/th/dokuwiki-20090214-1~1 X-Git-Url: http://git.pld-linux.org/?p=packages%2Fdokuwiki-plugin-pagelist.git;a=commitdiff_plain;h=5054aed64fe0a17c20e486a63b144964837121c8 - do not use subshell, so the exit code could be propagated Changed files: dokuwiki-find-lang.sh -> 1.5 --- diff --git a/dokuwiki-find-lang.sh b/dokuwiki-find-lang.sh index 86f46fa..d11bb96 100644 --- a/dokuwiki-find-lang.sh +++ b/dokuwiki-find-lang.sh @@ -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 @@ find $dir -type d -name lang | while read dir; do 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