]> git.pld-linux.org Git - packages/dokuwiki-plugin-pagelist.git/blob - dokuwiki-find-lang.sh
- do not use subshell, so the exit code could be propagated
[packages/dokuwiki-plugin-pagelist.git] / dokuwiki-find-lang.sh
1 #!/bin/sh
2 PROG=${0##*/}
3 dir=$RPM_BUILD_ROOT/usr/share/dokuwiki
4 langfile=$1
5 tmp=$(mktemp) || exit 1
6 rc=0
7
8 find $dir -type d -name lang > $tmp
9
10 echo '%defattr(644,root,root,755)' > $langfile
11 while read dir; do
12         echo "%dir ${dir#$RPM_BUILD_ROOT}" >> $langfile
13         for dir in $dir/*; do
14                 lang=${dir##*/}
15                 dir=${dir#$RPM_BUILD_ROOT}
16                 case "$lang" in
17                 zh-tw)
18                         lang=zh_TW
19                 ;;
20                 pt-br)
21                         lang=pt_BR
22                 ;;
23                 sl-si)
24                         lang=sl
25                 ;;
26                 id-ni)
27                         lang=id_NI
28                 ;;
29                 *-*)
30                         echo >&2 "ERROR: Need mapping for $lang!"
31                         rc=1
32                 ;;
33                 esac
34                 echo "%lang($lang) ${dir#$RPM_BUILD_ROOT}" >> $langfile
35         done
36 done < $tmp
37
38 if [ "$(egrep -v '(^%defattr|^$)' $langfile | wc -l)" -le 0 ]; then
39         echo >&2 "$PROG: Error: international files not found!"
40         rc=1
41 fi
42
43 rm -f $tmp
44 exit $rc
This page took 0.060415 seconds and 3 git commands to generate.