[HOW-TO] Fix when the phone stuck in boot splash after apply V6 Supercharger - Android General

You may have applied V6 Supercharger to your phone. And after reboot, you stuck at the boot splash. Reboot once and V6 Supercharger install script tell you that you aren't supercharged. Here is how to fix it. (If you get looped in boot animation, this is NOT your fix. Sorry!)
Depend on your rom, you may have to do one of following:
Open the (rooted) File Manager, open the directory /etc/init.d/ and open file 99SuperCharger. OR
Turn on ADB on your phone, use your computer to pull the file /etc/init.d/99Supercharger by running
Code:
adb pull /etc/init.d/99SuperCharger
Edit the file at the almost bottom of the file, change the following code:
Code:
if [ "`ps | grep -m 1 [a]ndroid`" ]; then HellzYeah;
else HellzYeah &; fi;
To look like this:
Code:
if [ "`ps | grep -m 1 [a]ndroid`" ] || [ $1 = "bypass" ]; then HellzYeah;
else
rm $bootloopcookie
$0 bypass &
fi;
Depend on what you have done on step 1, do the following:
If you use (root) file manager, save the file. Grant the superuser permission if needed. Then browse to /data and delete file !!SuperChargerBootLoopMessage.log. Don't worry if it's not exist.
If you use your computer to edit your file, run the following command:
Code:
adb root
adb remount
abd push /path/of/99SuperCharger /etc/init.d/99SuperCharger
adb shell
And inside the adb shell, run:
Code:
chmod 755 /etc/init.d/99SuperCharger
rm /data/!!SuperChargerBootLoopMessage.log
exit
Don't worry if file /data/!!SuperChargerBootLoopMessage.log doesn't exist.
And that's it! The V6 Supercharger bootscript is worked as it's designed to. Thanks to zeppelinrox to make this great script.
For one who want to know some technical info (and my assumption of the cause), wait me until tomorow and i'll explain how i found it. read on:
In order to run script in /etc/init.d at boot, the line like this is inserted in init.rc:
Code:
on boot
...
# Start the init.d service
exec /system/bin/sysinit
(In case of cm - for example)
But, what does the /system/bin/sysinit do? Just this:
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
/system/bin/logwrapper /system/xbin/run-parts /system/etc/init.d
And this is the real source of problem. For some reason run-parts with logwrapper doesn't move on when you run a shell script function in background. If you scroll up in file 99SuperCharger, you'll found that "HellzYeah" is actually a function. And when it's execute in a boot process, "HellzYeah" will wait for boot process to continue. But run-parts (and the whole boot process) is waiting for the script to finish. You see? A deadlock!
The workaround is to execute function in the other way. What my modification do is re-executing the script with the parameter "bypass" in the background. This way, run-parts will not wait for it anymore. Then, when the script is re-executed, it will detect that it's called with the parameter "bypass". It'll run the function "HellzYeah", wait for boot process to finish, and, when the boot process is finished, supercharge your phone!
(if anyone is reading this, please inform zeppelinrox about this problem. I'm not able to post on the development forum yet.)
(This is my first post in xda. Hopefully it's helpful)

Related

[DEV][SCRIPT] Enhanced init.d support

Okay, I worked a bit on something to add a little more options to init.d scripts for my ROM's. I came up with the below solution and thought I should share it with whomever would like a bit more options in their own ROM's. This is a first draft so some of things can properly be done in other ways, but it works and it does add a lot more options when building startup scripts while it is compatible with regular init.d scripts as well. But fell free to pitch in with ideas if you like.
Note that this thread is directed to ROM cookers, but can be used by anyone that knows how to edit ramdisk's.
So there are several problems with the regular init.d methods. First of all there are two different ways of executing the scripts and it differs from ROM to ROM which method has been implemented. We have the "exec /system/bin/sysinit" which will execute all of the scripts before continuing with the normal boot and we have the service sysinit which will execute all scripts while the normal boot is running. Both are useful for different things but no ROM has both.
Also init.d will just start executing the scripts before/during the normal boot, depended on the method, but what if we need it to execute something at a specific time during boot. Before folder structures and such are created in /data? Or when the phone has completely booted into the GUI. Or before the phone is turned off and so on.
This method will implement different states where different parts of a script can be executed depended on where in the boot process we are. All it requires is a more extended sysinit file and a couple of extra lines in the init.rc file.
File: /init.rc
Code:
on early-init
##
# Whatever goes here
##
on init
##
# Whatever goes here
##
on fs
##
# Mount /system
##
# Make sure that we have the synlinks we need to use sysinit
symlink /system/bin/sysinit /system/bin/sysinit.onstart
symlink /system/bin/sysinit /system/bin/sysinit.onfs
symlink /system/bin/sysinit /system/bin/sysinit.onpostfs
symlink /system/bin/sysinit /system/bin/sysinit.onpostfsdata
symlink /system/bin/sysinit /system/bin/sysinit.onboot
symlink /system/bin/sysinit /system/bin/sysinit.onsysinit
symlink /system/bin/sysinit /system/bin/sysinit.onfinalize
symlink /system/bin/sysinit /system/bin/sysinit.oncomplete
symlink /system/bin/sysinit /system/bin/sysinit.onshutdown
exec /system/bin/sysinit.onstart
##
# Mount the rest of the partitions and remount /system without write permissions
##
exec /system/bin/sysinit.onfs
on post-fs
##
# Whatever goes here
##
exec /system/bin/sysinit.onpostfs
on post-fs-data
##
# Whatever goes here
##
exec /system/bin/sysinit.onpostfsdata
##
# If you want to include an additional *.rc file, do it here at the end of post-fs-data
##
on boot
##
# Whatever goes here
##
exec /system/bin/sysinit.onboot
start sysinit
##
# Start any other services
##
on property:init.svc.bootanim=stopped
start syscomplete
on property:sys.boot_completed=1
exec /system/bin/sysinit.onfinalize
on property:sys.shutdown.requested=1
exec /system/bin/sysinit.onshutdown
service sysinit /system/bin/sysinit.onsysinit
disabled
oneshot
service syscomplete /system/bin/sysinit.oncomplete
disabled
oneshot
##
# The rest of the file
##
File: /system/bin/sysinit
Code:
#!/system/bin/sh
export PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
if [ -d /system/etc/init.d ]; then
case $(basename $0) in
"sysinit") INIT_STATE="$1" ;;
*) INIT_STATE="`basename $0 | cut -d '.' -f2`" ;;
esac
while :
do
if [ ! -f /sysinit.stage.prop ]; then
mount -o remount,rw /
touch /sysinit.stages.prop
mount -o remount,ro /
fi
if ( [ "$INIT_STATE" != "onfinalize" ] && [ "$INIT_STATE" != "oncomplete" ] ) || ( [ "$INIT_STATE" = "onfinalize" ] && [ ! -z "`grep onpostsysinit /sysinit.stages.prop`" ] ) || ( [ "$INIT_STATE" = "oncomplete" ] && [ ! -z "`grep onfinalize /sysinit.stages.prop`" ] ); then
if [ "$INIT_STATE" = "onsysinit" ]; then
RUN_STATES="onsysinit onpostsysinit"; sleep 1
elif [ "$INIT_STATE" = "oncomplete" ]; then
RUN_STATES="onservice oncomplete"
else
RUN_STATES="$INIT_STATE"
fi
for x in $RUN_STATES; do
log -p v -t sysinit "Switching to state '$x'..."
case $x in
# Make it compatible with old init scripts
onboot|"") FILES="`find /system/etc/init.d -type f | sort`" ;;
*) FILES="`find /system/etc/init.d -type f -iname '*.rc' | sort`" ;;
esac
for i in $FILES; do
if [ ! -d $i ] && [ -x $i ]; then
log -p v -t sysinit "Executing $i..."
if [ "$x" = "onservice" ]; then
logwrapper $i $x > /dev/null &
else
logwrapper $i $x
fi
else
log -p w -t sysinit "Skipping $i. Not an executable!"
fi
done
mount -o remount,rw /
echo $x >> /sysinit.stages.prop
mount -o remount,ro /
done
break
fi
sleep 1
done
fi
To use this you need to end the names of your init script with .rc like "55<name>.rc" instead of just "55<name>". This is to keep it compatible with regular init.d scripts.
This will allow you to build init.d scripts like this
Code:
#!/system/bin/sh
case $1 in
onstart)
# Do something right after the system partition has been mounted RW (No other partitions at this time)
;;
onfs)
# Do something right after the rest of partitions has been mounted and system has been remounted RO, before any of them are used or changed in any way.
;;
onpostfs)
# This is almost the same as onfs, only minor changes has normally been made here
;;
onpostfsdata)
# Do something after the /data partition has been rebuild with folders, permission, ownership and so on
;;
onboot)
# Do something right before Android starts booting and it's services are triggered
;;
onsysinit)
# Do something while Android is booting. This will NOT stall the boot process but run along side it
;;
onpostsysinit)
# Do something as soon as onsysinit has finished
;;
onfinalize)
# Do something when the system is almost booted, this also includes the sysinit parts above
;;
onservice)
# Do some constant work in the background (Service/Daemon)
;;
oncomplete)
# Do something when the phone is fully booted and the boot animation is gone
;;
onshutdown)
# Do something before the phone is turned off or rebooted
;;
esac
EDIT 1
Added 'onfinalize' which is actually the old oncomplete. The new oncomplete runs as a service like onsysinit and onpostsysinit to ensure that you are able to use things like "sleep" without stalling the system.
Rewrote sysinit, much cleaner now
EDIT 2
Added 'onservice' which can be used to run a constant task in the background after the phone has booted
Great concept and great work
I can see how this would be very handy!
Sent from my PG86100 using Tapatalk 2
looks intresting..Hmmmmm
Genius man. Awesome stuff.
Sent from my SCH-I500 using Tapatalk 2
Awesome great work. The last line say do comething before the phone is turned off or rebooted. is it suppose to say something.
Sent from my HTC Desire CDMA using Tapatalk 2
jayallen1980 said:
Awesome great work. The last line say do comething before the phone is turned off or rebooted. is it suppose to say something.
Sent from my HTC Desire CDMA using Tapatalk 2
Click to expand...
Click to collapse
'something' is correct, have been changed
Some examples would be good
Can you please? (Example of Executing Juwe's RAM script will be nice in all cases)
What if I want to keep init.d folder empty and integrate my scripts inside boot.img? and then execute them inside it?
varun.chitre15 said:
Some examples would be good
Can you please? (Example of Executing Juwe's RAM script will be nice in all cases)
What if I want to keep init.d folder empty and integrate my scripts inside boot.img? and then execute them inside it?
Click to expand...
Click to collapse
Why would you integrate scripts into the boot.img? The point of init.d is to be able to add things to boot without changing the boot.img. If you want to execute things from within the boot.img, then just place your scripts in it (sbin would be a good place) and execute it the same way my example executes /system/bin/sysinit.
And as for examples, it's easy. Just place your code in that section (onboot, onfs etc) where you want the code to be executed. The onboot is the default in process in most ROM's and also where regular init.d scripts is executed in this example.
dk_zero-cool said:
Why would you integrate scripts into the boot.img? The point of init.d is to be able to add things to boot without changing the boot.img. If you want to execute things from within the boot.img, then just place your scripts in it (sbin would be a good place) and execute it the same way my example executes /system/bin/sysinit.
And as for examples, it's easy. Just place your code in that section (onboot, onfs etc) where you want the code to be executed. The onboot is the default in process in most ROM's and also where regular init.d scripts is executed in this example.
Click to expand...
Click to collapse
because the point of this is to start scripts when you want.. there is a few scripts I have that can't be ran until os is loaded, there for making this a great setup for me.
init.d & boot.img runs everything at boot... not after boot.
eugene373 said:
because the point of this is to start scripts when you want.. there is a few scripts I have that can't be ran until os is loaded, there for making this a great setup for me.
init.d & boot.img runs everything at boot... not after boot.
Click to expand...
Click to collapse
The 'oncomplete' runs everything when the system is fully loaded, that's the point of this init.d system, to be able to run scripts in different ways during different stages.
dk_zero-cool said:
The 'oncomplete' runs everything when the system is fully loaded, that's the point of this init.d system, to be able to run scripts in different ways during different stages.
Click to expand...
Click to collapse
yeah I got it..... I've been having one hell of a time starting script until I cam across this...
If it starts like a normal init.d file it hangs the boot process... with this edit I can trigger it to run on bootcomplete with out hanging the service
sorry, I just noticed I quoted you and not the other guy
eugene373 said:
yeah I got it..... I've been having one hell of a time starting script until I cam across this...
If it starts like a normal init.d file it hangs the boot process... with this edit I can trigger it to run on bootcomplete with out hanging the service
sorry, I just noticed I quoted you and not the other guy
Click to expand...
Click to collapse
Yes oncomplete, oninit and onservice will not stall the process, oninit will however stall onfinalize, oncomplete and onservice. onservice will run the script in a seperate process in the background, so that will not even stall the rest of the init.d scripts while executing, making that great for scripts that should keep running, or where you don't know how long they should run.
dk_zero-cool said:
Yes oncomplete, oninit and onservice will not stall the process, oninit will however stall onfinalize, oncomplete and onservice. onservice will run the script in a seperate process in the background, so that will not even stall the rest of the init.d scripts while executing, making that great for scripts that should keep running, or where you don't know how long they should run.
Click to expand...
Click to collapse
Adding this into all my boot.img from now on & I'll be sure to link this thread...
I think this should be the new standard for all Devs, this method is not only a great idea!
But for the End User, there's so much more control over what can / should be done on starting process...
I personally want to thank you for this, as this truely is one of the better methods I've ever seen!!
~Eugene
dk_zero-cool, I'd like to ask you, why you use soft-links and not parameters?
It will remove all
Code:
symlink /system/bin/sysinit /system/bin/sysinit.*
from init.rc and you will not need to use case in sysinit.
Because this whole construction:
Code:
case $(basename $0) in
"sysinit") INIT_STATE="$1" ;;
*) INIT_STATE="`basename $0 | cut -d '.' -f2`" ;;
esac
seems to me like overload.
hashnon said:
dk_zero-cool, I'd like to ask you, why you use soft-links and not parameters?
It will remove all
Code:
symlink /system/bin/sysinit /system/bin/sysinit.*
from init.rc and you will not need to use case in sysinit.
Because this whole construction:
Code:
case $(basename $0) in
"sysinit") INIT_STATE="$1" ;;
*) INIT_STATE="`basename $0 | cut -d '.' -f2`" ;;
esac
seems to me like overload.
Click to expand...
Click to collapse
Because I have had bad experience using arguments along with the exec command, so I try to avoid that. Mostly because I can't remember the issues anymore.
As for overload, this is to small to be noticed, specially when this is only executed a couple of times during startup. If this was to be executed every couple of minute during the phone on state, then sure. But when the phone has booted, sysinit is no longer used.
Pretty neat design. I've found that having to deal with some of the escaping of an exec can be a nightmare too.
In the kernel ramdisk of my Xperia ray, there are two kinds of inits, init.rc and init.semc.rc.
The "on fs" exists in init.semc.rc (where i can see the commands to mount the partitions). In init.rc there's no "on fs" between "on early-fs" and "on post-fs".
So i've put the "on fs"-part in init.semc.rc and the rest of your fabulous work into init.rc. When i look after booting into the /system/bin/ directory i can see all the "sysinit.on........." symlinks. Is that proof that i did everything right so far? Haven't tried any script yet to be honest.
Kaskade said:
In the kernel ramdisk of my Xperia ray, there are two kinds of inits, init.rc and init.semc.rc.
The "on fs" exists in init.semc.rc (where i can see the commands to mount the partitions). In init.rc there's no "on fs" between "on early-fs" and "on post-fs".
So i've put the "on fs"-part in init.semc.rc and the rest of your fabulous work into init.rc. When i look after booting into the /system/bin/ directory i can see all the "sysinit.on........." symlinks. Is that proof that i did everything right so far? Haven't tried any script yet to be honest.
Click to expand...
Click to collapse
Yes some phones have extra init files for onfs. Mostly if they use different file system types. What you did is correct in this case.
You can check the file /sysinit.stages.prop to see if all stages was executed. If one stage is missing from that file, it was not executed.
Deleted.
hi is ths still working in android marshmallow? cant find sysinit file in system/bin/sysinit

