Hi everyone.
Im using minicm7 2.2.2 by nobodyatall. I used to be a linux user (slackware) and i could run console commands automatically on every pc reboot just adding them to /etc/rc.d/rc.local plain text file. I know that ubuntu/debian have some kind of runlevels init files. I wonder if our cm7 has some rc.local or init script. I found an init file with root explorer, but dont know how it works.
Hope you can help me
Sent from my U20i using xda app-developers app
Just edit (or make) a script and put it in /system/etc/init.d. The starting number of the script-name will determine where in the sequence of scripts it will run. in MiniCM7, I would suggest 20userinit as the one to make your own changes or additions to. It will run after the 'system' scripts.
SmG67 said:
Just edit (or make) a script and put it in /system/etc/init.d. The starting number of the script-name will determine where in the sequence of scripts it will run. in MiniCM7, I would suggest 20userinit as the one to make your own changes or additions to. It will run after the 'system' scripts.
Click to expand...
Click to collapse
Didn't work for me, but thanks anyway. I'm sure I'm doing something wrong
mortadelax said:
Didn't work for me, but thanks anyway. I'm sure I'm doing something wrong
Click to expand...
Click to collapse
Could you tell what you're trying to do, I'm not a scripting-expert myself, but maybe someone can help you out
SmG67 said:
Could you tell what you're trying to do, I'm not a scripting-expert myself, but maybe someone can help you out
Click to expand...
Click to collapse
I wanted to automount a swap file (/sdcard/swap.swap) because swapper does not automont, dont know why. I can mount it manually under console just typing:
Code:
su
swapon /sdcard/swap.swp
I added these lines in the file you said...20userinit
Nevermind. I don't want swap anymore. I was just testing, but it slowed my phone. However, i feel curious about that init script. It make me feel as in linux, and I hope to learn to use it.
mortadelax said:
I wanted to automount a swap file (/sdcard/swap.swap) because swapper does not automont, dont know why. I can mount it manually under console just typing:
Code:
su
swapon /sdcard/swap.swp
I added these lines in the file you said...20userinit
Nevermind. I don't want swap anymore. I was just testing, but it slowed my phone. However, i feel curious about that init script. It make me feel as in linux, and I hope to learn to use it.
Click to expand...
Click to collapse
If you had used a swap partition instead of a swap file it would have been mounted automatically through the 05mountext script. It's quite technical, but it gives an example on how to go about it.
Related
Hi!
I have installed the [BUILD] **Complete Froyo Bundle!!** FRX06 - "Stable" - Minor Fixes, but I have no WiFi.
In a previous version was included by default Debugging tool which would allow a terminal to be launched in order to copy the wifi-nvram file from the SD card towards the /data folder.
How to get the Debugging Tool / Terminal in this version ?
Any help welcome !
Thanks,
JM
jsalsa said:
Hi!
I have installed the [BUILD] **Complete Froyo Bundle!!** FRX06 - "Stable" - Minor Fixes, but I have no WiFi.
In a previous version was included by default Debugging tool which would allow a terminal to be launched in order to copy the wifi-nvram file from the SD card towards the /data folder.
How to get the Debugging Tool / Terminal in this version ?
Any help welcome !
Thanks,
JM
Click to expand...
Click to collapse
Unfortunately you can't. Use ConnectBot from the Market.
For the wifi-nvram.txt trick why don't you just use the user.conf file to bind mount it? That way you wouldn't ever have to do it again... Do it once, then never worry about it again...
Thanks !
For ConnectBot, this is a SSH client. how to connect locally: localhost I presume, But which login/password?
For user.conf file, I did not know its existence . have added the "cp /sdcard/wifi-nvram.txt /data/wifi-nvram.txt" at the end, let's see if this works at next reboot.
Thanks again !
jsalsa said:
Thanks !
For ConnectBot, this is a SSH client. how to connect locally: localhost I presume, But which login/password?
For user.conf file, I did not know its existence . have added the "cp /sdcard/wifi-nvram.txt /data/wifi-nvram.txt" at the end, let's see if this works at next reboot.
Thanks again !
Click to expand...
Click to collapse
ConnectBot works locally. Instead of SSH, choose "Local"...
Let me know if you need help with the user.conf command. Should work, haven't tried it myself...
Thanks once more.
the user.conf trick did the trick already.
Many thanks !
JMS
jsalsa said:
Thanks once more.
the user.conf trick did the trick already.
Many thanks !
JMS
Click to expand...
Click to collapse
np. Figured that is the easiest method for fixing this... now you can just leave the file on your SD card and user.conf will always mount it for you .
arrrghhh said:
ConnectBot works locally. Instead of SSH, choose "Local"...
Let me know if you need help with the user.conf command. Should work, haven't tried it myself...
Click to expand...
Click to collapse
can u tell me how does user.conf work ? what do i have to do ?
the show stopper said:
can u tell me how does user.conf work ? what do i have to do ?
Click to expand...
Click to collapse
Boot back to WinMo, edit the froyo.user.conf file (in the 'conf' folder on your SD card, where Android is...)
I like editing these files with Notepad++ but I think Wordpad will handle the enter keys correctly (regular Windows Notepad won't!)
At the bottom, you'll see a "CustomCommands" section. Within the braces ({}) add a line -
Code:
ln -s /sdcard/wifi-nvram.txt /data/wifi-nvram.txt
Make sure it's on its own line, look at some of the other commands for an example (look at the rm command...)
That's the skinny... hopefully it works! This assumes the wifi-nvram.txt file you created (with your MAC address in it) is at the root of the SD card (look at the command, /sdcard/wifi-nvram.txt... if it's in a 'mods' folder which is at the root of the SD, then the path would be /sdcard/mods/wifi-nvram.txt...)
? Purpose
arrrghhh said:
Boot back to WinMo, edit the froyo.user.conf file (in the 'conf' folder on your SD card, where Android is...)
I like editing these files with Notepad++ but I think Wordpad will handle the enter keys correctly (regular Windows Notepad won't!)
At the bottom, you'll see a "CustomCommands" section. Within the braces ({}) add a line -
Code:
ln -s /sdcard/wifi-nvram.txt /data/wifi-nvram.txt
Make sure it's on its own line, look at some of the other commands for an example (look at the rm command...)
That's the skinny... hopefully it works! This assumes the wifi-nvram.txt file you created (with your MAC address in it) is at the root of the SD card (look at the command, /sdcard/wifi-nvram.txt... if it's in a 'mods' folder which is at the root of the SD, then the path would be /sdcard/mods/wifi-nvram.txt...)
Click to expand...
Click to collapse
What is the result of moving this file what does this do,fix,solve? P.s. sincere?Not being sarcastic just curious.
Phatboyj420 said:
What is the result of moving this file what does this do,fix,solve? P.s. sincere?Not being sarcastic just curious.
Click to expand...
Click to collapse
What is this, I don't even...
If you're asking what this fixes, it's for wifi problems. I think someone tried this trick, and it didn't work. You actually have to place the .txt file instead of symlinking.
I was playing around with some scripts from Caulkin on some other versions of Froyo to try and improve performance. I have read up on the init.rc script and use of the init.d folder. I have set all this up and have edited the init.rc script to run the init.d scripts, but it gets overridden by the base init.rc on reboot. I had read somewhere that you cannot directly edit the init.rc and that it will be overridden on boot from the boot.img. Can someone confirm that? I thought most roms now have the ability to use init.d out of the box, but it doesn't look like it on Brilliant Corners. Can someone confirm that? Do you know of any Froyo ROMS, other than Caulkins, that has init.d capability? Thanks
markmac said:
I have set all this up and have edited the init.rc script to run the init.d scripts, but it gets overridden by the base init.rc on reboot.
Click to expand...
Click to collapse
Are you using the run-parts program?
I had read somewhere that you cannot directly edit the init.rc and that it will be overridden on boot from the boot.img. Can someone confirm that?
Click to expand...
Click to collapse
That's correct.
Thanks for the response. I was editing the init.rc directly which obviously won't work. So i need to look into building my own boot.img or another option. I was using run-parts setup as a service. I would have thought most kernels/ROMs would support this now, but it does not appear that way.
markmac said:
So i need to look into building my own boot.img or another option.
Click to expand...
Click to collapse
You don't need to build your own new image; you can just modify the existing one by flashing. Take a look at the attachements in these 2 posts where I've done just that. Just make sure the script is idempotent if other people will use it.
Post 1
Post 2
Thanks will definitely check this out.
Looked at this. So to update the init.rc file I would have to edit and package into a boot.img file, then flash the img file with adb or nvflash correct?
markmac said:
So to update the init.rc file I would have to edit and package into a boot.img file, then flash the img file with adb or nvflash correct?
Click to expand...
Click to collapse
No. That's too much work for the user. My technique is meant to be like flashing a new kernel. No external utilities are needed. Just CWM (or, possibly, even standard recovery).
i know we can add a init rc script.. by using..
import /init.something.rc in init.rc or init.<hardware>.rc
but they have to be included in the ramdisk.. so i have to like unpack boot.img, decompress ramdisk,
modify files, compress, repack, flash.. modify files, compress, repack flash.. @[email protected]
is there some way i can get it to load a custom rc script.. in /system or some other partition? so i can just edit the rc script there..
i will add it later to ramdisk.. i just need this for testing.. is there some workaround for this??
hey
psych.half said:
i know we can add a init rc script.. by using..
import /init.something.rc in init.rc or init.<hardware>.rc
but they have to be included in the ramdisk.. so i have to like unpack boot.img, decompress ramdisk,
modify files, compress, repack, flash.. modify files, compress, repack flash.. @[email protected]
is there some way i can get it to load a custom rc script.. in /system or some other partition? so i can just edit the rc script there..
i will add it later to ramdisk.. i just need this for testing.. is there some workaround for this??
Click to expand...
Click to collapse
go here
http://forum.xda-developers.com/showthread.php?t=2073775
moonbutt74 said:
go here
http://forum.xda-developers.com/showthread.php?t=2073775
Click to expand...
Click to collapse
and i know how to unpack/repack boot.img and edit ramdisk... done it like hundereds times..
the problem is that the device i am working on does not have fastboot.. so testing my changes in ramdisk is really difficult...
i just want to add a custom rc script.. somewhere in /system partition.. so i can just edit the rc script there. without having to pack/repack the boot.img
something like this should be added in init.rc or init.<hardware>.rc
Code:
import /system/etc/init.custom.rc
but i don't know where to add that..
hey
psych.half said:
and i know how to unpack/repack boot.img and edit ramdisk... done it like hundereds times..
the problem is that the device i am working on does not have fastboot.. so testing my changes in ramdisk is really difficult...
i just want to add a custom rc script.. somewhere in /system partition.. so i can just edit the rc script there. without having to pack/repack the boot.img
something like this should be added in init.rc or init.<hardware>.rc
Code:
import /system/etc/init.custom.rc
but i don't know where to add that..
Click to expand...
Click to collapse
okay so, probably not what you really want but maybe useful
http://forum.xda-developers.com/galaxy-s3/help/how-to-modify-init-rc-init-d-t2135610
http://forum.xda-developers.com/showthread.php?t=1276578
maybe enabling the boot script thing and biting the bullet for a one time dd will work out
when i'm testing something i switch my boot and recovery to save button ware [DON'T DO THAT IF YOUR SANE!!]
else you'll have to find some way to get the fastboot thing going, maybe test in emulator instead?
moonbutt74 said:
okay so, probably not what you really want but maybe useful
http://forum.xda-developers.com/galaxy-s3/help/how-to-modify-init-rc-init-d-t2135610
http://forum.xda-developers.com/showthread.php?t=1276578
maybe enabling the boot script thing and biting the bullet for a one time dd will work out
when i'm testing something i switch my boot and recovery to save button ware [DON'T DO THAT IF YOUR SANE!!]
else you'll have to find some way to get the fastboot thing going, maybe test in emulator instead?
Click to expand...
Click to collapse
that requires, the root filesystem to be rw.. the initramfs is saved in mmc... :| i will have to look into implementing it..
i have done that.. OwO
hmm.. i will see..
anyways thanks for helping...
confused
psych.half said:
that requires, the root filesystem to be rw.. the initramfs is saved in mmc... :| i will have to look into implementing it..
i have done that.. OwO
hmm.. i will see..
anyways thanks for helping...
Click to expand...
Click to collapse
so, you're not rooted?
can you adb?
what device?
moonbutt74 said:
so, you're not rooted?
can you adb?
what device?
Click to expand...
Click to collapse
i am rooted.. :| i meant, changes to root filesystem are lost on reboot..
the rw kernel mentioned there saves the changes to rootfilesystem...
yeah.. adb works :v
fastboot...
psych.half said:
i am rooted.. :| i meant, changes to root filesystem are lost on reboot..
the rw kernel mentioned there saves the changes to rootfilesystem...
yeah.. adb works :v
Click to expand...
Click to collapse
maybe something helpful in this
http://forum.xda-developers.com/showthread.php?t=2317790
so what device ? what are you trying to achieve?
Resolution on post #10, in post #11 a second resolution and on post #12 the confirmation.
I need a init.d script to run or execute a service that is on system/bin
Is this possible?
Which commands to use?
I researched a lot, and I do not find anything about it.
The file name is jellyservice.
Jellyservice is a normal service that need to be running before run a app, without that, the app does not run.
I know that:
1. The jellyservice is presented on stock rom and the stock rom use init.rc to call the jellyservice at boot, and i can change the init.rc by change the boot.img (unpack, change, repack), but i wanna to be able to run it on any device wit any kernel, and don't wanna to change it kernel for it rom.
2. I can use SManager to run the file on boot. but i don't wanna to need a app just init.d, init.d is already implemented and working on almost every custom rom, so I put the init.d file on a zip that flash the apk, libs etc, and no more app or config is need.
Thanks.
baybutcher27 said:
I need a init.d script to run a service that is on system/bin
Is this possible?
Which commands to use?
I researched a lot, and I do not find anything about it.
The file name is jellyservice.
Jellyservice is a normal service that need to be running before run a app, without that, the app does not run.
I know that:
1. The jellyservice is presented on stock rom and the stock rom use init.rc to call the jellyservice at boot, and i can change the init.rc by change the boot.img (unpack, change, repack), but i wanna to be able to run it on any device wit any kernel, and don't wanna to change it kernel for it rom.
2. I can use SManager to run the file on boot. but i don't wanna to need a app just init.d, init.d i already have implemented on rom, so I put the init.d file on a zip that flash the apk, libs etc, and no more app or config is need.
Thanks.
Click to expand...
Click to collapse
Is this what you are looking for, or I am missing something?
http://forum.xda-developers.com/showthread.php?t=1933849
And this, which is more up to date:
http://www.xda-developers.com/init-d-support-for-any-rooted-phone/
Ciuffy said:
Is this what you are looking for, or I am missing something?
http://forum.xda-developers.com/showthread.php?t=1933849
And this, which is more up to date:
http://www.xda-developers.com/init-d-support-for-any-rooted-phone/
Click to expand...
Click to collapse
No you did not read what I wrote.
As I said, i wanna a script of init.d that runs or execute a file, i already have init.d working...
baybutcher27 said:
No you did not read what I wrote.
As I said, i wanna a script of init.d that runs or execute a file, i already have init.d working...
Click to expand...
Click to collapse
Sorry, I was assuming you could find help there. By the way, you should be able to do this just by using a script like:
#!/system/bin/sh
-Give permission
/path/jelliservice
Then place it in init.d or write a specific script for init.d to run the above one.
http://android.stackexchange.com/questions/6558/how-can-i-run-a-script-on-boot
Sorry if there's a bigger obstacle I'm not aware of.
Ciuffy said:
Sorry, I was assuming you could find help there. By the way, you should be able to do this just by using a script like:
#!/system/bin/sh
-Give permission
/path/jelliservice
Then place it in init.d or write a specific script for init.d to run the above one.
http://android.stackexchange.com/questions/6558/how-can-i-run-a-script-on-boot
Sorry if there's a bigger obstacle I'm not aware of.
Click to expand...
Click to collapse
No is all good.
but??? that willl run the service, or just give a permission.
I don't really know much about init.d script and the web does not help in that thing i wanna.
i'm implemented it now to see what that script does. :good:
baybutcher27 said:
No is all good.
but??? that willl run the service, or just give a permission.
I don't really know much about init.d script and the web does not help in that thing i wanna.
i'm implemented it now to see what that script does. :good:
Click to expand...
Click to collapse
Oh, so you are just asking for help with the actual script, fine. See if you can figure it out yourself from that post, I'm trying to build an easy example right now. I seem to not have this jelliservice you are talking about, maybe you can give me a few more insights about this.
Ciuffy said:
Oh, so you are just asking for help with the actual script, fine. See if you can figure it out yourself from that post, I'm trying to build an easy example right now. I seem to not have this jelliservice you are talking about, maybe you can give me a few more insights about this.
Click to expand...
Click to collapse
ok.
i tested that you post doesn't do what i need.
i have this on init.d to now if it works.
#!/system/bin/sh
touch /data/local/tmp/init.d_log_test.txt
echo "done" >> /data/local/tmp/init.d_log_test.txt
so i change the "done" of the last line to wherever and it time i reboot it change to wherever i wrote.
so init.d is working fine.
The jellyservice is a service that only exist on motorola stock rom on devices that have dedicated hardware of DTV.
it is started by i .rc file:
init.mmi.dtv.rc
and the content of that .rc is:
Code:
on boot
# DTV feature
service dtv-jelly /system/bin/jellyservice
class main
user system
group system audio camera graphics inet net_bt net_bt_admin net_raw sdcard_rw
iknow that is possible to implemented that .rc on any device by add it to the kernel or boot.img but it will be need to do on any rom and that is allot of work and will be impossible.
so i have created a tread to give support for that DTV to any custom rom, and i wanna to make a more completed .zip to the app.
see the thread here
baybutcher27 said:
ok.
i tested that you post doesn't do what i need.
i have this on init.d to now if it works.
#!/system/bin/sh
touch /data/local/tmp/init.d_log_test.txt
echo "done" >> /data/local/tmp/init.d_log_test.txt
so i change the "done" of the last line to wherever and it time i reboot it change to wherever i wrote.
so init.d is working fine.
The jellyservice is a service that only exist on motorola stock rom on devices that have dedicated hardware of DTV.
it is started by i .rc file:
init.mmi.dtv.rc
and the content of that .rc is:
Code:
on boot
# DTV feature
service dtv-jelly /system/bin/jellyservice
class main
user system
group system audio camera graphics inet net_bt net_bt_admin net_raw sdcard_rw
iknow that is possible to implemented that .rc on any device by add it to the kernel or boot.img but it will be need to do on any rom and that is allot of work and will be impossible.
so i have created a tread to give support for that DTV to any custom rom, and i wanna to make a more completed .zip to the app.
see the thread here
Click to expand...
Click to collapse
You are right, it's not easy to test this out because of default .rc hardcoded into kernel... in order to do this you would have to edit .rc to run that service that runs userinit.sh... Have you already done this? And, are you able to start the service manually?
Ciuffy said:
You are right, it's not easy to test this out because of default .rc hardcoded into kernel... in order to do this you would have to edit .rc to run that service that runs userinit.sh... Have you already done this? And, are you able to start the service manually?
Click to expand...
Click to collapse
i didn't try implemented that .rc on boot.img, that is too much work, and need to be done on it kernel or rom update, but yes can be done.
The file is just like any other executable, just like a .sh or any file you can execute using a app that can execute files like, root browser or SManager.
all the process to run the file is on the thread i just post.
The thing is i already know how to run it via app, but i don't wanna to stop there i wanna to run it via init.d because is a very simple way, but very difficult to find the commands.
Exists any command on init.d that can run a file commands like, run, execute, open or start ?
any of those work? and how to use they?
have any website that have all the command available on init.d?
Hey, you can run a binary from sh by just invoking its path, for example:
Code:
#!/bin/sh
/system/bin/jellyservice
The proccess will spawn with UID 0 (root)
You can change that if you have a good root binary by doing this:
Code:
#!/bin/sh
su system -c '/system/bin/jellyservice'
If you're using supersu I think you have to enable root at boot (Look at the application settings)
baybutcher27 said:
i didn't try implemented that .rc on boot.img, that is too much work, and need to be done on it kernel or rom update, but yes can be done.
The file is just like any other executable, just like a .sh or any file you can execute using a app that can execute files like, root browser or SManager.
all the process to run the file is on the thread i just post.
The thing is i already know how to run it via app, but i don't wanna to stop there i wanna to run it via init.d because is a very simple way, but very difficult to find the commands.
Exists any command on init.d that can run a file commands like, run, execute, open or start ?
any of those work? and how to use they?
have any website that have all the command available on init.d?
Click to expand...
Click to collapse
so i resolve this :silly: :laugh: :victory:
after writing I read, and is so lame.
if the file is just like any other executable way not put it in the init.d folder?
and i put, rename to 99jellyservice
and the init.d run it and the apk that need that file to be running before you open it work.
@Ciuffy
Thanks you help me to find a way...
nagalun said:
Hey, you can run a binary from sh by just invoking its path, for example:
Code:
#!/bin/sh
/system/bin/jellyservice
The proccess will spawn with UID 0 (root)
You can change that if you have a good root binary by doing this:
Code:
#!/bin/sh
su system -c '/system/bin/jellyservice'
If you're using supersu I think you have to enable root at boot (Look at the application settings)
Click to expand...
Click to collapse
the 1° option work perfectly!, but i use like this
Code:
#!/system/bin/sh
/system/bin/jellyservice
i think doesn't make a difference.
Thanks man I will use your way, is better that my. :good:
baybutcher27 said:
the 1° option work perfectly!, but i use like this
Code:
#!/system/bin/sh
/system/bin/jellyservice
i think doesn't make a difference.
Thanks man I will use your way, is better that my. :good:
Click to expand...
Click to collapse
Yeah basically the only difference is that Android has no /bin/sh but /system/bin/sh. I though about just putting that there honestly but I couldn't get any of this working on my cyanogenmod so I was trying to figure out why >.>, but I'm probably missing something.
Anyway, glad I could help!
Good afternoon. As the 8 GB aren't enough for me, I've been looking for a solution. While doing so, I found the INT2EXT4 script, which mounts /data on the second partition of the SD card. The first time I flashed it (after enabling init.d support with an app) it didn't work at all. Then, I realised this script is written assuming that the second partition of the card is mmcblk0p2. But on the M4, it's mmcblk1p2 (found it out with another app).
I changed those lines on the script, but it didn't work either. I analyzed all the lines, and I can't see where the problem could be. Has anyone tried this, or could somebody help me with this issue? I think it could be really useful for a lot of users.
Another thing: flashing the file through TWRP gave me an error, so I copied the file directly to /system/etc/init.d and set the permissions manually. I hope this is not a problem, but let me know if it could be...
sounds interesting... ill take a look at it soon!
Have you checked the "adress" of internal sd? In the script there is a connection between internal and external storage so i would assume that both "adresses" need to be correct in order for the script to work. Just an opinion....
Sent from my SM-G901F using XDA Free mobile app
vader20 said:
Have you checked the "adress" of internal sd? In the script there is a connection between internal and external storage so i would assume that both "adresses" need to be correct in order for the script to work. Just an opinion....
Sent from my SM-G901F using XDA Free mobile app
Click to expand...
Click to collapse
several1989 said:
sounds interesting... ill take a look at it soon!
Click to expand...
Click to collapse
I think there's a problem with the commands that the script uses. If I try to do umount from the terminal, nothing happens. So maybe the script doesn't work in this phone, but if any of you are able to make it do so, let me know. So I think it's better to build the kernel from source, but before that make changes in the fstab file. With that, /data will be mounted at the second partition of the sdcard directly at boot time. Trying to do this now, but I'm facing some difficulties building the kernel. If I make it work, I'll post it
Testé folder Mouth playstore