[Samsung Galaxy Nexus] stevensoaj:
How-To Guide: Using init.d scripts

Some users don't know how to use init.d scripts that others create. I aim to show you how to set them up so that settings are applied on boot.

Step 1: Find a script to use! For the purpose of the How-To, we will use this script here. The purpose of this particular script is to set my color settings during the boot animation. It is called 900colorsettings. The number on the front indicates the order in which the script is run. A script titled 01zipalign would run before my 900colorsettings script. The name following the number doesn't really matter, I usually use something that describes what the script does, ie. colorsettings.

#!/system/bin/sh
# chmod -R 755 /system/etc/init.d

echo 1 > /sys/class/backlight/s6e8aa0/acl_set;
echo 0 > /sys/module/panel_s6e8aa0/parameters/contrast;
echo 0 > /sys/devices/platform/omapdss/manager0/gamma;
echo "0 0 0" > /sys/class/misc/colorcontrol/v1_offset;
echo "2000000000 2000000000 2000000000" > /sys/class/misc/colorcontrol/multiplier;

For the purposes of the How-To, I have the script set the default android colors on boot.

The first number echo'd in this script is setting the Content Adaptive Brightness (CAB) to "enabled." If you want it disabled, choose 0.

The second line sets the contrast to 0.

The third line sets the gamma to 0.

The fourth line is setting the red, green, and blue gamma offsets respectively.

And the fifth line sets the red, green, and blue Color Multipliers respectively.

Step 2: For the script to actually work, we need to put it in the init.d directory, which is found at "\system\etc\init.d". To do this, I use an app called Solid Explorer, which can be found on the Google Play Store here, but any root file browser should work fine. Just navigate to \system\etc\init.d and place the script there. You may see other scripts here as well, these vary based on your current ROM and Kernel.

Here's Mine:

Step 3: Set the permissions. Using Solid Explorer to do this, long press the script until a menu appears, then choose Properties. From there, you will see the properties of the script. There is a section called Attributes that shows the current permissions as well as the Owner and Group that the script belongs to. This is where we want to be. Click the change button. Here we want to change the permissions so that all 3 of the "R" checkboxes are checked, the top "W" checkbox is checked, and all 3 of the "X" checkboxes are checked. At the bottom it should show "755 -rwxr-xr-x". Press OK.

This is what it should look like:

Step 4: Change the Owner and Group. If they are not already, we need to change the owner to 0:root and the group to 2000:shell. Click the set button to the right to apply your changes. A prompt will appear asking you if you're sure you want to change the permissions. Click yes.

When you're done, everything should look like this:

Step 5: You're done! :highfive:You can now reboot to see if your script is working. If you used the script I mentioned here, you should notice the color changes take affect either during the Google boot logo or the boot animation.

There's another screenshot attached that may help, but I didn't know where to throw it in the post.

Good luck! Be sure to hit Thanks if this post helped you.:good: