diff options
author | Steve Pfetsch <spfetsch@google.com> | 2020-09-16 04:28:06 -0700 |
---|---|---|
committer | Steve Pfetsch <spfetsch@google.com> | 2020-09-16 18:17:24 +0000 |
commit | b61a1b58155bea2702cb056494246c5a23fde525 (patch) | |
tree | e7564409af545add3910dae98e62bdbddfce1c2d | |
parent | 96395e89e7b8e44adebe85a9254e2e532cf238b2 (diff) | |
download | redbull-b61a1b58155bea2702cb056494246c5a23fde525.tar.gz |
[DO NOT MERGE] redbull: Fix race in init.twoshay.sh
Verify that the serial number is available before performing hash.
Bug: 168173860
Signed-off-by: Steve Pfetsch <spfetsch@google.com>
Change-Id: I32a4edb264cfbaeefa65a084f4681b22294e90a6
-rwxr-xr-x | init.twoshay.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/init.twoshay.sh b/init.twoshay.sh index 16a3edc2..c5af3aa8 100755 --- a/init.twoshay.sh +++ b/init.twoshay.sh @@ -2,6 +2,19 @@ # Implementation of A/B group selection - See b/161398758 seedfile=/sys/devices/platform/soc/soc:qcom,dsi-display-primary/panel_info/panel0/serial_number + +# Poll the file for up to 30 seconds +retries=30 +while [[ ! "$(cat $seedfile)" ]]; do + retries=$(($retries - 1)) + if [[ $retries == 0 ]]; then + setprop vendor.twoshay.study_group "failed" + exit + fi + + sleep 1 +done + sum=$(sha1sum $seedfile) result=$(expr $((16#${sum:1:1})) % 2) |