[Q] Revolution HD add init.d script - Galaxy S III Q&A, Help & Troubleshooting

Hi all,
I have a problem with the rom in the subject, the headphone amplifier level is too high for me and I want to set a lower value to it.
I created this script:
Code:
#!/system/bin/sh
echo 1 > /sys/devices/virtual/misc/scoobydoo_sound/headphone_eq
echo 40 > /sys/devices/virtual/misc/scoobydoo_sound/headphone_amplifier_level
I have saved it in the /system/etc/init.d/ folder, I have set user and group (root:shell) and permissions (755) like the other scripts in that folder but the script simply isn't started at boot time!
at the end of the file /system/etc/init.post_boot.sh there are these lines:
Code:
# Execute /system/etc/init.d scripts on boot
chgrp -R 2000 /system/etc/init.d
chmod -R 777 /system/etc/init.d
/system/xbin/busybox run-parts /system/etc/init.d
log -p i -t ARHD "init.d support activated"
;;
what I need to do to allow the system to start my script?
thank you!

k4po said:
Hi all,
I have a problem with the rom in the subject, the headphone amplifier level is too high for me and I want to set a lower value to it.
I created this script:
Code:
#!/system/bin/sh
echo 1 > /sys/devices/virtual/misc/scoobydoo_sound/headphone_eq
echo 40 > /sys/devices/virtual/misc/scoobydoo_sound/headphone_amplifier_level
I have saved it in the /system/etc/init.d/ folder, I have set user and group (root:shell) and permissions (755) like the other scripts in that folder but the script simply isn't started at boot time!
at the end of the file /system/etc/init.post_boot.sh there are these lines:
Code:
# Execute /system/etc/init.d scripts on boot
chgrp -R 2000 /system/etc/init.d
chmod -R 777 /system/etc/init.d
/system/xbin/busybox run-parts /system/etc/init.d
log -p i -t ARHD "init.d support activated"
;;
what I need to do to allow the system to start my script?
thank you!
Click to expand...
Click to collapse
actually it seems that no one file inside that directory is started on boot! also the file that already were into the directory!

Ok a developer told me that init.d support will be available from next release!
I'll try something different
Sent from my GT-I9300 using xda app-developers app

Related

is there any ways to open support for init.d on version 1.5.7??

i have rooted perfectly,and built the folder /system/etc/init.d and i gave limits of authority to it.besides,i modify the file install-recovery.sh,the content is
【
#!/system/bin/sh
if ! applypatch -c MTD:recovery:2048:b01ab98799f9db633bbc6b43fe0df8fe5cebb820; then
r=`/data/sqlite3 /data/data/com.android.providers.settings/databases/settings.db "select * from system where name='stay_on_while_plugged_in';"`
if [ $r eq "" ]; then
/data/sqlite3 /data/data/com.android.providers.settings/databases/settings.db "insert into system values (null, 'stay_on_while_plugged_in','0');"
else
/data/sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update system set value='0' where name='stay_on_while_plugged_in';"
fi
rm /data/sqlite3
log -t recovery "Installing new recovery image"
applypatch MTD:boot:8388608:f1e31577c64654f400f65ddea1fb4d6a51be9ba9 MTD:recovery c54d675c3e1a8fe9e9d810e7bee501111bacd2ed 8388608 f1e31577c64654f400f65ddea1fb4d6a51be9ba9:/system/recovery-from-boot.p
else
log -t recovery "Recovery image already installed"
fi
# chmod the init.d dir
busybox chmod -R 755 /system/etc/init.d
# run init.d
/system/bin/logwrapper /system/bin/busybox run-parts /system/etc/init.d
】.
but when i reboot the phone,the file Won't enforced.i wonder why?
after testing,when i copy the sh script from init.d to install-recovery,it works.but it confuses me more,why can't i transfer the script from init.d to execute??
mapleshadow said:
after testing,when i copy the sh script from init.d to install-recovery,it works.but it confuses me more,why can't i transfer the script from init.d to execute??
Click to expand...
Click to collapse
Its 5am and I haven't slept much, but have you checked the permissions and made sure they are rw-r-r I've noticed files with different configuration not having these have some issues while running.
Easiest way to look and change is RootExplorer
I ran into a similar issue with my phone. Make sure your init.d folder has execute permissions and the scripts inside the same. i got fed up and made the scripts inside init.d executable ... seems to work now

