Skip to content

Commit

Permalink
autopif2.sh: add -s / --strong output feature, fix grep errors
Browse files Browse the repository at this point in the history
  • Loading branch information
osm0sis authored Nov 7, 2024
1 parent 19d31cf commit 4e96fde
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions module/autopif2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ case "$HOME" in
esac;

case "$1" in
-h|--help|help) echo "sh autopif2.sh [-a]"; exit 0;;
-h|--help|help) echo "sh autopif2.sh [-a|-s]"; exit 0;;
-a|--advanced|advanced) ARGS="-a"; shift;;
-s|--strong|strong) ARGS="-a"; PATCH_COMMENT=1; spoofProvider=0; shift;;
esac;

echo "Pixel Beta pif.json generator script \
Expand Down Expand Up @@ -139,12 +140,15 @@ for MIGRATE in migrate.sh /data/adb/modules/playintegrityfix/migrate.sh; do
done;
if [ -f "$MIGRATE" ]; then
OLDJSON=/data/adb/modules/playintegrityfix/custom.pif.json;
[ -f "$OLDJSON" ] && grep -qE "verboseLogs|VERBOSE_LOGS" $OLDJSON && ARGS="-a";
if [ -f "$OLDJSON" ]; then
grep -q '//"\*.security_patch"' $OLDJSON && PATCH_COMMENT=1;
grep -qE "verboseLogs|VERBOSE_LOGS" $OLDJSON && ARGS="-a";
fi;
item "Converting pif.json to custom.pif.json with migrate.sh:";
rm -f custom.pif.json;
sh $MIGRATE -i $ARGS pif.json;
if [ -n "$ARGS" ]; then
grep_json() { grep -m1 "$1" $2 | cut -d\" -f4; }
grep_json() { [ -f "$2" ] && grep -m1 "$1" $2 | cut -d\" -f4; }
verboseLogs=$(grep_json "VERBOSE_LOGS" $OLDJSON);
ADVSETTINGS="spoofBuild spoofProps spoofProvider spoofSignature verboseLogs";
for SETTING in $ADVSETTINGS; do
Expand All @@ -153,7 +157,7 @@ if [ -f "$MIGRATE" ]; then
[ -n "$TMPVAL" ] && sed -i "s;\($SETTING\": \"\).;\1$TMPVAL;" custom.pif.json;
done;
fi;
grep -q '//"\*.security_patch"' $OLDJSON && sed -i 's;"\*.security_patch";//"\*.security_patch";' custom.pif.json;
[ "$PATCH_COMMENT" ] && sed -i 's;"\*.security_patch";//"\*.security_patch";' custom.pif.json;
sed -i "s;};\n // Beta Released: $BETA_REL_DATE\n // Estimated Expiry: $BETA_EXP_DATE\n};" custom.pif.json;
cat custom.pif.json;
fi;
Expand Down

0 comments on commit 4e96fde

Please sign in to comment.