yashsingh1/xdaforums huggingface dataset:
[Samsung Epic 4G Touch] scarmon25:
Question Sfhub. The folder that it puts on the SD card. The 000root folder I think it is. Does that have to stay on the card or can it be deleted?
[Samsung Epic 4G Touch] sfhub:
It can be removed.

I usually keep it around when I install kernels because it allows me to switch from stock to stock+cwm using a terminal shell on the phone without need for PC. Can also use Mobile ODIN with the zImage's kept there.
[Samsung Epic 4G Touch] scarmon25:
OK. Good to know. Well looks like that little tool does it again. Way to go man. Both ways are complete win. Thanks to the OP for the great write up too. Good info.
[Samsung Epic 4G Touch] kobridge:
It took me couple of hours to understand what's achieved by e4gtauto-lite-sfx tool. So, this tool is doing -

1. If kernel is repacked (having init.d support thru init.rc) then it does not execute the script inside of /system/etc/install-recovery.sh.

2. If kernel is stock, then it use the install-recovery.sh thru init.rc (repacked init.rc includes the init.d support but stock only includes install-recovery.sh). Your tool creates and writes a shell command into the install-recovery.sh file.

But in here, my question is -

1. does that shell command actually works and execute the scripts in init.d?

2. have you tested any init.d scripts?

3. If everything works, what's the permission of init.d directory and script files inside of it?

I'm asking this question because I successfully install the tool and rebooted. But init.d scripts were not executed by some reason. Whenever I used SManager, it ran ok and I could see the result after the boot.
[Samsung Epic 4G Touch] sfhub:
Yes

Yes

The scripts you run should have "execute" permission set. run-parts in busybox will only run scripts with execute permission set. run-parts is what the repacked kernels are using, so this is not a new requirement

I notice you set your scripts to "chmod 666" so that might be why they aren't running. Try changing to "chmod 755".

Either

1) the permissions on your scripts are not set to have "execute" permission

2) you don't have busybox installed in /system/xbin/busybox

3) you are not running a stock kernel nor stock+cwm nor stock+cwm-rogue

My guess is 1 or 2.

