migrate.sh: fix parsing/formatting regressions

- DEVICE_INITIAL_SDK_INT value would erroneously be used for DEVICE if DEVICE was missing
- a malformed json trailing , on the last input file entry would break the output format
This commit is contained in:
Chris Renshaw
2024-04-07 02:40:51 -03:00
committed by GitHub
parent b4821fb03e
commit 25262ce07e

View File

@@ -15,7 +15,7 @@ esac;
item() { echo "- $@"; }
die() { [ "$INSTALL" ] || echo "$N$N! $@"; exit 1; }
grep_get_json() { eval set -- "$(cat "$FILE" | tr -d '\r\n' | grep -m1 -o "$1"'.*' | cut -d: -f2-)"; echo "$1" | sed -e 's|"|\\\\\\"|g' -e 's/[,}]$//'; }
grep_get_json() { eval set -- "$(cat "$FILE" | tr -d '\r\n' | grep -m1 -o "\"$1\""'.*' | cut -d: -f2-)"; echo "$1" | sed -e 's|"|\\\\\\"|g' -e 's|[,}]*$||'; }
grep_check_json() { grep -q "$1" "$FILE" && [ "$(grep_get_json $1)" ]; }
case "$1" in