Launch a script at boot

About how to add support for the script in the path ‘system/etc/init.d/’ , You can follow below method to test by adb command.

$ adb root
$ adb remount
$ adb push userinit.sh /system/etc/init.d/userinit
$ adb shell vi /system/bin/preinstall.sh
$ adb sync 
$ adb reboot

Notice:

  1. The file ‘userinit.sh’ must be renamed as ‘userinit’

  2. Modify the file ‘system/bin/preinstall.sh’

@@ -3,6 +3,7 @@
 MARK=/data/local/symbol_thirdpart_apks_installed
 PKGS=/system/preinstall/
 
+busybox run-parts /system/etc/init.d/
 if [ ! -e $MARK ]; then
 echo "booting the first time, so pre-install some APKs."
1 Like