My update for AIO Automatic Installation Script

Hello, Im useing this script http://forum.xda-developers.com/showthread.php?t=951274 to install JIT, DualTouch, etc.
I have some update for .sh script.
In JIT installation part:
Code:
echo "Backing up build.prob file"
busybox cp -f /system/build.prop /system/build.prop.stock
echo "Copying build.prop to /system/"
busybox cp -f data/jit/build.prop /system/build.prop
Here script rename system build.prop file to build.prop.stock and copy new build.prop from script folder to system.
And in JIT deinstallation part:
Code:
echo "Copying libraries and build.prop to /system/"
...
busybox cp -f data/jit/disable/build.prop /system/build.prop
And here script copy new build.prop from script folder to system.
BUT!
In deinstallation we need to get back our stock build.prop what was renamed in installation part!
So, i suggest to change
Code:
busybox cp -f data/jit/disable/build.prop /system/build.prop
to
Code:
busybox mv -f system/build.prop.stock system/build.prop
to rename build.prop.stock to build.prop.
And why did we copy/past this build.prop files? Why we cant copy stock build.prop and edit it this way:
Code:
echo "#DEVICE_PROVISIONED=1" >> /system/build.prop
echo "dalvik.vm.heapsize=30m" >> /system/build.prop
echo "#kernel.log=default" >> /system/build.prop
echo "dalvik.vm.execution-mode=int:jit" >> /system/build.prop
What do you think?
And sorry, I cant post this to Development forum because I have < 10 posts.
Iam searching in Google for help and so i find your Post here.
Maybe u can help me a bit.
I have a GalaxyNexus.
I have a Build.prop with and one without Tablet Mode.
I like to use sometimes TabletMode and sometimes not.
I think with a Script like u use here i can change what build.prop to use.
Lets say i have the "build.prop" with TabletMode and a "build.prop.stock" without that Mode.
How can i make it possible to activate the .stock and dissable the TabletMode. And then again the other way arround. ???

[HOW TO]Adding init.d support

