Skip to content

Commit

Permalink
migrate.sh: optionally add advanced settings to json
Browse files Browse the repository at this point in the history
  • Loading branch information
osm0sis committed Feb 2, 2024
1 parent 608e60a commit fa41829
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions module/migrate.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

case "$1" in
-h|--help|help) echo "sh migrate.sh [-f] [file]"; exit 0;;
-h|--help|help) echo "sh migrate.sh [-f] [-a] [file]"; exit 0;;
esac;

N="
Expand All @@ -21,6 +21,9 @@ grep_check_json() { grep -q "$1" "$FILE" && [ "$(grep_get_json "$1")" ]; }
case "$1" in
-f|--force|force) FORCE=1; shift;;
esac;
case "$1" in
-a|--advanced|advanced) ADVANCED=1; shift;;
esac;

if [ -f "$1" ]; then
FILE="$1";
Expand Down Expand Up @@ -100,8 +103,11 @@ echo "$N // System Properties";
echo ' "*.build.id": "'$ID'",';
echo ' "*.security_patch": "'$SECURITY_PATCH'",';
[ -z "$VNDK_VERSION" ] || echo ' "*.vndk_version": "'$VNDK_VERSION'",';
echo ' "*api_level": "'$DEVICE_INITIAL_SDK_INT'"';
echo "}") > "$DIR/custom.pif.json";
echo ' "*api_level": "'$DEVICE_INITIAL_SDK_INT'",';
if [ "$ADVANCED" ]; then
echo "$N // Advanced Settings";
echo ' "verbose_logs": "0",';
fi) | sed '$s/,/\n}/' > "$DIR/custom.pif.json";

[ "$INSTALL" ] || cat "$DIR/custom.pif.json";

0 comments on commit fa41829

Please sign in to comment.