[STOCK]INIT.D support. No need to flash anything or even reboot into recovery

Search This thread

TweakerL

Senior Member
Oct 6, 2010
280
364
37
Rosedale, MD
So yea I've been working on a proper "app2sd" solution that doesn't involve just switching the MicroSD for the eMMC, but I like the stock rom so far, so I didn't feel like flashing a rom just to get init.d, and I didn't feel like modifying the ramdisk in the kernel either. So I cooked up this script that anyone can run from terminal to get init.d support. It should work for other devices too, as long as they run /system/etc/install-recovery.sh on boot.

There's only three requirements for it to work:
#1 You must be rooted
#2 Your device must run /system/etc/install-recovery.sh
#3 You must have busybox

I tested a few times on my own device (GT-N8013), but haven't had anyone else test it, so don't freak out if it doesn't work. Just let me know what went wrong and I'll figure something out.

Running it is very simple:
#1 Open any terminal app
#2 su
#3 navigate to the folder where you have the script
#4 sh ./enableinit.sh

Your device will be rebooted once the process is done, don't freak out. If everything went fine, you'll have a file in /sdcard called init.d.log created by the test init.d script that is made by the enabler.

You can either download the attachment (rename it to enableinit.sh if you get the attachment), or create the file with the contents betlow:
Code:
#!/system/bin/sh
# Adds init.d support to any device that automatically runs /system/etc/install-recovery.sh
# on startup.
#
# Made by TweakerL, make sure to visit us at and-host.com or chat with us on freenode #and-host

echo '##################################################'
echo '##                                              ##'
echo '##              Script by TweakerL              ##'
echo '##           Visit us at and-host.com           ##'
echo '##      Chat with us at freenode #and-host      ##'
echo '##                                              ##'
echo '##################################################'
echo ''
echo 'This script will enable init.d if your device'
echo 'executes /system/etc/install-recovery.sh'
echo ''
echo 'Your tablet will be rebooted once the process'
echo 'is done.'
echo ''
echo 'If the script successfully enabled init.d you will'
echo 'have a file in /sdcard called init.d.log after'
echo 'the device is done rebooting. Remember to always'
echo 'set the proper permissions in your scripts or they'
echo 'will not work.'
echo ''
read -p "Press ENTER to continue..."

if [ ! -f /system/xbin/busybox -a ! -f /system/bin/busybox ]
then
	echo 'You do not have busybox. Exiting now...'
else

	# Mount system as rw in order to execute the script
	busybox mount -o remount,rw -t ext4 /dev/block/mmcblk0p9 /system

	# Check if install-recovery.sh already exists, and if so
	# add the necessary lines, otherwise create it
	if [ -f /system/etc/install-recovery.sh ]
	then
		if cat /system/etc/install-recovery.sh | busybox egrep -i "sysinit"
		then
			echo sysinit already present in install-recovery.sh, skipping this step.
		else
			busybox cp -f  /system/etc/install-recovery.sh /sdcard/qsxdrgbhuk.sh
			echo '' >> /sdcard/qsxdrgbhuk.sh
			echo '/system/bin/sysinit' >> /sdcard/qsxdrgbhuk.sh
			busybox cp -f /sdcard/qsxdrgbhuk.sh /system/etc/install-recovery.sh
		fi
	else
		echo '#!/system/bin/sh' >> /sdcard/qsxdrgbhuk.sh
		echo '' >> /sdcard/qsxdrgbhuk.sh
		echo '/system/bin/sysinit' >> /sdcard/qsxdrgbhuk.sh
		busybox cp -f /sdcard/qsxdrgbhuk.sh /system/etc/install-recovery.sh
		busybox chmod 755 /system/etc/install-recovery.sh
	fi

	# Check if sysinit already exists and if so skip step
	# otherwise create it
	if [ ! -f /system/bin/sysinit ]
	then
		echo  '#!/system/bin/sh' >> /sdcard/kuhbgrdxsq
		echo 'export PATH=/sbin:/system/sbin:/system/bin:/system/xbin' >> /sdcard/kuhbgrdxsq
		echo '' >> /sdcard/kuhbgrdxsq
		echo '/system/bin/logwrapper busybox run-parts /system/etc/init.d' >> /sdcard/kuhbgrdxsq
     
		busybox cp -f /sdcard/kuhbgrdxsq /system/bin/sysinit
		busybox chmod 755 /system/bin/sysinit
	else
		echo sysinit already exists in /system/bin. init.d should already be enabled.
	fi

	# Cleanup
	busybox rm -f /sdcard/qsxdrgbhuk.sh
	busybox rm -f /sdcard/kuhbgrdxsq

	#Check that init.d folder exists and if not create it
	# as well as set the right permissions
	if [ -d '/system/etc/init.d' ]
	then
		chmod 755 /system/etc/init.d
		else
		mkdir /system/etc/init.d
		chmod 755 /system/etc/init.d
	fi

	# Create a test init.d script that echoes a file to
	# /sdcard on successful execution
	echo '#!/system/bin/sh' > /sdcard/99testinit
	echo '' >> /sdcard/99testinit
	echo 'echo init.d works > /sdcard/init.d.log' >> /sdcard/99testinit
	busybox cp -f /sdcard/99testinit /system/etc/init.d
	chmod 755 /system/etc/init.d/99testinit
	busybox rm -f /sdcard/99testinit

	# Sync and remount system
	sync
	busybox mount -o remount,ro -t ext4 /dev/block/mmcblk0p9 /system

	# Reboot system to enable init.d
	if [ -f /system/bin/reboot ]
	then
		echo Your device will reboot in 3 seconds
		sleep 3
		reboot
	else
		echo "Your device doesn't appear to have a reboot command,"
		echo "please reboot your device now to avoid problems."
	fi
fi
 

Attachments

  • enableinit.sh.txt
    3.7 KB · Views: 5,974
Last edited:

lm that guy

Senior Member
Jan 22, 2012
673
291
Pretty awesome. Will edit once i try this out.

Edit: Everything worked. Tested on GT-N8013

Thanks alot.

Sent from my GT-N8013 using Tapatalk 2
 
Last edited:

andylam16

Member
May 28, 2012
25
1
Hi, Can you tell more clearly how to make this work.

Sent from my GT-N8000 using xda app-developers app
 

TweakerL

Senior Member
Oct 6, 2010
280
364
37
Rosedale, MD
The point was not to have to go into recovery...

Anyway, it's really simple...

Download the attached file
open terminal
then do the following commands

Code:
su
cd /sdcard
sh ./Download/enableinit.sh.txt

assuming that your browser saves files to /sdcard/Download
 

andylam16

Member
May 28, 2012
25
1
Sorry, I am a computer idiot . I really donot how to do after I had downloaded the text file. Appreciated if you can explain more detail.

Sent from my GT-N8000 using xda app-developers app
 

drnish83

Member
Jan 9, 2011
6
1
So now with init.d support ready, is it going to be possible to run proper a2sd scripts? And which one specifically would you recommend? Excuse me if i'm asking the wrong questions.
 

TweakerL

Senior Member
Oct 6, 2010
280
364
37
Rosedale, MD
Sorry, I am a computer idiot . I really donot how to do after I had downloaded the text file. Appreciated if you can explain more detail.

Sent from my GT-N8000 using xda app-developers app

It has nothing to do with knowing anything about computers, as you don't need a computer to do this... just your device...

Download the file, on your device, if you're using stock browser it will go to /sdcard/Download
Make sure you have busybox, download a busybox installer from the market, install it, and run it, and tell it to install busybox
Download a terminal app from the play store for free, such as android terminal emulator, install it and open it
then type in these exact commands, just like they're in here, in the terminal:

Code:
su
sh /sdcard/Download/enableinit.sh

Assuming of course, that your stuff is getting download to /sdcard/Download.

If you can't do this... sell your android device and buy an iCrap one...


So now with init.d support ready, is it going to be possible to run proper a2sd scripts? And which one specifically would you recommend? Excuse me if i'm asking the wrong questions.

I'm working on my own app2sd script that should beat anything ever made. Here's what it does:

It uses a second partition in the MicroSD card for gaining extra storage, this partition has to be formatted to ext4

#1 It mounts the external ext4 partition to a new location
#2 It detects the location for /sdcard/Android; /data/data; /data/app no matter what device you have (suppose the directories aren't the same for a certain device)
#3 It has the option to mount /sdcard/Android to a folder in the external partition
#4 It has the option to mount /data/data to a folder in the external partition
#5 It has the option to mount /data/app to a folder in the external partition
#6 It has the option to automatically copy everything from any of those folders to the appropriate folder in the external partition
#7 It has the option to automatically wipe from the internal storage anything that it moves
#8 If you have all options enabled, apps will be automatically installed to the external partition and never take any space in the internal storage, while everything else (Download/recovery/backup/pictures/videos/etc...) all remain in the internal partition.
 
Last edited:

Welly_11

Member
May 24, 2012
25
2
confusing