This is a quick how to on how to add init.d support to your device. I am posting this as i have had alot of intrest on the subject.
This method has been tested on the n7000 with a rooted rom and philz kernel if you test on other devices and it works(or does not work) please let me know and i will build a compatibility list
you are doing this at your own risk so do not complain when you mess it up.
use this method to test the init.d support if successful then just add your init.d scripts to the init.d folder.
1. Download the file from here: 00test.zip
2. Extract the file, you will get a file named 00test. DO NOT flash!
3. Paste it into /etc/init.d. If there is no init.d folder, most probably you DO NOT have init.d support. However, if you still wanna try, just create the folder named "init.d"
4. Change the permissions of the init.d folder and 00test into rwxrwxrwx.
5. Reboot.
6. If you see a file named Test.log in /data, you have init.d support. If not, you will have to run Uni-init, Term-init or Zip-init.
at step 3 you should have init.d support if you have a rooted rom and a kernel which has init.d support.
if i have helped you please hit thanks button. :good:​
Uhhh, this doesn't tell you at all how to add init.d support. It just tells you how to test and see if you already have init.d support. Thread title is misleading.
1. add this line
exec /system/bin/sysinit
in init.rc (in ramdisk) ,then compile boot.img
2.flash the boot.img
3.extract sysinit (from the attached file) and copy in /system/bin/ with permission rwxr-xr-x (755)
4.reboot
or you can cook it with dsixda kitchen ... ,
just use this apk called uni init.d it work well on my device ...
here is the link http://forum.xda-developers.com/showthread.php?t=1933849
Or, if you really want to learn a little, you can get the VTS (Virtual Ten Studio) from XDA Developers (free), Do a boot project, and add the following in init.rc
Code:
run-parts /etc/init.d
service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
disabled
oneshot
Then re-compile your boot image and flash or fastboot it.
MD
There is not init.rc in my boot.img ! What can I do now?
PHP:
# Adds kernel's Init.d
INITD() {
if [[ -e "/PATH/TO/init.rc" ]]; then
sed -i -e '0,/class_start /s//start sysinit\n\n class_start /' "/PATH/TO/init.rc"
sed -i -e 's/service media /service sysinit \/system\/bin\/logwrapper \/system\/xbin\/busybox run-parts \/system\/etc\/init.d\n disabled\n oneshot\n\nservice media /' "/PATH/TO/init.rc"
cd "$(dirname "$0")"
cd ..
# Call other methods
MOUNT
INSTALL_RECOVERY
SYSINT
PERMISSIONS
else
ui_print "ERROR, missing needed contents from the ramdisk?!";
rm -rf "$ACTIVE_PROJECT/TEMP"
return 1
fi
}
# Mount system as R/W
MOUNT() {
busybox mount -o remount,rw -t auto /system
}
# Build and write to install-recovery.sh
INSTALL_RECOVERY() {
if [ -e /system/etc/install-recovery.sh ]
then
busybox echo "# init.d support" >> /system/etc/install-recovery.sh
busybox echo "busybox run-parts /system/etc/init.d/" >> /system/etc/install-recovery.sh
busybox echo "" >> /system/etc/install-recovery.sh
busybox awk '!x[$0]++' /system/etc/install-recovery.sh > /tmp/install-recovery.sh
busybox cat /tmp/install-recovery.sh > /system/etc/install-recovery.sh
busybox echo "" >> /system/etc/install-recovery.sh
else
cat > /system/etc/install-recovery.sh
busybox echo "#!/system/bin/sh" >> /system/etc/install-recovery.sh
busybox echo "# init.d support" >> /system/etc/install-recovery.sh
busybox echo "busybox run-parts /system/etc/init.d/" >> /system/etc/install-recovery.sh
busybox echo "" >> /system/etc/install-recovery.sh
fi
}
# Build and write to systint
SYSINT() {
if [ -e /system/bin/sysint ]
then
busybox echo "#!/system/bin/sh" >> /system/bin/sysint
busybox echo "# init.d support" >> /system/bin/sysint
busybox echo "" >> /system/bin/sysint
busybox echo "export PATH=/sbin:/system/sbin:/system/bin:/system/xbin" >> /system/bin/sysint
busybox echo "/system/bin/logwrapper run-parts /system/etc/init.d" >> /system/bin/sysint
busybox echo "" >> /system/bin/sysint
busybox awk '!x[$0]++' /system/bin/sysint > /tmp/sysint
busybox cat /tmp/sysint > /system/bin/sysint
busybox echo "" >> /system/bin/sysint
else
busybox echo "#!/system/bin/sh" > /system/bin/sysint
busybox echo "# init.d support" >> /system/bin/sysint
busybox echo "" >> /system/bin/sysint
busybox echo "export PATH=/sbin:/system/sbin:/system/bin:/system/xbin" >> /system/bin/sysint
busybox echo "/system/bin/logwrapper run-parts /system/etc/init.d" >> /system/bin/sysint
busybox echo "" >> /system/bin/sysint
fi
}
# Set permissions accordingly
PERMISSIONS() {
busybox chmod 755 /system/etc/install-recovery.sh
busybox chown 0.0 /system/etc/install-recovery.sh
busybox chmod 755 /system/bin/sysint
busybox chown 0.2000 /system/bin/sysint
}
# Start process here
INITD
Here is a small snippet from my script that I use with MyMinds_Kernel_Swap for flashing in my recovery to pull my boot.img using dd, unpack using my unmkbootimg binary, edit init.rc and amongst other things in /system, swap kernel, build ramdisk with mkbootfs, build boot.img with mkbootimg, and flash using dd. Pretty much like AnyKernel, but I wrote my own because AnyKernel just didn't work.
Anyways, here you go. Remember, some adjustments are needed more in less but should give you an idea for init.rc support. If you wish to see my entire script then just look up my github and find my repo as named above.

