Files
device_google_bonito/init.firstboot.sh
Chris Fries 58111749eb Add init.firstboot.sh, for factory use case
In the factory they need an automated way to shut down the device after
setupwizard finishes, but we also don't want to let them talk to Android
over USB on a user / locked device.

When bootmode is "firstboot" (Set by bootloader), the device will wait
for USB cable to be disconnected, then shut down.

Bug: 110896488
Change-Id: Ic0b7d65cfc8727c74be507a858f32a68199d5fee
Merged-In: Ib09460b242a7c2149f816f8a13cca698e02745e7
2019-02-22 18:13:05 +00:00

19 lines
493 B
Bash
Executable File

#!/vendor/bin/sh
# Init starts this script in the factory, to trigger shutdown after
# setupwizard has started, and USB is removed.
# wait for system to settle down after sys.boot_complete
sleep 5
# Wait for USB to be removed.
type=`cat /sys/class/power_supply/usb/typec_mode`
while [ "x$type" != "xNothing attached" ]; do
echo Wait for \"$type\" == \"Nothing attached\"
sleep 1;
type=`cat /sys/class/power_supply/usb/typec_mode`
done;
# Shutdown
setprop sys.powerctl shutdown