[Desire Android Development] moebius83:
I tried to find a way to run script from init.rc without needing to re-build and re-flash the boot.img and the only thing I came up with was this install-recovery.sh trick...

After other tryouts it really seems HTC stock rom has a sort of asynchronous init, if you do an adb logcat on boot.

Do you see the whole data2whatever script printing everything at once with adb logcat? this is what happen on my phone. (I changed the script a little bit)

--------- beginning of /dev/log/system
I/Vold ( 61): Vold 2.1 (the revenge) firing up
I/Netd ( 62): Netd 1.0 starting
D/Vold ( 61): Volume sdcard state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 61): Volume sdcard state changing 0 (No-Media) -> 2 (Pending)
D/Vold ( 61): Volume sdcard state changing 2 (Pending) -> 1 (Idle-Unmounted)
I/SysInit ( 87): Starting sysinit scripts from /system/etc/init.d
I//system/xbin/busybox( 88): __ __ ___ __ __ :
I//system/xbin/busybox( 88): ____/ /___ _/ /_____ _ |__ \ _ __/ /_ ____ _/ /____ _ _____ _____
I//system/xbin/busybox( 88): / __ / __ / __/ __ / __/ / | | /| / / __ \/ __ / __/ _ \ | / / _ \/ ___/
I//system/xbin/busybox( 88): / /_/ / /_/ / /_/ /_/ / / __/ | |/ |/ / / / / /_/ / /_/ __/ |/ / __/ /
I//system/xbin/busybox( 88): \__,_/\__,_/\__/\__,_/ /____/ |__/|__/_/ /_/\__,_/\__/\___/|___/\___/_/
I//system/xbin/busybox( 88):
I//system/xbin/busybox( 88):
I//system/xbin/busybox( 88): +++ Checking for second partition on microSD
I//system/xbin/busybox( 88): +++ Second partition on microSD found: Starting data2whatever script
I//system/xbin/busybox( 88): +++ Changing scheduler for sd card:
I//system/xbin/busybox( 88): [noop] anticipatory deadline
I//system/xbin/busybox( 88): +++ Changing scheduler for mtd:
I//system/xbin/busybox( 88): [noop] anticipatory deadline
I//system/xbin/busybox( 88): +++ Mounting internal mtd
I//system/xbin/busybox( 88): umount: can't umount /data: Device or resource busy
I//system/xbin/busybox( 88): USER PID PPID VSIZE RSS PRIO NICE RTPRI SCHED WCHAN PC NAME
I//system/xbin/busybox( 88): keystore 70 1 1732 420 20 0 0 0 c023348c afd0e5ac S /system/bin/keystore
I//system/xbin/busybox( 88): +++ killing processes using /data
I//system/xbin/busybox( 88): 70
I//system/xbin/busybox( 88): +++ /data unmounted succesfully!
I//system/xbin/busybox( 88): --- Ext2 / Ext3 / Ext4 Partition found - checking filesystem and creating e2fscklog.txt on sd-card
I//system/xbin/busybox( 88): e2fsck 1.40.8 (13-Mar-2008)
D/AndroidRuntime( 65):
D/AndroidRuntime( 65): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 65): CheckJNI is OFF
D/dalvikvm( 65): creating instr width table
I/dalvikvm( 65): mlock: /system/framework/core.odex, fd=8
I/dalvikvm( 65): mlock(1104687104, 5572192), fd=8
I/ ( 66): ServiceManager: 0xacd0

then some hundreds lines below:

D/dalvikvm( 65): GC_EXPLICIT freed 238 objects / 13104 bytes in 14ms
D/dalvikvm( 65): GC_EXPLICIT freed 115 objects / 24272 bytes in 21ms
D/dalvikvm( 65): GC_EXPLICIT freed 233 objects / 16208 bytes in 19ms
I/dalvikvm( 65): threadid=1: recursive native library load attempt (/system/lib/libwebcore.so)
D/dalvikvm( 65): GC_EXPLICIT freed 318 objects / 17896 bytes in 28ms
I//system/xbin/busybox( 88): --- mounting as loop device
I//system/xbin/busybox( 88): --- external /data mounted successfully!
I//system/xbin/busybox( 88): +++ init script completed