build/i18n-init.sh: add git support
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 6 Apr 2012 09:44:46 +0000 (09:44 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 6 Apr 2012 09:44:46 +0000 (09:44 +0000)
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
build/i18n-init.sh

index 9612068c91e2ab47456c3e49e467e868ba661c60..9a206bb2a769d38213975571a65facea9237dd42 100755 (executable)
@@ -1,14 +1,23 @@
 #!/bin/sh
 
 PATTERN=$1
+SCM=
 
-[ -z "$PATTERN" ] && PATTERN='*.pot'
+[ -d .svn ] && SCM="svn"
+[ -d .git ] && SCM="git"
+
+[ -z "$SCM" ] && {
+       echo "Unsupported SCM tool" >&2
+       exit 1
+}
+
+[ -z "$PATTERN" ] && PATTERN="*.pot"
 
 for lang in $(cd po; echo ?? ??_??); do
        for file in $(cd po/templates; echo $PATTERN); do
                if [ -f po/templates/$file -a ! -f "po/$lang/${file%.pot}.po" ]; then
                        msginit --no-translator -l "$lang" -i "po/templates/$file" -o "po/$lang/${file%.pot}.po"
-                       svn add "po/$lang/${file%.pot}.po"
+                       $SCM add "po/$lang/${file%.pot}.po"
                fi
        done
 done