]> git.pld-linux.org Git - packages/rpm-pld-macros.git/blobdiff - dokuwiki-find-lang.sh
- use systemd_booted to check if system is booted using systemd
[packages/rpm-pld-macros.git] / dokuwiki-find-lang.sh
index 630d09cb6c2e8a2073fb05c79e27ce714928913d..b9ef8293dfc0bfd777a9befc35a73c4c1070be39 100644 (file)
@@ -1,9 +1,19 @@
 #!/bin/sh
+PROG=${0##*/}
+if [ $# = 2 ]; then
+       # for using same syntax as rpm own find-lang
+       RPM_BUILD_ROOT=$1
+       shift
+fi
 dir=$RPM_BUILD_ROOT/usr/share/dokuwiki
 langfile=$1
+tmp=$(mktemp) || exit 1
+rc=0
 
-> $langfile
-find $dir -type d -name lang | while read dir; do
+find $dir -type d -name lang > $tmp
+
+echo '%defattr(644,root,root,755)' > $langfile
+while read dir; do
        echo "%dir ${dir#$RPM_BUILD_ROOT}" >> $langfile
        for dir in $dir/*; do
                lang=${dir##*/}
@@ -18,11 +28,32 @@ find $dir -type d -name lang | while read dir; do
                sl-si)
                        lang=sl
                ;;
+               id-ni)
+                       lang=id_NI
+               ;;
+               ca-valencia)
+                       lang=ca@valencia
+               ;;
+               de-informal)
+                       lang=de
+               ;;
                *-*)
-                       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
+               if [ "$lang" = "en" ]; then
+                       echo "${dir#$RPM_BUILD_ROOT}" >> $langfile
+               else
+                       echo "%lang($lang) ${dir#$RPM_BUILD_ROOT}" >> $langfile
+               fi
        done
-done
+done < $tmp
+
+if [ "$(grep -Ev '(^%defattr|^$)' $langfile | wc -l)" -le 0 ]; then
+       echo >&2 "$PROG: Error: international files not found!"
+       rc=1
+fi
+
+rm -f $tmp
+exit $rc
This page took 0.186609 seconds and 4 git commands to generate.