[GUIDE] SManager - How to use Commands

Hi,
I want to learn some of the commands for use in SManager (Script Manager) for ANDROID.
https://sites.google.com/site/devwom/script-manager
Does anyone know a suitable thread with guide or commands for SManager? I tried searching the web and XDA but did not find anything myself.
Specifically I want to know the cmd line to start an app.
EDIT 1:
Spent a good few hours trying to google a solution but drawn a blank.......Maybe Shell Scripts for Linux are not same as for Android...?
I would like to be able to run a script that does the following:
Checks if a directory exists on the sdcard
then executes a command (renaming of 2 directories)
then starts a program
EDIT 2:
well a few emails with the author of SManager and I was able to write my first script to check if the app is running and then if not, to rename folders and start the other version of the app. (I have Navigon Europe as well as Navigon Australia and was looking for a solution to allow both to co exist on my One-X at the same time. As both apps share the same directory structure the issue was that starting one version would overwrite the critical files of the other).
Now with my script installed as a widget I can toggle between each version without problem.
Here is some useful information on shell language for others (credits to the author of SManager Devwom):
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
Here are some critical bits of info received during my emails with him:
Thanks a lot for your interest in SManager.
The requested commands is a mix between linux commands and android os commands.
To get info about each command you can search in google and select the preferred page.
But the commands available in each Android device depends on running rom.
To get all available commands in your device, simply execute a ls (lower case LS) in system directories, that is:
ls /system/bin
ls /system/sbin
ls /system/xbin
ls /system/usr/bin
ls /system/usr/sbin
ls /system/usr/xbin
These are the most common directories where binaries resides in android devices.
May be you also can have commands at:
ls /bin
ls /sbin
ls /usr/bin
ls /usr/sbin
usually android rooted roms have the well known busybox, to get a list all comands inside it simply execute
busybox
to get all installed packages (and running names) from your device you can execute:
pm list packages
to get info about running process
ps
or
ps aux
or
ps -aux
depending on ps version installed
If conditions are based on test bash command this command is a bit confused, because usually it is named as [, and other times it is built-in inside shell
read "test man page" to get a full list of test command flags.
To check if an app is running:
if [ -n "$(ps|grep os.tools.scriptmanager)" ] ; then
echo SManager is running
fi
To check if app is NOT running:
if [ -z "$(ps|grep os.tools.scriptmanager)" ] ; then
echo SManager is NOT running
fi
To check if a file exist:
if [ -e /sdcard/file ] ; then
echo /sdcard/file exists
fi
To check if a file exist and it is a directory:
if [ -d /sdcard/file ] ; then
echo /sdcard/file exists and is directory
fi
To rename a directory simply use mv command:
I hope you can build your script with this info.
Start app it is very easy but getting correct info to start app is a bit confused.
starting app uses "am command"
To get correct info to start app you should execute:
logcat |grep Starting
in a terminal on device
then go to launcher and launch desired app
then go back to the terminal and you will see a line with info about how to fill am command.
For example if you execute SManager
in
logcat|grep Starting
output you will see
I/ActivityManager(* 275): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=os.tools.scriptmanager/.launcherActivity } from pid 377
so to start scriptmanager you need the following command
am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n os.tools.scriptmanager/.launcherActivity
I do not know how to stop apps from command line, I usually use killall command:
killall os.tools.scriptmanager
if you do not have killall command you can use grep and awk or cut commands
kill "$(ps|grep os.tools.scriptmanager|grep -v grep|awk '{print $2;}')"
or
kill "$(ps|grep os.tools.scriptmanager|grep -v grep|cut -f5 -d" ")"
may you need adjust -f5 flag
To execute script as shortcut install SMWidgets.
Scripts usually ends with last line , ie, not special action is required, it will exit with the last executed command return code
Also you can add
exit 0
or preferred exit value, but 0 usually means OK
To end script in the middle use
exit value
where value usually it is not 0
Also it is better use mv command instead rename command.
rename command it is not linux standard, but mv command is in all linux shells.
Android shell programing it is not equals to linux shell programming but this was one of my first scripting documents many years ago and it can be used as a guide. http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
Best regards,
Devwom
Thanks, this is valuable information! It's a shame this thread didn't get more replies
I've been looking to change my wallpaper by script, but so far I haven't been succesful. With your guide, I guess I'm a step closer to my goals!
Hi.
Perhaps developer of smanager or any expert is reading...
I would like to write a script for 2 purposes. Both handle with samba share running on my ubuntu.
1st situation.: I would like to move my media, download and documents files from android to the desired folder on my Ubuntu, which is shared by samba in my LAN.
The goal is to start this script with just touching a widget.
2nd situation: I would like to copy files from my samba shared folder in ubuntu to a specific folder on sdcard in android. All files in folder on sdcard should be deleted before copying. Again just by touching a widget.
Shared folder on samba are with password and rw.
Till now I am doing it manually with esexplorer...
I would like to do it with script.
Sent from my Incredible S using xda app-developers app

