summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/pull_metadata.sh28
1 files changed, 23 insertions, 5 deletions
diff --git a/scripts/pull_metadata.sh b/scripts/pull_metadata.sh
index a9156a8c..50b9e301 100755
--- a/scripts/pull_metadata.sh
+++ b/scripts/pull_metadata.sh
@@ -3,7 +3,12 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
-L10N_DIR="$(cd "$PROJECT_ROOT/../l10n" && pwd)"
+L10N_DIR="$(cd "$PROJECT_ROOT/../l10n" && pwd || echo Oops...)"
+echo $L10N_DIR
+if [ ! -d "$L10N_DIR" ]; then
+ echo "L10N_DIR not found: you need to checkout https://0xacab.org/leap/l10n/ next to the bitmask_android repository.";
+ exit 1
+fi
MODE="${1:-normal}" # normal|custom
case "$MODE" in
@@ -11,15 +16,28 @@ case "$MODE" in
*) echo "Usage: $0 [normal|custom]"; exit 1 ;;
esac
-SRC_GLOB="$L10N_DIR/bitmask-playstore-metadata/*.json"
-OUT_BASE="$PROJECT_ROOT/src/${MODE}ProductionFat/fastlane/metadata/android"
-
command -v jq >/dev/null 2>&1 || { echo "Missing jq"; exit 1; }
+# ensure the right l10n branch is checked out
+cd $L10N_DIR
+if [ ${MODE} == "normal" ]; then
+ git checkout bitmask-playstore
+ git pull
+ SRC_GLOB="$L10N_DIR/bitmask-playstore-metadata/*.json"
+else
+ git checkout bitmask.riseupvpn-playstore-metadata
+ git pull
+ SRC_GLOB="$L10N_DIR/bitmask.riseupvpn-playstore-metadata/*.json"
+fi
+cd -
+
+OUT_BASE="$PROJECT_ROOT/src/${MODE}ProductionFat/fastlane/metadata/android"
+
+# iterate through translations and parse them to fastlane files
for json in $SRC_GLOB; do
[ -e "$json" ] || break
lang="$(basename "$json" .json)"
- echo "updating meta data for langauge $lang"
+ echo "updating meta data for language $lang"
out_dir="$OUT_BASE/$lang"
mkdir -p "$out_dir"