]> git.pld-linux.org Git - packages/rpm-build-macros.git/blame_incremental - dokuwiki-find-lang.sh
- 1.681: _tomcatconfdir to /etc
[packages/rpm-build-macros.git] / dokuwiki-find-lang.sh
... / ...
CommitLineData
1#!/bin/sh
2PROG=${0##*/}
3if [ $# = 2 ]; then
4 # for using same syntax as rpm own find-lang
5 RPM_BUILD_ROOT=$1
6 shift
7fi
8dir=$RPM_BUILD_ROOT/usr/share/dokuwiki
9langfile=$1
10tmp=$(mktemp) || exit 1
11rc=0
12
13find $dir -type d -name lang > $tmp
14
15echo '%defattr(644,root,root,755)' > $langfile
16while read dir; do
17 echo "%dir ${dir#$RPM_BUILD_ROOT}" >> $langfile
18 for dir in $dir/*; do
19 lang=${dir##*/}
20 dir=${dir#$RPM_BUILD_ROOT}
21 case "$lang" in
22 zh-tw)
23 lang=zh_TW
24 ;;
25 pt-br)
26 lang=pt_BR
27 ;;
28 sl-si)
29 lang=sl
30 ;;
31 id-ni)
32 lang=id_NI
33 ;;
34 ca-valencia)
35 lang=ca@valencia
36 ;;
37 de-informal)
38 lang=de
39 ;;
40 zh-cn)
41 lang=zh_CN
42 ;;
43 *-*)
44 echo >&2 "ERROR: Need mapping for $lang!"
45 rc=1
46 ;;
47 esac
48 if [ "$lang" = "en" ]; then
49 echo "${dir#$RPM_BUILD_ROOT}" >> $langfile
50 else
51 echo "%lang($lang) ${dir#$RPM_BUILD_ROOT}" >> $langfile
52 fi
53 done
54done < $tmp
55
56if [ "$(grep -Ev '(^%defattr|^$)' $langfile | wc -l)" -le 0 ]; then
57 echo >&2 "$PROG: Error: international files not found!"
58 rc=1
59fi
60
61rm -f $tmp
62exit $rc
This page took 0.02877 seconds and 4 git commands to generate.