blob: 4b80fae3aff73040e0a497be4a4f255cb4101234 [file] [log] [blame]
Luca Weiss062595a2021-10-05 12:01:05 +02001#!/system/bin/sh
2
3# Check if this script should trigger, exit quietly otherwise.
4if [ ! -f /data/userdata_automation/trigger ]; then
5 echo >&2 "+++ SKIPPING automation setup for ATS. Trigger not set. +++"
6 exit 0
7fi
8
9settings_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.
16echo >&2 "+++ TRIGGERING AUTOMATION SETUP FOR ATS +++"
17
18# Move supplied adb public key to correct directory
19mv -v /data/userdata_automation/adb_keys /data/misc/adb/adb_keys
20chown -v 1000:2000 /data/misc/adb/adb_keys
21
22# Enable adb
23setprop persist.sys.usb.config adb
24settings_put global development_settings_enabled 1
25settings_put global verifier_verify_adb_installs 0
26settings_put global adb_enabled 1
27
28# Skip setupwizard
29settings_put global device_provisioned 1
30settings_put secure user_setup_complete 1
31
32# Remove trigger so we don't run again
33rm -v /data/userdata_automation/trigger
34
Karsten Tausche0fa3feb2021-10-19 11:38:44 +020035echo >&2 "+++ AUTOMATION: Waiting for late boot trigger. +++"
36while [ "$(getprop sys.boot_completed)" != "1" ]; do
37 # Full boot can take a while, especially after factory reset.
38 sleep 2
39done
40
41# Enable mobile data. Requires service `phone` to be running.
42svc data enable
43
Luca Weiss062595a2021-10-05 12:01:05 +020044echo >&2 "+++ TRIGGERING AUTOMATION SETUP FOR ATS DONE +++"