[Enable Cron for Android Phones]

# What is Cron ?
Cron is the time-based job scheduler in Unix-like computer operating systems. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates.
Examples :
The following line specifies that the amazing V6 Supercharger flush script execute every 3 hours of every day of the month, of every day of the week :
0 */3 * * * /system/xbin/flush
The following line causes the user program /data/jitter.sh to be run at 1am, 6pm and 11pm :
0 1,18,23 * * * /data/jitter.sh
# What is this thread about ?
This thread created just to share my little knowledge to activate crond in android phones, which could be usefull as additional tweak for our android phones.
# Disclaimer
Do this at your own risk - Ensure you understand that you are assuming all risks and there may also be other adverse effects. If you do not want to bear the risk, Please don't continue.
# Tested Device
- Galaxy Wonder GT-I8150 Stock ROM GB 2.3.6
- Lenovo S880 Stock ROM ICS 4.0.3
- Lenovo A560 Stock ROM ICS 4.0.3
# Requirement
1. Device is rooted, search Here howto root.
2. Already enable init.d, read Here howto enable init.d.
# Howto Install
1. Download SP8-CRON_v2.zip
2. Extract the Zip file to your SD card ( Install.sh & SP8CRON), for example in /mnt/sdcard.
*** Installation Method ***
Using ADB :
1. Connect to phone using adb, then run su.
2. go to extraction directory, example cd /mnt/sdcard
3. run this command : sh Install.sh
4. Installation script will begin and automatically reboot your phone when finish.
Using Script Manager :
1. Install Script manager.
2. Run Script manager, choose "Browse as Root".
3. Go to extraction directory, tap : Install.sh file , then tap : enable su (skull icon).
4. Installation script will begin and automatically reboot your phone when finish.
# Howto IUse
To modify cron schedule to meet your needs, please modify cron file at : /data/cronjob/root
(Examples above)
To check whether crond is running or not :
from ADB or Script Manager Console :
1. Run : su
2. Run :
pgrep -l crond , System will respon with showing pid number.
... and ...
crontab -l , System will list cron schedule list.
Thanks for reading this simple thread, Please hit Thanks if you found this thread is usefull
Changes :
V1 - Script on data folder and add logs.
V2 - Modify script to run on system folder, add Amazing V6 Supercharger flush and sclean script to schedule
-[spikecursed]-
Code:
# Mounting root
busybox mount -o remount,rw rootfs / 2>/dev/null;
ln -s /system/bin/ /bin 2>/dev/null;
mkdir -p /var/spool/cron/crontabs 2>/dev/null;
ln -s /system/etc/cron.d/root /var/spool/cron/crontabs/root 2>/dev/null;
busybox mount -o remount,ro rootfs / 2>/dev/null;
This is messing up my "internal sd card" so I am trying to set the path in the cron file instead but PATH=/system/bin isn't doing it, anyone know how to achieve this?
I have used the script and it's work great! Thank you very much.
I am writing this for any person having same problem as me.
I was struggle finding the real path for cron script.
The command crontab -e leads me to the incorrect path, the real and origin is at "/system/etc/cron.d/root".
We have to mount /system first with "mount -o remount,rw /system".
Then edit "/system/etc/cron.d/root" for cron script.
Don't forget to mount back /system as read-only with "mount -o remount,rw /system".

[GUIDE][TUT] Learn basic scripting, how to execute scripts, mod building

Hello guys, I want to share my expirience with users who wants to learn basic scripting stuff, busybox commands, how to use them, how to execute them, how to make .sh files.
Ok, let's start!!! ​
First we must to learn what is busybox. BusyBox is software that provides several stripped-down Unix tools in a single executable file. It runs in a variety of POSIX environments such as Linux, Android.
Busybox allows you or programs to perform actions on your phone using Linux (copied from Unix) commands. Android is basically a specialized Linux OS with a Java compatible (Dalvik) machine for running programs. The Android kernel is a modified version of the Linux kernel (that is why the Android kernel must always be open source). Busybox gives functionality to your phone that it does not have without it. Many programs, especially root programs such as Titanium Backup, require busybox to perform the functions of the program. Without busybox installed your phone is much more limited in what it can do.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Here is some info about busybox, you can track here release dates, you can download sources...
http://spblinux.de/2.0/doc/commands.html
Also here is busybox installer for our "linux devices" heheh ^~^ by stericson. You have two versions of it as you see paid and free.
Chose paid if you want to donate him for awesome job.
Free:
https://play.google.com/store/apps/details?id=stericson.busybox
Paid(PRO):
https://play.google.com/store/apps/details?id=stericson.busybox.donate
After that you need Terminal app, you can download it from playstore too.
Link: Download it from here
This app emulates Linux terminal, with it you can access to android shell.
Lets's start with learning basic terminal stuff
The most of shell commands doesn't need root access, but some of them are need it.
To give root access to the terminal app, you need to type next.
Code:
su [I](press enter)[/I]
After pressing enter, another window will popup to grant root access. Tap on GRANT
***When you typing something into the terminal window, take care because EVERYTHING IS CASE SENSITIVE.***
We all know there are three permissions per group on a file read,write,execute or rwx.
To set permissions as rw-r--r-- we use chmod 644 or 0644 but most don't know why ? Here's why
Read or r has a positional weight of 4, Write or w has 2 and Execute or x has 1. Add them up for each group and you'll get the chmod number to use. For above example, the numbers will be (4+2)(4)(4) i.e. 644 or if you want four digits, use 0644 and that's pretty much it. It comes in very handy if you're learning shell scripting because Linux revolves around permissions. (Thanks to @MSF Jarvis)
Let's go trough basic shell commands. ​
If you interested about all commands, you can check them HERE.
cat [file destination] - use this command to print everything from a file to the terminal window
Example:
Open terminal window, and type next:
Code:
busybox cat /proc/meminfo [I](press enter)[/I]
You will get output after pressing enter
Now, you can see here, if you open any file manager and go to destination which was given for example "/proc/meminfo"
You will see next file and stuff inside it
Heheh, is it same?? ^~^ for sure that it is, you can use it for any file on your device which have text in it.
Let's go to the next basic command ^~^
echo - this command can be used for printing arguments to stdout. Also you can use it for adding text in already existing file which we need here, because we are learning scripting stuff, right? ^~^
Example:
Open terminal window, and type next:
Code:
busybox echo "Scripting is awesome" > /sdcard/test [I](press enter)[/I]
Ok, let's explain this.
First you added a command echo to add something in existing file, then between "..." we need to put arguments, for our case this is "Scripting is awesome" next we see symbol " > " which will forward arguments to next added direction, in our case this is "/sdcard/test".
First we need to have a existing file (IMPORTANT)
After we agreed with that we have a file
Open terminal as I already explained and after pressing enter you will get output on the terminal window.
That is a file from our /sdcard/
Don't delete this file, we will use it later with " sh" command.
Let's go to the next basic command
clear - Use this comand to clear whole terminal window.
Example:
You have a terminal window which have a lot of stuff on it, for example stuff from previous lines, text, etc.
You can simply make it blank with just one command
Code:
busybox clear [I](then press enter)[/I]
And voila, terminal window is blank
touch [file destination] - Use this command to create a blank file on any destination on your android device.
Example:
Open terminal window, and type next:
Code:
busybox touch /sdcard/scripting_007 [I](press enter)[/I]
This will create file called "scripting_007" on "/sdcard/" in this case, you can put any.
As you can see file "scripting_007" exist on /sdcard/
mkdir [file destination] - Use this command to create one empty folder on any destination on your android device.
Example:
Open terminal window, and type next:
Code:
busybox mkdir /sdcard/development [I](press enter)[/I]
This will create folder called "development" on "/sdcard/" in this case, you can put any.
sh [path of a file] - Use this command to execute basic script
Example:
Open terminal window, and type next:
Code:
sh /sdcard/test [I](press enter)[/I]
This will execute file which you make before with "echo" command
sleep [time in secs] - Use this command to make an offset between executing lines inside script.
Example:
Open terminal window, and type next:
Code:
busybox echo "Scripting is"
busybox sleep 10
busybox echo "awesome"
This is a combination of two commands as you can see, echo and sleep.
After launching this simple script in terminal window you will get first "Scripting is" and after 10 secs you will get awesome.
rm [ -f (file) -rf (folder)] - this is a command for removing files (-f) and folders (-rf)
Example:
Create a file called "android" on sdcard, then open terminal window, and type next:
Code:
busybox rm -f /sdcard/android
This simple code will remove a file called android from sdcard.
Now do the same thing with a folder, create one with the name "android" and run terminal emulator
Code:
busybox rm -rf /sdcard/android
This will remove folder called android from your sdcard.
Now, let's go with some advanced stuff​
You need any text editor, I suggesting this one
Link: Download from here
Now, open the app and write a new file and give it a name "test1"
Inside a file write next text:
Code:
busybox echo "Android"
busybox sleep 2
busybox echo "is"
busybox sleep 2
busybox echo "Awesome"
Save the file and copy it to some location, i suggest /sdcard/.
Open up terminal emulator and type next
Code:
sh /sdcard/test1 [I](press enter)[/I]
This thing will execute your script with the name test1 from /sdcard/.
Output will be "Android", then after two seconds will appear "is" and then after two more seconds "Awesome" will appear. THATS IT!!! You learned how to make a file (script) and how to execute it with terminal emulator.
Now do the same thing make a file with the name "test2" and make another file with a name "print"
First open "test1" and write next:
Code:
busybox echo "After 5 seconds"
busybox sleep 1
busybox echo "You will get a suprice"
busybox sleep 2
busybox clear
busybox echo "1"
busybox sleep 1
busybox clear
busubox echo "2"
busybox sleep 1
busybox clear
busybox echo "3"
busybox sleep 1
busybox clear
busybox echo "4"
busybox sleep 1
busybox clear
busybox echo "5"
busybox sleep 1
busybox clear
sh /sdcard/print
I think that you already know whats happened here
You have print, then you have sleep to make offset, and after that you have clear command to make window blank
Now open file with the name "print"
Inside it write next:
Code:
busybox echo "Voila, suprise"
Save this file, and open terminal emulator, and write next:
Code:
sh /sdcard/test2
And magic happens
In this example you learned how to execute second file with first, I think that it's not difficult for you
In this example we will play a bit with colors outputs
Codes for colors are below
Code:
busybox echo -e " 1. Black \e[0;100m \e[00;37;40m"
busybox echo -e " 2. Red \e[0;101m \e[00;37;40m"
busybox echo -e " 3. Green \e[0;102m \e[00;37;40m"
busybox echo -e " 4. Yellow \e[0;103m \e[00;37;40m"
busybox echo -e " 5. Blue \e[0;104m \e[00;37;40m"
busybox echo -e " 6. Purple \e[0;105m \e[00;37;40m"
busybox echo -e " 7. Cyan \e[0;106m \e[00;37;40m"
busybox echo -e " 8. White \e[0;107m \e[00;37;40m"
Try to copy this into terminal window and see what will happened or try whing which you learned before with the executing files. Copy whole code to a file and execute it with "sh" command. USE YOUR KNOWLEDGE.
Here you can see all things based on bash script coloring
https://wiki.archlinux.org/index.php/Color_Bash_Prompt
or
http://misc.flogisoft.com/bash/tip_colors_and_formatting
Here you can see all codes and it's nice descirbed.
Now, let's start
Make a file with the name "test3" open it and write or copy next code inside:
Code:
busybox echo " .... "
busybox echo " / / "
busybox echo " / / "
busybox echo " / / "
busybox echo " / /_._._. "
busybox echo -e " /_._._._._./ \e[00;41m SPEED MOD \e[00;37;40m v3.0"
busybox echo "*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
busybox echo -e "\e[01;32m Feel smoothness \e[00;37m"
busybox echo " "
As you can see this part was taken from mine L Speed performance/battery mod
Save the file, open terminal and type inside
Code:
sh /sdcard/test3
And you will get the same screen like in first L Speed menu.
Let's play a bit with this
You see the code
Code:
\e[00;41m SPEED MOD \e[00;37;40m v3.0
Just change one number instead of 41 write 42 and you will get green color, then give a try to other nubers. Every number is another color for example:
Code:
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
# Underline
UBlack='\e[4;30m' # Black
URed='\e[4;31m' # Red
UGreen='\e[4;32m' # Green
UYellow='\e[4;33m' # Yellow
UBlue='\e[4;34m' # Blue
UPurple='\e[4;35m' # Purple
UCyan='\e[4;36m' # Cyan
UWhite='\e[4;37m' # White
# Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White
# High Intensity
IBlack='\e[0;90m' # Black
IRed='\e[0;91m' # Red
IGreen='\e[0;92m' # Green
IYellow='\e[0;93m' # Yellow
IBlue='\e[0;94m' # Blue
IPurple='\e[0;95m' # Purple
ICyan='\e[0;96m' # Cyan
IWhite='\e[0;97m' # White
# Bold High Intensity
BIBlack='\e[1;90m' # Black
BIRed='\e[1;91m' # Red
BIGreen='\e[1;92m' # Green
BIYellow='\e[1;93m' # Yellow
BIBlue='\e[1;94m' # Blue
BIPurple='\e[1;95m' # Purple
BICyan='\e[1;96m' # Cyan
BIWhite='\e[1;97m' # White
# High Intensity backgrounds
On_IBlack='\e[0;100m' # Black
On_IRed='\e[0;101m' # Red
On_IGreen='\e[0;102m' # Green
On_IYellow='\e[0;103m' # Yellow
On_IBlue='\e[0;104m' # Blue
On_IPurple='\e[0;105m' # Purple
On_ICyan='\e[0;106m' # Cyan
On_IWhite='\e[0;107m' # White
On the next phase we will learn how to use variables, in bash scripts this is simple, just add a simple "tag" then what you want to connext wit this tag.
Here is an example:
Code:
file=/sdcard/test4
busybox touch $file
Ok, here is one simple thing, this is same like in touch command explaining, but there is a little difference. We added variable or you can call it shortcut if it's easier for you.
To call variable somewhere in a file you need to use a dollar sign "$" then name of your variable. Let's to next examole with variables.
As we now have file called test4 on our SD, we can go trough.
Code:
file=/sdcard/test4
busybox echo "hey file" > $file
As you can see everything is repeating from previous examples just with variable. This is much easier, and you will save a bit of time.
Now we can see what is inside file Open terminal emulator and type next
Code:
busybox cat /sdcard/test4
And you will get output "hey file"
Simple isn't it?
In this part we will learn how to use if, elif, else It's pretty simple, let's start.
Pattern for this will be:
Code:
if [what]; then
do something
fi
if [what]; then
do something
elif [what if not "if"]
do something
else
what to do else
fi
Ok what we have here?
The first part of code show us simple code which mean if for example something is true then do something and then close if with fi.
Second part of code is a bit "complicated". If somethig is true then do something, then we have elif, in case that if is false then it will do what is under elif. In case that both of them are false, everything what is under else will be executed.
Ok here is an example:
Code:
if [ -e /sdcard/test5 ]; then
busybox echo "hello" > /sdcard/test5
else
busybox touch /sdcard/test5
busybox echo "hello" > /sdcard/test5
fi
Ok, if file test 5 exists add hello to it, else(if not) then create a file and add text hello in it.
Another example with a bit of complications heheh
Code:
if [ -e /sdcard/test5 ]; then
busybox echo "file 5 exists"
elif [ -e /sdcard/test6 ]; then
busybox echo "file 6 exists"
else
busybox echo "files are not exist"
fi
Ok, here is explanation, if test5 exist then print "file 5 exists" going to the next line, if file test6 exist pri t "file 6 exists" and else if both of them doesn't exist print "files are not exist".
Donation:
http://forum.xda-developers.com/donatetome.php?u=5514152
Everyone who knows a bit of the performance/battery mods wants sometime to learn what is inside and how it's working
Here is a guide by @Paget96 (me) ^~^
As we know for every mod we need root, this is needed because we must to access to android shell.
init.d support, that is a folder which launch files from it on every boot. Init.d is included on some ROM's by default, but on some you need yo enable it by default(I will explain later how).
Next thing what you need is for sure busybox. And a little bit of free space on the /system partition.
Everyone knows how to root, I don't need to explain how to do that right?
User who doesn't have init.d will make it with next steps.
1. Flash superSU by @Chainfire (IMPORTANT)
2. In /system/etc/ make a file with the name "install-recovery-2.sh and push next code in it
Code:
#!/system/bin/sh
/system/bin/sysinit
3. Inside system/bin make a file with the name " sysinit" and push next code in it
Code:
#!/system/bin/sh
busybox sleep 30
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
run-parts /system/etc/init.d
4. Open /system/etc and make folder with the name "init.d"
Now you need to set permissions for all of this files.
Open terminal emulator and do next:
Code:
su
This will give root access
Code:
busybox chmod 755 /system/etc/install-recovery-2.sh
busybox chown 0.2000 /system/etc/install-recovery-2.sh
With this you will set "executable" permissions.
And we need permission for sysinit
Code:
busybox chmod 755 /system/bin/sysinit
busybox chown 0.2000 /system/bin/sysinit
And that's it
To install busybox use app "busybox installer" by stericson from playstore.
***IMPORTANT*** Don't change too much things, because you will get crap in your hands
Tools which are needed is
Text editor, I suggest Turbo Editor
Terminal emulator
ES file explorer
Ok, let's start
We will start with virtual memory tweaking...
Open file manager and create one folder where you will build a mod.
Inside it we will create one file for beginning and call it "00sysmod"
Code:
#!/system/bin/sh
busybox chmod 644 /proc/sys/vm/*
busybox sysctl -e -w vm.dirty_background_ratio=3
busybox sysctl -e -w vm.dirty_ratio=15
busybox sysctl -e -w vm.swappiness=40
busybox sysctl -e -w vm.dirty_expire_centisecs=500
busybox sysctl -e -w vm.dirty_writeback_centisecs=3000
busybox sysctl -e -w vm.min_free_kbytes=4096
busybox sysctl -e -w vm.overcommit_memory=1
busybox sysctl -e -w vm.overcommit_ratio=75
busybox sysctl -e -w vm.page-cluster=0
busybox sysctl -e -w vm.panic_on_oom=0
Copy this inside file, save it and copy to init.d folder
After that set permissions to 755
Code:
busybox chmod 755 /system/etc/init.d/00sysmod
Let's explain every line:
First line is a header of every script.
Next line will change permissions (in this case read, write, read, read) of a files which are inside /proc/sys/vm/*. * means every file.
Everything below it are vm parameters.
vm.dirty_background_ratio
Contains, as a percentage of total available memory that contains free pages
and reclaimable pages, the number of pages at which the background kernel
flusher threads will start writing out dirty data.
The total avaiable memory is not equal to total system memory.
dirty_ratio
Contains, as a percentage of total available memory that contains free pages
and reclaimable pages, the number of pages at which a process which is
generating disk writes will itself start writing out dirty data.
The total avaiable memory is not equal to total system memory.
swappiness
This control is used to define how aggressive the kernel will swap
memory pages. Higher values will increase agressiveness, lower values
decrease the amount of swap. A value of 0 instructs the kernel not to
initiate swap until the amount of free and file-backed pages is less
than the high water mark in a zone.
The default value is 60.
dirty_expire_centisecs
This tunable is used to define when dirty data is old enough to be eligible
for writeout by the kernel flusher threads. It is expressed in 100'ths
of a second. Data which has been dirty in-memory for longer than this
interval will be written out next time a flusher thread wakes up.
dirty_writeback_centisecs
The kernel flusher threads will periodically wake up and write `old' data
out to disk. This tunable expresses the interval between those wakeups, in
100'ths of a second.
Setting this to zero disables periodic writeback altogether.
min_free_kbytes
This is used to force the Linux VM to keep a minimum number
of kilobytes free. The VM uses this number to compute a
watermark[WMARK_MIN] value for each lowmem zone in the system.
Each lowmem zone gets a number of reserved free pages based
proportionally on its size.
Some minimal amount of memory is needed to satisfy PF_MEMALLOC
allocations; if you set this to lower than 1024KB, your system will
become subtly broken, and prone to deadlock under high loads.
Setting this too high will OOM your machine instantly.
overcommit_memory
This value contains a flag that enables memory overcommitment.
When this flag is 0, the kernel attempts to estimate the amount
of free memory left when userspace requests more memory.
When this flag is 1, the kernel pretends there is always enough
memory until it actually runs out.
When this flag is 2, the kernel uses a "never overcommit"
policy that attempts to prevent any overcommit of memory.
Note that user_reserve_kbytes affects this policy.
DON'T CHANGE THIS VALUE, YOU WILL GET CRAP IN A HANDS, THIS IS JUST FOR INFO
overcommit_ratio
With this parameter you will set how much space will allocations use in physical RAM. (Percentage)
page-cluster
page-cluster controls the number of pages up to which consecutive pages
are read in from swap in a single attempt. This is the swap counterpart
to page cache readahead.
The mentioned consecutivity is not in terms of virtual/physical addresses,
but consecutive on swap space - that means they were swapped out together.
It is a logarithmic value - setting it to zero means "1 page", setting
it to 1 means "2 pages", setting it to 2 means "4 pages", etc.
Zero disables swap readahead completely.
panic_on_oom
This enables or disables panic on out-of-memory feature.
If this is set to 0, the kernel will kill some rogue process,
called oom_killer. Usually, oom_killer can kill rogue processes and
system will survive.
If this is set to 1, the kernel panics when out-of-memory happens.
If this is set to 2, the kernel panics compulsorily even on the
above-mentioned. Even oom happens under memory cgroup, the whole
system panics
In this part we will tweak kernel parameters
Open file manager as before and create a file with the name " 00kerneltweak"
Here we will use if statement, just for a little practise ^~^
Code:
if [ -e /proc/sys/kernel/shmmni ]; then
busybox echo "2048" > /proc/sys/kernel/shmmni
fi
if [ -e /proc/sys/kernel/shmall ]; then
busybox echo "1572864" > /proc/sys/kernel/shmall
fi
if [ -e /proc/sys/kernel/shmmax ]; then
busybox echo "33554432" > /proc/sys/kernel/shmmax
fi
if [ -e /proc/sys/kernel/msgmni ]; then
busybox echo "512" > /proc/sys/kernel/msgmni
fi
if [ -e /proc/sys/kernel/msgmnb ]; then
busybox echo "16384" > /proc/sys/kernel/msgmnb
fi
if [ -e /proc/sys/kernel/msgmax ]; then
busybox echo "8192" > /proc/sys/kernel/msgmax
fi
Copy this inside file, save it and copy to init.d folder
After that set permissions to 755
Code:
busybox chmod 755 /system/etc/init.d/00kerneltweak
Same as we learned before if file exist then do next
Let's explain this parameters:
shmall
The total amount of shared memory (in pages) which can be allocated on the system
shmmax
The maximum size of a shared memory segment (in pages)
shmmni
The maximum number of shared memory segments available on the system
msgmni
The number of IPC message queue resources allowed (by default, 16).
msgmnb
Defines the maximum size in bytes of a single message queue. The default value is 65536 bytes.
msgmax
The maxim...
Remove Google Play Services data
Code:
#!/system/bin/sh
mount -o remount,rw /data
busybox mount -o remount,rw /data
GSM=/data/data/com.google.android.gms
for i in $GSM
do
busybox rm -rf $i/*
done
make a file, and add this inside, like before
copy to /system/etc/init.d
set permissions to 755
Clear browser data
Code:
#!/system/bin/sh
mount -o remount,rw /data
busybox mount -o remount,rw /data
browser=/data/data/com.android.NAME_OF_THE_BROWSER
for i in $browser
do
busybox rm -rf $i/*
done
make a file, and add this inside, like before
copy to /system/etc/init.d
set permissions to 755
first write a name of the browser, some devices have chrome as a default, then name will be
com.android.chrome
I'm sure that its
com.android.browser for default one
Check that inside /data/data, then just change inside the script
Or you can use this package
Code:
#!/system/bin/sh
while true; do
mount -o remount,rw /data
busybox mount -o remount,rw /data
busybox echo -n "Enter a name of the browser: "
busybox read -r name
brw=/data/data/com.android.$name
if [ -d $brw ]; then
for i in $brw
do
busybox rm -rf $i/*
done
busybox echo "Clearing done"
busybox sleep 2
else
busybox echo "Browser doesn't exist, please type another one..."
busybox sleep 3
fi
done
Well, this for this file guide is different,
Call the file "ccleaner" copy it to /system/bin
Set permissions to 755 like before
Open terminal emulator
Code:
su
ccleaner
Thanks Man
Thanks @Paget96 for your Support Man It will help Many user to Learn From You :fingers-crossed::good:
And Am the First to Comment on your Forum
cheers:laugh:
axays said:
Thanks @Paget96 for your Support Man It will help Many user to Learn From You :fingers-crossed::good:
And Am the First to Comment on your Form [emoji14]
Click to expand...
Click to collapse
I hope so
This thread needs too much stuff here, I cannot finish it in one day
Sent from my Nexus 5 using Tapatalk
Wow Good Job and Good Luck @Paget96 Its willbe Awesome
Paget96 said:
I hope so
This thread needs too much stuff here, I cannot finish it in one day
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
I'm a fan of your L Speed Mod, and this tutorial clears up many things. Subscribing now for updates when you add more stuff here.
Sent from my HTC Desire 616 dual sim using Tapatalk
Evolutionzz said:
Wow Good Job and Good Luck @Paget96 Its willbe Awesome
Click to expand...
Click to collapse
Thank you mate ^~^
MSF Jarvis said:
I'm a fan of your L Speed Mod, and this tutorial clears up many things. Subscribing now for updates when you add more stuff here.
Sent from my HTC Desire 616 dual sim using Tapatalk
Click to expand...
Click to collapse
Heh fans everywhere ^~^ Yeah, but TUT is not finished this is maybe 20% of stuff which are need to be here
Sent from my Nexus 5 using Tapatalk
Guys, more stuff will come tomorrow
Sent from my Nexus 5 using Tapatalk
Paget96 said:
Thank you mate ^~^
Heh fans everywhere ^~^ Yeah, but TUT is not finished this is maybe 20% of stuff which are need to be here
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Just 20%!!!! I'm dying to see the rest....
Paget96 said:
Thank you mate ^~^
Heh fans everywhere ^~^ Yeah, but TUT is not finished this is maybe 20% of stuff which are need to be here
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Sent from my HTC Desire 616 dual sim using Tapatalk
MSF Jarvis said:
Just 20%!!!! I'm dying to see the rest....
Sent from my HTC Desire 616 dual sim using Tapatalk
Click to expand...
Click to collapse
Heheh, there will be whole stuff about scripting which I used for L Speed building
Sent from my Nexus 5 using Tapatalk
For now, I think that it's enough, if you have more request, type below
Also I want to see screenshots of your attempts
Sent from my Nexus 5 using Tapatalk
Hell yeah!! Awesome Guide my bro @Paget96 Fantastic! This what people wanted from a long time. Amazing.
Sent From dark_world through my Android One
dark_optimistic said:
Hell yeah!! Awesome Guide my bro @Paget96 Fantastic! This what people wanted from a long time. Amazing.
Sent From dark_world through my Android One
Click to expand...
Click to collapse
Thank you, this is why I created it
Sent from my Nexus 5 using Tapatalk
Paget96 said:
For now, I think that it's enough, if you have more request, type below
Also I want to see screenshots of your attempts
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
I borked my phone a bit (this is a non - rooted phone ) so I'll post screenshots later when I UN-bork it.
Sent from my HTC Desire 616 dual sim using Tapatalk
MSF Jarvis said:
I borked my phone a bit (this is a non - rooted phone ) so I'll post screenshots later when I UN-bork it.
Sent from my HTC Desire 616 dual sim using Tapatalk
Click to expand...
Click to collapse
What you mean with borked?? hehh
I'm waiting for your screenshots, just to see how users understood stuff ^~^
Sent from my Nexus 5 using Tapatalk
delete
Awesome work as usual :angel:
Black_Eyes said:
Awesome work as usual :angel:
Click to expand...
Click to collapse
Thank you
I just want to share mine experience with the users
And probably to teach someone
Sent from my Nexus 5 using Tapatalk
Paget96 said:
What you mean with borked?? hehh
I'm waiting for your screenshots, just to see how users understood stuff ^~^
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Borked means I changed my recovery and flashed a GB ROM instead of using my friends custom built CM 11 build. My trusty Tahr system also broke down, but I am resilient so I'll manage and you WILL see the screenshots before 5PM IST.[emoji16] [emoji16] [emoji16] [emoji6] [emoji6] [emoji6] [emoji6]
Sent from my HTC Desire 616 dual sim using Tapatalk

Init Script and File Copy

I've added a simple shell script to my Z5 (Stock 5.1.1) as an init service. The scipt is intended to simply copy a file to the sdcard. I can see that my script is run on init, that it verifies the source file exists, but the cp command returns 1. dmesg output shows selinux write denials, but it selinux is in permissive mode.
Manually executing the script works fine, and I know the service is executing. I'm sure I'm missing something obvious, but so far this has eluded me. Any help would be appreciated.
script
Code:
#!/system/bin/sh
if [ -e /system/path/myfile ]
then
log -p i -t MYSTUFF "copy file"
cp /system/path/myfile /sdcard/myfile
log -p i -t MYSTUFF "Returned: ${?}"
fi
service setup
Code:
service my-service /system/path/myscript.sh
class myclass
user root
group root
oneshot
on property:init.svc.usf-post-boot=stopped
class_start myclass

Categories

Resources