With some feedback with testing of custom ROMs, in the latest upload, I actually removed the requirement for busybox to be installed, so if that is your issue, just download the newer one (the link in the original post was updated but I'm providing it here for convenience)

e4gtauto-lite-sfx.exe
[Samsung Epic 4G Touch] scarmon25:
I know that I threw a script in init.d and set permissions to rwx/rwx/rwx and it worked fine. I'm not all that savvy on what 666 and 755 translate to in the terms if rwx but if set to rxw on all three it works like a charm. Sfhub or OP. I know its a little off topic but since you seem to know. How is that translated from rwx to ###
[Samsung Epic 4G Touch] sfhub:
r w x (4 2 1)

owner group other

So if you wanted the owner to be able to read, write, and execute the file and everyone else have no permissions allowed, you would do "chmod 700" (that 7 is comprised of 4+2+1)

If you wanted owner, group, other to have read,execute permission (but not write permission) "chmod 555" (5 being 4+1)

755 would be rwxr-xr-x
[Samsung Epic 4G Touch] scarmon25:
OK. That makes sense. That is actually really simple. Thanks.
[Samsung Epic 4G Touch] kobridge:
Working like a charm without the SManager app. Permission set to 755. I'll update my thread with this info.

Thank you guys!
[Samsung Epic 4G Touch] gershee:
can't wait to try this in the morning.. thanks guys.. this was exactly what I have been looking for the past couple weeks.. stoked.
[Samsung Epic 4G Touch] sfhub:
BTW for the auto root init.d support, you pointed out the way to selectively run init.d scripts with your earlier questions. If you want to disable an init.d script, just chmod 666 the script. If you want to enable it, chmod 755 the script.
[Samsung Epic 4G Touch] gershee:
this is sick man! thanks so much to both sfhub and kobridge. gonna try out the script first cause I'm mobile.. thanks!

---------- Post added at 01:26 PM ---------- Previous post was at 12:34 PM ----------

not sure what i'm doing wrong...

i used sfhub's tool to add init.d support.

used the test script recommended in the OP to ensure it's working.

found the file in /data/local/tmp. so i thought i was all good..

added a script to mount /emmc/ to /external_sd/ using mount -o.

previously i was using smanager to auto run the script and the script works.

i verified this by checking before running it, nothing(no mount), and after, yes, mount work.

but when i put the script in /system/etc/init.d with 755 permission, when i reboot, the mount is not there.. i don't understand..

i even tried giving the file full permission in case i was messing up there, but nope.

then i run the script via smanager and my mounts show up..

anyone have any idea?

i even played with the filenaming but to no avail..
[Samsung Epic 4G Touch] sfhub:
Try looking at your logcat, errors should have been sent there.
[Samsung Epic 4G Touch] gershee:
should i search for the name of the file? or do a search for init.d?

so sorry man but i've never actually used logcats, i do know what they are, but have never been in a situation that warranted perusing them.

should i reboot and just open the logcat as soon as the phone starts and just browse? maybe search for "/init.d"?

EDIT:

I've noticed this. the test script mentioned in the OP, while it does create the file in /data/local/tmp/, the file is blank. when I run the script through smanager(as su) the file has text in it. so it seems for some reason the script is not running properly? what am I doing wrong...
[Samsung Epic 4G Touch] sfhub:
Can you post the scripts you are trying to run.
[Samsung Epic 4G Touch] kobridge:
Let me test the script and get back to you.
[Samsung Epic 4G Touch] sfhub:
My goal was to make the Auto Root installed init.d support mirror as closely as possible the builtin init.d support in the repacked kernels.

Not all scripts that work from when Android is started up will necessarily work or work the same way when they are started as part of init.d because init.d runs much earlier in the boot process. If you try and mount or access something that isn't ready yet, then it can fail.

What you can compare to is whether something works with the builtin init.d support in the FD02+CWM-Rogue kernel vs the one from Auto Root. Those should perform the same or very similar because they are starting scripts at the same time during the boot cycle.
[Samsung Epic 4G Touch] kobridge:
OK. I ran the test script as in my op section against init.d script and it ran ok.

(To make sure, I deleted previous output file). Just like I said in OP, you need to really careful when you create a file or edit. If you use the file editor from PC or use ES File explorer, there would be some special characters in the script file (hidden). This hidden characters are forgiven in SManager but not in shell script.

So, use some file editor something like root explorer text editor to create a shell script file.

For your convenience, I attached test script file that I just tested. Hope this help.
[Samsung Epic 4G Touch] gershee:
so i showed both my scripts. and the permissions.

and if you see the result of the test script, it does create a file, but 0kb with nothing in it.

and the other script does not mount.

when i run them through smanager they work(as su)..

i'm doing something simple that's wrong.. i tried reinstalling init.d support via sfhub's tool.. and reinstalled busybox..
[Samsung Epic 4G Touch] kobridge:
To run the 0test script you don't need to run the sd mnt script. Move it to different location and try it again.

Edit : mine shows 108Byte file size. It means that you have one special character included in file (if you used the file in the zip file).
[Samsung Epic 4G Touch] sfhub:
The main issue is usually Windows uses CR-LF (Carriage Return + Line Feed) special characters to terminate a line.

Unix/Linux uses LF (Line Feed) to terminate lines.

Mac uses CR (Carriage Return) to terminate lines.

These special characters cause issues with scripts being interpreted properly. There is also a problem with certain versions where the native text is unicode, which is a multi-byte character set. These characters will look pretty messed up on a single-byte system.

I'm sure you've also taken unix log files and viewed them on windows and just seen a jumbled mess of characters. That is because the LF by itself is not seen as a signal for a newline in windows and basically the whole log file is one big line.

If you want to write your scripts on windows, I suggest you use a text editor which knows how to convert the CR-LF and LF or you use utilities that can convert. Personally I use emacs but I am very old school.

You can find the DOS2UNIX and UNIX2DOS utilities on this page:

http://www.bastet.com/

They will convert the CR-LF and LF so the files can be read properly.

Use DOS2UNIX if you write your script in notepad, then want to move it to Linux/Android. Use UNIX2DOS if you have a file generated on Linux/Android and you want to view it in Notepad.
[Samsung Epic 4G Touch] gershee:
i've kind of used both mac - text edit and root explorer, so there could be some truth to this. i'll try using the above posted zip.. thanks guys.. appreciate the help.. just frustrating..
[Samsung Epic 4G Touch] sfhub:
Can you use the 0test file kobridge attached to his post above? I verified that it has the proper LF for unix (and I ran it on my phone and received output)

One symptom of CR-LF and LF problems is when the first command runs but nothing after it will run because the shell interpreter thinks there is an error with the run-on line and the unexpected carriage return.

That might be what is happening in your case, because when you "touch" a file, you create a 0 length file if the file isn't present and if it is, it updates the time stamp. That seems to fit your symptoms.
[Samsung Epic 4G Touch] gershee:
OK. used your zip. extracted file. put in /system/etc/init.d and changed permissions to 755. rebooted. same thing..:what:

think I'm gonna wipe and start fresh. I dunna. I'm in codename with fd19 kernel.

here's screenies..

its weird. even when I delete the file in root explorer, if I refresh the directory it pops up with 0kb immedietly.. wth is going on..

---------- Post added at 05:09 PM ---------- Previous post was at 05:07 PM ----------

ahhhhh!

just looked in /etc/init.d (not /system) and i found the file also!!

i must have tried doing this last night before bed!!

deleted the file and rebooting now..

EDIT:

nope same thing. guess the system/etc/init.d files are copied to /etc/init.d on boot..
[Samsung Epic 4G Touch] sfhub:
Well either there is something recreating the file or the file is being prevented from being deleted. When the new file comes up, does it have the same timestamp or is it a newer timestamp?

If the former, then it is being prevented from being deleted. If the latter, then it could be recreated or there is some process that keeps touching the file.

---------- Post added at 09:12 PM ---------- Previous post was at 09:11 PM ----------

/etc is usually a symbolic link to /system/etc

so basically /etc/init.d is the same directory as /system/etc/init.d (I don't mean same as in a copy, I mean they are physically the same directory)

---------- Post added at 09:16 PM ---------- Previous post was at 09:12 PM ----------

BTW I think it is worth looking into why the file keeps reappearing. It could give some clues what is going on.

Is it possible both SManager and init.d are trying to run the same script and they are stomping on each other?
[Samsung Epic 4G Touch] gershee:
1st, yes same timestamp. 22 apr 12 14:59:00

2nd, yes this makes sense.. i though it was something like this, i was just hoping i found the mistake i must have made..

3rd, at first i tried using the new script in the OP to run startup scripts, didn't work so i moved on to sfhub tool.. i'm on aosp rom, does that matter?

must have mucked something up.. everything was running so smoothly too just i'm too OCD to not get this working.. might have to wipe.. :(
[Samsung Epic 4G Touch] kobridge:
OK. Let me give you the last tweak on your 0test file. Open this file using root explorer text editor.

Pleace the cursor on every end of line. If there is a space between the last character of the line and cursor, remove the space between the last character and cursor (using backspace key). Move forward until last line and do the same thing. I believe this is simply the CR code inserted into your script.

Save the script and you will see the file size 108 Byte. Be sure that you remove the 0test.bak file from /system/etc/init.d directory.
[Samsung Epic 4G Touch] sfhub:
Is your AOSP using a repacked kernel or the stock kernel?

If the former, or you don't know, could you post the /init.rc file?
[Samsung Epic 4G Touch] gershee:
i looked through smanager and tried to check make sure everything was disabled.. and i uninstallled it.. still nothing..

so weird.. something is fubar..

weird time stamp. constantly being created..

i dunna.. maybe have to wipe..

some small little mistake is screwing this up.. like stuck in a loop halfway through the script.. but where.. wtf!!

guess it doesn't matter.. ill just wipe when my gf leaves and i have some time.. frustrating when i can't stomp out this little biznatch problem...

---------- Post added at 05:26 PM ---------- Previous post was at 05:24 PM ----------

i checked, it's 108Bytes, directly from your zip. just moved and changed permissions..

stock kernel. fd19, modified for aosp of course.. the one that came baked in..

it seems like somewhere early early on i messed up and something is looping recreating the same 0byte file. something is screwed..

---------- Post added at 05:30 PM ---------- Previous post was at 05:26 PM ----------

think i've wasted enough of both of you kind sirs time.

obviously it's a bug on my end and something small and clearly overlookable..

i'll just wipe this bad boy when i get a chance and start over i guess.. :/
[Samsung Epic 4G Touch] kobridge:
What's the permission of your init.d directory? Is it same 755?
[Samsung Epic 4G Touch] gershee:
755

rwxr-xr-x
[Samsung Epic 4G Touch] JohnCorleone:
Should sfhub's init.d tool work on all stock kernel versions I.e. FD16? I assume yes but I figured I would ask anyway

Sent from my SPH-D710 using Xparent Blue Tapatalk 2
[Samsung Epic 4G Touch] gershee:
yuuuup..

seems like i'm the only one have slight issues getting it to work..

im on aosp kernel anyway though.
[Samsung Epic 4G Touch] JohnCorleone:
OK one more question, it says to have USB storage disabled but as soon as I plug phone in it goes to MTP and I can't uncheck that option. Am I OK as long as I don't open file on the pop up or am I missing a step?

Sent from my SPH-D710 using Xparent Blue Tapatalk 2
[Samsung Epic 4G Touch] sfhub:
Could you post all the /*.rc files (including init.rc)
[Samsung Epic 4G Touch] gershee:
can't help you there. i don't have mtp on aosp.. :/

if the phone isn't mounted i would ASSUME you're fine.. i don't think MTp mounts in a conventional sense but someone else who knows more can chime in..
[Samsung Epic 4G Touch] sfhub:
As long as it is stock kernel that wasn't repacked, it should work.

If it got repacked, I'd have to look at what they did in the repack.

If the repack is CWM-Rogue or CWM, then since those kernel repacks have builtin init.d support, my changes will defer to the builtin support and not rerun the init.d scripts. I've tested with both Steady and Chris41g's repacked CWMs to verify that behavior.
[Samsung Epic 4G Touch] gershee:
/*.rc

8 files..
[Samsung Epic 4G Touch] sfhub:
For the purposes of the install, MTP is the same as USB mass storage being disabled.

BTW you can use Option E to change the default from MTP to USB mass storage. Once in USB mass storage mode, you'll be able to enable and disable the mass storage using the drop down notification usb icon.
[Samsung Epic 4G Touch] kobridge:
No init.d or install-recovery.sh supported!

Kernel does not support the init.d. It seems like only the workaround for you is using SManager.
[Samsung Epic 4G Touch] kobridge:
Just use the install-recovery.sh file in my second post. Unzip & place into /system/etc.
[Samsung Epic 4G Touch] JohnCorleone:
Man, you are such an asset to this community! I can't thank you enough for all that you do around here

Sent from my Nexus S 4G using Xparent Blue Tapatalk 2
[Samsung Epic 4G Touch] scarmon25:
Seriously. You really are.
[Samsung Epic 4G Touch] JohnCorleone:
Well, it definitely worked here! I ran Odex Me to odex a few more apps I added to system/app. The app requires init.d to do its thing and it worked just like it should!

Sent from my SPH-D710 using Xparent Blue Tapatalk 2
[Samsung Epic 4G Touch] kobridge:
Glad to hear that!
[Samsung Epic 4G Touch] sfhub:
Basically what kobridge said, but I'm wondering why they took the time to repack (and rewrite) the rc files and didn't include the init.d support. It is just the addition of a few lines. I am guessing they will be adding init.d support directly into the kernel soon as I've had some PM conversations.
[Samsung Epic 4G Touch] JohnCorleone:
Yeah thanks for the help. And thanks again sfhub! This is really big for me since I only run Rogue to make a nandroid right now.

Sent from my Nexus S 4G using Xparent Blue Tapatalk 2
[Samsung Epic 4G Touch] gershee:
that is what i was thinking..

also i tried the script run from the get go and it didn't do anything..

no zero byte files, nothing..

should i try again?

EDIT:

the whole reason i even started looking into this is because i wanted to have the emmc mount at startup to external_sd so everything plays nicer on aosp roms without the help of additional apps.. one thing led to another and it looked like the reason was because there wasn't an init.d script to mount(or because init.d scripts haven't been incorporated in aosp kernels on e4gt yet??).. well, learned alot playing around with stuff i previously haven't messed with.. all the unexpected big time help was greatly appreciated..
[Samsung Epic 4G Touch] sfhub:
They appear to have put emmc to sdcard mapping commands in the init.smdk4210.rc script based on what gershee posted earlier.

So do some people run AOSP ROMs with really stock kernels are does everyone run them with the kernels repacked with new .rc scripts. I haven't installed any of these, so while I can look at the posted scripts to see what they do, don't have the actual experience installing them to see what they actually do.

---------- Post added at 01:40 AM ---------- Previous post was at 01:37 AM ----------

Honestly, I don't think that zero byte file is coming from anything from the Auto Root package. The init.d support Auto Root installed is unused because of the custom init.rc in the kernel that your ROM was packaged with.

You could try removing init.d support using the Auto Root option to do that and see what happens to that zero length file.
[Samsung Epic 4G Touch] gershee:
i dont think it was your tool that cause that weird thing with the file. probably something weird along the way. since the morning i messed with smanager scripts, the script in the OP and your tool so somewhere something gor screwy.

and as for the aosp roms. they all come baked with modified for aosp kernels which from what I understood is minor adjustments. I don't think it would be possible to flash a stock leaked kernel nor do I think they bake them in without first modifying them for aosp. I remember reading somewhere what is done but can't remember. tcp once said it in the codename discussion.
[Samsung Epic 4G Touch] kobridge:
Update4:I've found that some attached tweaks is preventing the ondemand governer changes. So, until I find the issue and fix it, I dropped the attached files (you are still able to download the install-recovery.sh script)
[Samsung Epic 4G Touch] justlovejoy:
Alright guys, I Lost yall at page 3. But It may be because I am trying to repack zImage and not use Work-a-Rounds to have my kernel included with init.d /

So what I have so far is no

system/etc/init.d folder

But I have an

system/addon.d folder

can someone tell me why?

or how to do it right the first way?

My edits are easy to Remove and Start Again If Need be.

Xtra Thanks Unltd' to OP and All Participants

Seems this started exactly when I needed it

but I guess I was Elsewhere meandering?!
[Samsung Epic 4G Touch] sfhub:
If you are trying to repack your kernel, this is not the right place.
[Samsung Epic 4G Touch] justlovejoy:
Ok I can repack it. just want to run init.d scripts on boot when I do.

B) ??

am I still no Bueno?
[Samsung Epic 4G Touch] sfhub:
Add what was listed in the first post to your init.rc
[Samsung Epic 4G Touch] kobridge:
If you are trying to repack the kernel including the init.d support, then

1 you can just replace the stock init.rc with the one in previous repacked kernel (something like Rogue recovery FD02) or

2 include sfhub's install-recovery.sh file into /system/etc (stock init.rc supports install-recovery.sh)

Not sure I'm correctly understanding what you are trying to do.
[Samsung Epic 4G Touch] justlovejoy:
ok I think I'll follow door #1

lol... wait i need 1&2! aha!

ok testing now! didn't try 2 cause it said recovery and I dont want to mess up my Very Sexy Android! lol Thanks Guys, I'm in training So throw the Kitchen Sink @me too! I love absorbing this stuff!
[Samsung Epic 4G Touch] BigJPNut:
I was playing around with this last night and I noticed your tweaks seem to stick on my phone. When I added the Calkulin's modified 2cpufreq_governor script all of it didnt take. I checked using rom toolbox and the ondemand sampling rate was correct but up threshold wouldnt take.
[Samsung Epic 4G Touch] ericwgarza1:
I tried (twice actually) adding the init.d support via auto root tool and then manually placed the Calks two battery/governor scripts in the init.d folder (with proper owner/permissions) but when I try and reboot I get hung up on the splash screen. When I delete those two files and reboot all is back to normal. Oh yeah, I am running AOKP-Build33-FD19. Any ideas on why those scripts aren't allowing the phone to boot??
[Samsung Epic 4G Touch] kobridge:
That's the reason why I pulled the tweaking scripts for now. I'm almost done with testing the scripts and going to post it again with some detailed explanation. I modified the script just a little again because I wanted to use 10M frequencies always during the conservative and ondemand mode. If you want, you can also edit the CPU tweak files but would not be bad waiting until my guide comes out about these files.
[Samsung Epic 4G Touch] kobridge:
Same thing in here. Please follow my guide which is coming soon and modify the script based on your demand. For AOKP Rom, I'm not sure these tweaks are going to work or not. But if the kernel is stock, then it should work. If the kernel is repacked, I'm not sure whether it's going to work or not.
[Samsung Epic 4G Touch] BigJPNut:
I believe TCP modify's the kernel for AOSP, might be the problem....

If you wish to stay on AOKP you could always just use Steady's repack and just run init.d scripts with no further mods.
[Samsung Epic 4G Touch] sfhub:
You shouldn't need 1&2 (though it shouldn't hurt)

If 1 doesn't work by itself, your repack wasn't done right.

2 will defer to 1 if 1 is done right so init.d wouldn't be run twice.
[Samsung Epic 4G Touch] justlovejoy:
cool cause i was wondering where 2 was as system/etc isnt in my initframs