From 6722c14397c3b44950baaac7484d4333b002d29d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 30 Nov 2021 09:22:01 +0100 Subject: [PATCH] MOBILE-3833 lang: Add suffix param to get_languages --- scripts/lang_functions.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/lang_functions.sh b/scripts/lang_functions.sh index ef7de3a0f..6b5b4ece3 100755 --- a/scripts/lang_functions.sh +++ b/scripts/lang_functions.sh @@ -102,6 +102,15 @@ function get_language { pushd $LANGPACKSFOLDER > /dev/null curl -s $MOODLEORG_URL/$lastversion/$lang.zip --output $lang.zip > /dev/null + size=$(du -k "$lang.zip" | cut -f 1) + if [ ! -n $lang.zip ] || [ $size -le 60 ]; then + echo "Wrong language name or corrupt file for $lang" + rm $lang.zip + + popd > /dev/null + return + fi + rm -R $lang > /dev/null 2>&1> /dev/null unzip -o -u $lang.zip > /dev/null @@ -114,6 +123,8 @@ function get_language { # Entry function to get all language files. function get_languages { + suffix=$1 + get_last_version if [ -d $LANGPACKSFOLDER ]; then @@ -131,6 +142,7 @@ function get_languages { if [ $AWS_SERVICE -eq 1 ]; then get_all_languages_aws + suffix='' else echo "Fallback language list will only get current installation languages" get_installed_languages @@ -138,5 +150,9 @@ function get_languages { for lang in $langs; do get_language "$lang" + + if [ $suffix != '' ]; then + get_language "$lang$suffix" + fi done }