[Q] Can someone please help me run this script?

Hi everyone
I am trying to run a script on my android that extracts asec files back to apk's on my phone. The scripts works fine when i put in every line manually into terminal though obviously that is a pain in the ass. So i put it into a .sh file and put the .sh file in system root for ease of execution..
i then do:
su
sh deasec.sh
though it returns:
unexpected syntax error: do
can someone tell me what i am doing wrong? - thank you kindly! (will press thanks!)
Code is below
Code:
#!/system/xbin/sh
LD_LIBRARY_PATH="/system/lib"
PATH="/system/xbin:/system/sbin:/system/bin"
for ASEC in $(find /data/app-asec/ -name '*.asec')
do
echo "Deasec $ASEC"
PKG=$(basename $ASEC|cut -d'-' -f1)
echo "Package name $PKG"
if [ -d /mnt/asec/$PKG*/lib ]
then
echo "Relocate libs"
find /data/data/$PKG/ -type l -name lib -exec rm {} \;
cp -r /mnt/asec/$PKG*/lib /data/data/$PKG/
echo "Fix libs permissions"
chown -R system:system /data/data/$PKG/lib
chmod -R 755 /data/data/$PKG/lib
fi
APK=$(pm path $PKG|cut -d':' -f2)
echo "APK location $APK"
cp $APK /data/local/tmp/pkg.apk
chmod 644 /data/local/tmp/pkg.apk
pm install -r -f /data/local/tmp/pkg.apk && rm /data/local/tmp/pkg.apk
done
Have you done the script under Windows, you don't? You need to write the script under Linux. You can also write the script directly in your phone:
Open Terminal Emulator, and write the lines one by one this way:
Code:
echo line1 >> /sdcard/script.sh
echo line2 >> /sdcard/script.sh
echo line3 >> /sdcard/script.sh
...
Then move the script to its final location, and give it permissions (if needed).
nice one mate Thankyou

Init.d scripts not executing on boot

I have installed term_init.sh for Init.d support. The scripts run perfectly from SM script manager app. However, they never run upon booting.
I have rooted - Marshmallow.
Any ideas please?
Try this:
1. Create /system/etc/install-recovery.sh (if not exist) set perms to 0755 (rwxr-xr-x) and ownership to 0:2000 (root:shell)
and write:
#!/system/bin/sh
/system/bin/sysinit
2. Create /system/bin/sysinit and set perms to 0755 (rwxr-xr-x) and ownership to 0:2000 (root:shell)
and write:
#!/system/bin/sh
run-parts /system/etc/init.d
3. Create dir /system/etc/init.d and set perms to 0755 (rwxr-xr-x) and ownership to 0:2000 (root:shell)
4. Create /system/etc/init.d/00test and set perms to 0755 (rwxr-xr-x) and ownership to 0:2000 (root:shell)
and write:
#!/system/bin/sh
echo "init.d executed script at boot" > /data/initd.log
5. Reboot and check if /data/initd.log file exist
Thanks!
Yes, the term-init.sh which I installed does everything you have noted above with all permissions. The script executes within Script Manager App but won't execute on boot as intended. Thus, the log file doesn't appear in /data/test.log
Still stuck?
I never do that, so I don't know what can go wrong, but try add init.d service to init.rc:
# Run init.d scripts
service sysinit /system/bin/logwrapper /vendor/bin/busybox run-parts /system/etc/init.d
class main
user root
group shell
oneshot

Categories

Resources