SpazeDog / mounts2sd

Android SD-Ext Script+App
GNU General Public License v3.0
78 stars 27 forks source link

userinit.d script #2

Closed sicommnend closed 11 years ago

sicommnend commented 11 years ago

I was wondering if you can make a backup script that will be placed in userinit.d just in case of a ROM upgrade. The script in userinit.d can check if the one in init.d has been ran, if it has then it would just exit, if it hasn't been ran then the one in userinit.d will be used.

dbergloev commented 11 years ago

I have no idea what you mean, please elaborate. Why would init.d not be executed? And from where would userinit.d be executed? On 25 Jan 2013 18:36, "sicommnend" notifications@github.com wrote:

I was wondering if you can make a backup script that will be placed in userinit.d just in case of a ROM upgrade. The script in userinit.d can check if the one in init.d has been ran, if it has then it would just exit, if it hasn't been ran then the one in userinit.d will be used.

— Reply to this email directly or view it on GitHubhttps://github.com/SpazeDog/mounts2sd/issues/2.

sicommnend commented 11 years ago

Say you flash a new ROM or update an existing one, usually the system partition is cleaned out which will include /system/etc/init.d. If the ROM flash doesn't require a data wipe then the /data/local/userinit.d folder will still be there for script execution.

Basically a fail safe.

dbergloev commented 11 years ago

Yes, and that folder will require something executing it? On 25 Jan 2013 19:00, "sicommnend" notifications@github.com wrote:

Say you flash a new ROM or update an existing one, usually the system partition is cleaned out which will include /system/etc/init.d. If the ROM flash doesn't require a data wipe then the /data/local/userinit.d folder will still be there for script execution.

Basically a fail safe.

— Reply to this email directly or view it on GitHubhttps://github.com/SpazeDog/mounts2sd/issues/2#issuecomment-12712753.

sicommnend commented 11 years ago

Most ROMs will execute that folder, there may be a few ROMs that do not do this.

sicommnend commented 11 years ago

Look for /system/etc/init.d/90userinit, I bet you might have that file on your device.

This is the common name for the file that usually executes that folder. However the name and location may vary from ROM to ROM, it is really up to the ROM developer on how they want to do this or include it. But if I had to estimate, I would estimate about 90% of ROM's use this method.

dbergloev commented 11 years ago

I build my ROM's myself, so no. And what you are talking about, does not execute a folder called userinit.d but a file called userinit. But that would still work. All you have to do is make the original script add a file in / indicating it has been executed. Then copy the script to data and add a check in the top that exists if the file exist On 25 Jan 2013 19:14, "sicommnend" notifications@github.com wrote:

Look for /system/etc/init.d/90userinit, I bet you might have that file on your device.

This is the common name for the file that usually executes that folder. However the name and location may vary from ROM to ROM, it is really up to the ROM developer on how they want to do this or include it. But if I had to estimate, I would estimate about 90% of ROM's use this method.

— Reply to this email directly or view it on GitHubhttps://github.com/SpazeDog/mounts2sd/issues/2#issuecomment-12713391.

sicommnend commented 11 years ago

Here is a sample of the file, mines on my device doesn't have the sd-ext part. https://github.com/elelinux/android_device_htc_hero_ics/blob/master/prebuilt/20userinit