I have tried your script and it has successful at first.. then i flashing my note again with stock rom and i try using ur script again but now there is nothing chance.. do you know why?? what must i do now??
 

NessLookAlike

Senior Member
Jan 4, 2012
60
21
Portland
You know, this is the damnedest thing, but your instructions call for Busybox installation, and I can't install Busybox on my N8013. And tips you can share?
 

Welly_11

Member
May 24, 2012
25
2
Mr tweaker, i have done the process of init.d but there is nothing changed.. where is my false?

Sent from my GT-N8000 using XDA Premium HD app
 

TweakerL

Senior Member
Oct 6, 2010
280
364
37
Rosedale, MD
Mr tweaker, i have done the process of init.d but there is nothing changed.. where is my false?

Sent from my GT-N8000 using XDA Premium HD app

Look for these files and let me know if they're there:

/system/etc/install-recovery.sh
/system/bin/sysinit
/system/etc/init.d/99testinit

**************************************
If anybody needs help, look for me on irc - #and-host in freenode
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 19
    So yea I've been working on a proper "app2sd" solution that doesn't involve just switching the MicroSD for the eMMC, but I like the stock rom so far, so I didn't feel like flashing a rom just to get init.d, and I didn't feel like modifying the ramdisk in the kernel either. So I cooked up this script that anyone can run from terminal to get init.d support. It should work for other devices too, as long as they run /system/etc/install-recovery.sh on boot.

    There's only three requirements for it to work:
    #1 You must be rooted
    #2 Your device must run /system/etc/install-recovery.sh
    #3 You must have busybox

    I tested a few times on my own device (GT-N8013), but haven't had anyone else test it, so don't freak out if it doesn't work. Just let me know what went wrong and I'll figure something out.

    Running it is very simple:
    #1 Open any terminal app
    #2 su
    #3 navigate to the folder where you have the script
    #4 sh ./enableinit.sh

    Your device will be rebooted once the process is done, don't freak out. If everything went fine, you'll have a file in /sdcard called init.d.log created by the test init.d script that is made by the enabler.

    You can either download the attachment (rename it to enableinit.sh if you get the attachment), or create the file with the contents betlow:
    Code:
    #!/system/bin/sh
    # Adds init.d support to any device that automatically runs /system/etc/install-recovery.sh
    # on startup.
    #
    # Made by TweakerL, make sure to visit us at and-host.com or chat with us on freenode #and-host
    
    echo '##################################################'
    echo '##                                              ##'
    echo '##              Script by TweakerL              ##'
    echo '##           Visit us at and-host.com           ##'
    echo '##      Chat with us at freenode #and-host      ##'
    echo '##                                              ##'
    echo '##################################################'
    echo ''
    echo 'This script will enable init.d if your device'
    echo 'executes /system/etc/install-recovery.sh'
    echo ''
    echo 'Your tablet will be rebooted once the process'
    echo 'is done.'
    echo ''
    echo 'If the script successfully enabled init.d you will'
    echo 'have a file in /sdcard called init.d.log after'
    echo 'the device is done rebooting. Remember to always'
    echo 'set the proper permissions in your scripts or they'
    echo 'will not work.'
    echo ''
    read -p "Press ENTER to continue..."
    
    if [ ! -f /system/xbin/busybox -a ! -f /system/bin/busybox ]
    then
    	echo 'You do not have busybox. Exiting now...'
    else
    
    	# Mount system as rw in order to execute the script
    	busybox mount -o remount,rw -t ext4 /dev/block/mmcblk0p9 /system
    
    	# Check if install-recovery.sh already exists, and if so
    	# add the necessary lines, otherwise create it
    	if [ -f /system/etc/install-recovery.sh ]
    	then
    		if cat /system/etc/install-recovery.sh | busybox egrep -i "sysinit"
    		then
    			echo sysinit already present in install-recovery.sh, skipping this step.
    		else
    			busybox cp -f  /system/etc/install-recovery.sh /sdcard/qsxdrgbhuk.sh
    			echo '' >> /sdcard/qsxdrgbhuk.sh
    			echo '/system/bin/sysinit' >> /sdcard/qsxdrgbhuk.sh
    			busybox cp -f /sdcard/qsxdrgbhuk.sh /system/etc/install-recovery.sh
    		fi
    	else
    		echo '#!/system/bin/sh' >> /sdcard/qsxdrgbhuk.sh
    		echo '' >> /sdcard/qsxdrgbhuk.sh
    		echo '/system/bin/sysinit' >> /sdcard/qsxdrgbhuk.sh
    		busybox cp -f /sdcard/qsxdrgbhuk.sh /system/etc/install-recovery.sh
    		busybox chmod 755 /system/etc/install-recovery.sh
    	fi
    
    	# Check if sysinit already exists and if so skip step
    	# otherwise create it
    	if [ ! -f /system/bin/sysinit ]
    	then
    		echo  '#!/system/bin/sh' >> /sdcard/kuhbgrdxsq
    		echo 'export PATH=/sbin:/system/sbin:/system/bin:/system/xbin' >> /sdcard/kuhbgrdxsq
    		echo '' >> /sdcard/kuhbgrdxsq
    		echo '/system/bin/logwrapper busybox run-parts /system/etc/init.d' >> /sdcard/kuhbgrdxsq
         
    		busybox cp -f /sdcard/kuhbgrdxsq /system/bin/sysinit
    		busybox chmod 755 /system/bin/sysinit
    	else
    		echo sysinit already exists in /system/bin. init.d should already be enabled.
    	fi
    
    	# Cleanup
    	busybox rm -f /sdcard/qsxdrgbhuk.sh
    	busybox rm -f /sdcard/kuhbgrdxsq
    
    	#Check that init.d folder exists and if not create it
    	# as well as set the right permissions
    	if [ -d '/system/etc/init.d' ]
    	then
    		chmod 755 /system/etc/init.d
    		else
    		mkdir /system/etc/init.d
    		chmod 755 /system/etc/init.d
    	fi
    
    	# Create a test init.d script that echoes a file to
    	# /sdcard on successful execution
    	echo '#!/system/bin/sh' > /sdcard/99testinit
    	echo '' >> /sdcard/99testinit
    	echo 'echo init.d works > /sdcard/init.d.log' >> /sdcard/99testinit
    	busybox cp -f /sdcard/99testinit /system/etc/init.d
    	chmod 755 /system/etc/init.d/99testinit
    	busybox rm -f /sdcard/99testinit
    
    	# Sync and remount system
    	sync
    	busybox mount -o remount,ro -t ext4 /dev/block/mmcblk0p9 /system
    
    	# Reboot system to enable init.d
    	if [ -f /system/bin/reboot ]
    	then
    		echo Your device will reboot in 3 seconds
    		sleep 3
    		reboot
    	else
    		echo "Your device doesn't appear to have a reboot command,"
    		echo "please reboot your device now to avoid problems."
    	fi
    fi
    4
    Sorry, I am a computer idiot . I really donot how to do after I had downloaded the text file. Appreciated if you can explain more detail.

    Sent from my GT-N8000 using xda app-developers app

    It has nothing to do with knowing anything about computers, as you don't need a computer to do this... just your device...

    Download the file, on your device, if you're using stock browser it will go to /sdcard/Download
    Make sure you have busybox, download a busybox installer from the market, install it, and run it, and tell it to install busybox
    Download a terminal app from the play store for free, such as android terminal emulator, install it and open it
    then type in these exact commands, just like they're in here, in the terminal:

    Code:
    su
    sh /sdcard/Download/enableinit.sh

    Assuming of course, that your stuff is getting download to /sdcard/Download.

    If you can't do this... sell your android device and buy an iCrap one...


    So now with init.d support ready, is it going to be possible to run proper a2sd scripts? And which one specifically would you recommend? Excuse me if i'm asking the wrong questions.

    I'm working on my own app2sd script that should beat anything ever made. Here's what it does:

    It uses a second partition in the MicroSD card for gaining extra storage, this partition has to be formatted to ext4

    #1 It mounts the external ext4 partition to a new location
    #2 It detects the location for /sdcard/Android; /data/data; /data/app no matter what device you have (suppose the directories aren't the same for a certain device)
    #3 It has the option to mount /sdcard/Android to a folder in the external partition
    #4 It has the option to mount /data/data to a folder in the external partition
    #5 It has the option to mount /data/app to a folder in the external partition
    #6 It has the option to automatically copy everything from any of those folders to the appropriate folder in the external partition
    #7 It has the option to automatically wipe from the internal storage anything that it moves
    #8 If you have all options enabled, apps will be automatically installed to the external partition and never take any space in the internal storage, while everything else (Download/recovery/backup/pictures/videos/etc...) all remain in the internal partition.
    1
    Here's a preview of the super app2sd script I'm working on. Much of it is already implemented, should have it all in a couple of days
    1
    If you have rom toolbox, you can navegate to the file on the root browser and execute from within without going through the whole terminal commands and what not
    Worked perfectly for me!
    Thanks!