Luca Weiss | 062595a | 2021-10-05 12:01:05 +0200 | [diff] [blame] | 1 | #!/system/bin/sh |
| 2 | |
| 3 | # Check if this script should trigger, exit quietly otherwise. |
| 4 | if [ ! -f /data/userdata_automation/trigger ]; then |
| 5 | echo >&2 "+++ SKIPPING automation setup for ATS. Trigger not set. +++" |
| 6 | exit 0 |
| 7 | fi |
| 8 | |
| 9 | settings_put() { |
| 10 | echo >&2 "[automation_setup] settings put $*" |
| 11 | # -w: Wait for the service to be ready, as we're running in early boot |
| 12 | cmd -w settings put "$@" |
| 13 | } |
| 14 | |
| 15 | # Output on stderr, to be picked up via stdio_to_kmsg on kmsg. |
| 16 | echo >&2 "+++ TRIGGERING AUTOMATION SETUP FOR ATS +++" |
| 17 | |
| 18 | # Move supplied adb public key to correct directory |
| 19 | mv -v /data/userdata_automation/adb_keys /data/misc/adb/adb_keys |
| 20 | chown -v 1000:2000 /data/misc/adb/adb_keys |
| 21 | |
| 22 | # Enable adb |
| 23 | setprop persist.sys.usb.config adb |
| 24 | settings_put global development_settings_enabled 1 |
| 25 | settings_put global verifier_verify_adb_installs 0 |
| 26 | settings_put global adb_enabled 1 |
| 27 | |
| 28 | # Skip setupwizard |
| 29 | settings_put global device_provisioned 1 |
| 30 | settings_put secure user_setup_complete 1 |
| 31 | |
| 32 | # Remove trigger so we don't run again |
| 33 | rm -v /data/userdata_automation/trigger |
| 34 | |
Karsten Tausche | 0fa3feb | 2021-10-19 11:38:44 +0200 | [diff] [blame^] | 35 | echo >&2 "+++ AUTOMATION: Waiting for late boot trigger. +++" |
| 36 | while [ "$(getprop sys.boot_completed)" != "1" ]; do |
| 37 | # Full boot can take a while, especially after factory reset. |
| 38 | sleep 2 |
| 39 | done |
| 40 | |
| 41 | # Enable mobile data. Requires service `phone` to be running. |
| 42 | svc data enable |
| 43 | |
Luca Weiss | 062595a | 2021-10-05 12:01:05 +0200 | [diff] [blame] | 44 | echo >&2 "+++ TRIGGERING AUTOMATION SETUP FOR ATS DONE +++" |