From 3f346f373543b7ffa51830a27853280c594e354a Mon Sep 17 00:00:00 2001 From: Chris Renshaw Date: Tue, 22 Oct 2024 23:14:18 -0300 Subject: [PATCH] autopif2.sh: add test and busybox fallback for broken ROM toybox grep - outdated/broken toybox grep would ignore -A1 if -m1 was present --- module/autopif2.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/module/autopif2.sh b/module/autopif2.sh index f71cb66..0192b99 100644 --- a/module/autopif2.sh +++ b/module/autopif2.sh @@ -54,6 +54,14 @@ if date -D '%s' -d "$(date '+%s')" 2>&1 | grep -qE "bad date|invalid option"; th fi; fi; +if ! echo "A\nB" | grep -m1 -A1 "A" | grep -q "B"; then + if ! find_busybox; then + die "grep broken"; + else + grep() { $BUSYBOX grep "$@"; } + fi; +fi; + if [ "$DIR" = /data/adb/modules/playintegrityfix ]; then DIR=$DIR/autopif2; mkdir -p $DIR;