]> git.pld-linux.org Git - packages/rpm-pld-macros.git/blame_incremental - dokuwiki-find-lang.sh
- update discarded php4 pkgs
[packages/rpm-pld-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 *-*)
41 echo >&2 "ERROR: Need mapping for $lang!"
42 rc=1
43 ;;
44 esac
45 if [ "$lang" = "en" ]; then
46 echo "${dir#$RPM_BUILD_ROOT}" >> $langfile
47 else
48 echo "%lang($lang) ${dir#$RPM_BUILD_ROOT}" >> $langfile
49 fi
50 done
51done < $tmp
52
53if [ "$(grep -Ev '(^%defattr|^$)' $langfile | wc -l)" -le 0 ]; then
54 echo >&2 "$PROG: Error: international files not found!"
55 rc=1
56fi
57
58rm -f $tmp
59exit $rc
This page took 0.028722 seconds and 4 git commands to generate.