[TIP] Running random scripts at boot - One (M8) Q&A, Help & Troubleshooting

HTC One M8.
I have done HTCdev with http://htc-one.wonderhowto.com/how-to/unlock-bootloader-root-your-htc-one-m8-0154444/
then rooted
Then did S-OFF with http://firewater-soff.com/instructions/
Then, to be able to write to /system, you need more steps. From recovery, it works easily. From live running system, the default stock ROM has a write protection. This WP can be removed easily by loading a kernel module:
http://forum.xda-developers.com/showthread.php?t=2701816
then:
Code:
insmod /mnt/sdcard/Download/wp_mod_m8.ko
mount -o remount,rw /system
Now, I want to run random scripts.
First, check if the stock ROM has the same issue as my previous phone:
Code:
[email protected]_m8:/ # echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/vendor/bin
[email protected]_m8:/ # ls -l /system/sbin
/system/sbin: No such file or directory
1|[email protected]_m8:/ #
That's exactly what we need: a folder that is in PATH, that does not exist, and should exist somewhere we can create it. So:
Code:
insmod /mnt/sdcard/Download/wp_mod_m8.ko
mount -o remount,rw /system
mkdir /data/local/bin
ln -s /data/local/bin/ /system/sbin
Then, create two small scripts in there: do vi /system/sbin/vibrate , then i to enter insert mode, paste this code, esc, :x ... or use any other editor if you want:
Code:
#!/system/xbin/ash
#
i="$1"
[ "$i" = "" ] && i=400
# default value for voltage_level at boot is 3100 mV.
v=3100
vmin=1200
[ $i -gt 0 ] 2>/dev/null || {
echo "Invalid argument '$i'; should be a number below 9999 ms."
exit 1
}
[ $i -gt 9999 ] && {
echo "Invalid argument '$i'; should be below 9999 ms."
exit 1
}
[ "$2" != "" ] && {
[ $2 -ge $vmin ] 2>/dev/null || {
echo "Invalid argument '$2'; should be a number between $vmin and ${v} mV."
exit 1
}
[ $2 -gt $v ] && {
echo "Invalid argument '$2'; should be below ${v} mV."
exit 1
}
}
[ "$i" = "" ] && { echo "Provide argument: time in ms." ; exit 1 ; }
[ "$2" = "" ] && {
echo "Voltage not provided. Using default $v mV."
} || {
v=$2
echo "Using voltage argument $v mV."
}
echo $v > /sys/devices/virtual/timed_output/vibrator/voltage_level
echo "$i" > /sys/devices/virtual/timed_output/vibrator/enable
It was an old code for HTC Sensation; voltage does not work anymore, but duration does.
A shorter script for flash, and create the init script:
Code:
echo "echo 255 > /sys/class/leds/flashlight/brightness" > /system/sbin/flashlight
echo "#!/system/bin/sh
# /system/etc/init.qcom.bt.sh
/data/local/bin/vibrate
/system/sbin/flashlight" > /data/local/bin/rc.init
chmod 755 /system/sbin/flashlight
chmod 755 /system/sbin/vibrate
chmod 755 /data/local/bin/rc.init
Now, the tricky part: make the init script run at boot. Edit /system/etc/init.qcom.bt.sh , and below the comment, insert this line:
Code:
/data/local/bin/rc.init &
Reboot, enjoy Your phone flashes and vibrates at boot. As is, this is almost useless. But, now you can create system scripts, and run them at boot ... you can do pretty much anything you do on a classic Linux machine.
Because scripts are put in a folder which is in the default system $PATH, all apps or widgets can run those scripts. This vibrate script can be called for example from a Tasker or ScriptManager widget.
I love vibrate, because it's a small noise; I tail it to any command that is likely to take more than 1mn to run. Having a ScriptManager widget running it also helps me check the system load. If phone seems slow, and vibration does not happen at once, then the phone has big load, and I shall wait for things to settle.
/system/etc/init.qcom.bt.sh was not a random choice. To understand why: open /init.target.rc , and now, search a script that is run ... at boot ... with user root ... and that lays in /system. Many scripts are run as user, or stored outside /system.
Now, it's up to you to create scripts that are usefull to you.

Hey thanks for the directions but I tried running the command mnt/sdcard/download/wp_mod.ko and I got a "failed exec format error"....

rgolnazarian said:
Hey thanks for the directions but I tried running the command mnt/sdcard/download/wp_mod.ko and I got a "failed exec format error"....
Click to expand...
Click to collapse
This is completely unrelated and offtopic. Either your file does not have exec bit, or wrong interpreter, or stored on partition that has noexec.
Hmmm ... why is the quoted message different from the one I received by email ???
Any way, even if you are in /, "mnt/sdcard/download/wp_mod.ko" is an invalid command. A module can not be executed, it must be inserted; see tutos about it.

Related

[TRICK/CWM3/EDIFY] Output to recovery UI from shell script

Took me a few minutes to figure this out, so I thought to share
This is taken from some scripts I use in CF-Root, you might need to change it slightly for other CWM3 kernels (like prefixing busybox to various commands, etc).
updater-script
Assumptions:
- rootfs is mounted as rw, so we can write temporary files anywhere (ram disk)
- you put a "myscript.sh" in the system folder inside the update
All this script does is extract whatever you have in update.zip/system folder to /tmp/update, and run the myscript.sh file.
Code:
ui_print("Extracting files ...");
package_extract_dir("system", "/tmp/update");
set_perm(0, 0, 0755, "/tmp/update/myscript.sh");
run_program("/tmp/update/myscript.sh");
myscript.sh
Assumptions:
- all busybox commands are symlinked in /sbin, this is usually the case for CWM3 kernels
Code:
#!/sbin/busybox sh
# get file descriptor for output
OUTFD=$(ps | grep -v "grep" | grep -o -E "update_binary(.*)" | cut -d " " -f 3);
# same as progress command in updater-script, for example:
#
# progress 0.25 10
#
# will update the next 25% of the progress bar over a period of 10 seconds
progress() {
if [ $OUTFD != "" ]; then
echo "progress ${1} ${2} " 1>&$OUTFD;
fi;
}
# same as set_progress command in updater-script, for example:
#
# set_progress 0.25
#
# sets progress bar to 25%
set_progress() {
if [ $OUTFD != "" ]; then
echo "set_progress ${1} " 1>&$OUTFD;
fi;
}
# same as ui_print command in updater_script, for example:
#
# ui_print "hello world!"
#
# will output "hello world!" to recovery, while
#
# ui_print
#
# outputs an empty line
ui_print() {
if [ $OUTFD != "" ]; then
echo "ui_print ${1} " 1>&$OUTFD;
echo "ui_print " 1>&$OUTFD;
else
echo "${1}";
fi;
}
# --- example usage ---
# empty line after "Extracting ..." from updater-script
ui_print;
# give the user some status
ui_print "doing something (1 of 4)";
# assume this won't take more than 30 seconds
progress 0.25 30;
# you'd do something useful here
sleep 15s;
# update status
ui_print "- done with something (1 of 4)";
# we're done, make sure the progress bar is at 25%
set_progress 0.25;
# empty line
ui_print;
# repeat this a few times ;)
ui_print "doing something (2 of 4)";
progress 0.25 30;
sleep 15s;
ui_print "- done with something (2 of 4)";
set_progress 0.50;
ui_print;
ui_print "doing something (3 of 4)";
progress 0.25 30;
sleep 15s;
ui_print "- done with something (3 of 4)";
set_progress 0.75;
ui_print;
ui_print "doing something (4 of 4)";
progress 0.25 30;
sleep 15s;
ui_print "- done with something (4 of 4)";
set_progress 1.00;
ui_print;
# done !
ui_print "done! rebooting!";
How, what, why ?
While updater-script is fine for a lot of things, like installing a new ROM and whatnot, anything sufficiently complicated still has to be done through shell scripts, because a great many things just cannot be easily done in edify. It's nice to be able to give the user some status when doing these operations. There are modded versions of CWM that make the same thing possible in other ways, like simply writing to STDOUT or STDERR. This requires either a custom update_binary or recovery binary, though.
This works because communication between recovery and update_binary is through a file descriptor (pipe). Recovery runs update_binary with the FD as command line parameter. Because the shell script is run as a child process of update_binary, it can write the same commands to that FD (commands recovery listens for), because child processes inherited FD numbers and access rights.
So, all the script has to do is figure out which FD to write to, and pass it the right commands. Finding the FD isn't difficult, as it is passed on the command line and so is listed in the output of ps. Some grep and cut magic retrieve it. See the OUTFD=$(...) line. The right commands are defined in the functions at the top.
Note: this is all taken from my rfs<=>ext4 conversion script for CF-Root/ext4. Slightly adjusted, hopefully it still works as expected
Enjoy!
Thank you chainfire
Sent from my GT-I9000 using Tapatalk
Thanks for this chainfire.
Precisely what I was looking for! You're my hero today, man!
Hi Chainfire
Thanks for your tricks, I'm using it for an almost bulletproof MTD flash script.
BTW, i'd like to call some set_perm commands. But set_perm isn't a recognized command for update-binary.
IDK if I'm clear.
Do you have some advise on that?
RolluS said:
BTW, i'd like to call some set_perm commands. But set_perm isn't a recognized command for update-binary.
Click to expand...
Click to collapse
I've sort this writing equivalent functions:
Code:
set_perm() { # same as set_perm command in updater-script, for example:
#
# set_perm 0 3003 02750 "/system/bin/netcfg"
#
# sets user:group to 0:3003 and perm to 02750 for the file /system/bin/netcfg
$CHOWN $1:$2 $4
$CHMOD $3 $4
}
set_perm_recursive() { # same as set_perm command in updater-script, for example:
#
# set_perm_recursive 0 2000 0755 0755 "/system/bin"
#
# sets uid:gid to 0:2000 and perm to 0755 for folders and 0755 for files recursively in /system/bin
$CHOWN -R $1:$2 $5
$CHMOD $3 $5
#chmod recursive of folder
$FIND $5/* -type d |while read folder; do
$CHMOD $3 $folder
done
#chmod recursive of files
$FIND $5/* -type f |while read file; do
$CHMOD $4 $file
done
}
There is no error handling (yet), so be carrefull when calling these functions
no FD, no output
Chainfire said:
This works because communication between recovery and update_binary is through a file descriptor (pipe). Recovery runs update_binary with the FD as command line parameter. Because the shell script is run as a child process of update_binary, it can write the same commands to that FD (commands recovery listens for), because child processes inherited FD numbers and access rights.
So, all the script has to do is figure out which FD to write to, and pass it the right commands. Finding the FD isn't difficult, as it is passed on the command line and so is listed in the output of ps. Some grep and cut magic retrieve it. See the OUTFD=$(...) line.
Click to expand...
Click to collapse
finding the FD is difficult on an SGY phone under MT 2.0 kernel, because is is not passed as command line param and therefore not in the ps output.
can anyone give an example of a working FD ?
the expression returns "" on my SGY, and no output is readable from script.
above zip as one file with the (.*) business removed from FD expression in myscript.sh
I don't see that ps gives me a "FD" in its output. whatever that really is. /tmp/recovery.log says that /sbin/recovery has no command line params either on SGY
from recov.log:
I:Set boot command "boot-recovery"
Command: "/sbin/recovery"
there is no FD in the command line ! where is it then ?
I'll test this in a bit. Nice hack b/w.
any news?
Thanks for this trick. What I wanted to do is to redirect stdout (and stderr) of my script to the UI. I know that you can see this in "show logs", but I wanted it to display right during the installation. Here is what I came up with:
Code:
#!/sbin/busybox ash
OUTFD=$(ps | grep -v "grep" | grep -o -E "update_binary(.*)" | cut -d " " -f 3);
/sbin/busybox ash $* 2>&1 |
while read -r line
do
echo "ui_print $line" >&$OUTFD;
echo "ui_print " >&$OUTFD;
done
If you save this as "scripts/stdoutwrapper.sh", you can do something like this:
Code:
package_extract_dir("scripts", "/tmp/update");
set_perm(0, 0, 0755, "/tmp/update/stdoutwrapper.sh");
run_program("/tmp/update/stdoutwrapper.sh", "/tmp/update/myscript.sh", "param1", "param2");
In myscript.sh, use any shell commands. The output will be redirected to the UI. Therefore, you should be able to write scripts that work both on the command line and in recovery without changes.
Please note: As all output will be printed, the tricks with set_progress etc. don't work. It would probably be possible to use a prefix to identify commands that should be executed, not printed, so you could do e.g. "echo '<#>set_progress 0.25'".
what value does OUTFD have? find out like below:
adb shell
ps
then /sbin/recovery might have PID 2166 on SGY phone
su
ls -l --color=never /proc/2166/fd
may give you e.g.
3 -> /dev/tty0
so 3 is your OUTFD !
now grep it accordingly for the script. use MT kernel 2.0 on SGY for above capability
time saver
edify Scripts may be tested by executing update-binary directly:
update-binary version output package
An example would be:
update-binary 2 stdout /sdcard/update.zip
Just noticed Chainfire's ui_print shell script in the latest SuperSU zip, and that lead me here.
Here are some updated versions (for CWM6?); ui_print and set_perm from SuperSU and the other 2 from my tinkering today:
Code:
OUTFD=$2;
ZIP=$3
ui_print() {
echo -ne "ui_print $1\n" > /proc/self/fd/$OUTFD;
echo -ne "ui_print\n" > /proc/self/fd/$OUTFD;
}
set_perm() {
chown $1.$2 $4
chown $1:$2 $4
chmod $3 $4
}
show_progress() { echo "progress $1 $2" > /proc/self/fd/$OUTFD; }
set_progress() { echo "set_progress $1" > /proc/self/fd/$OUTFD; }
ex:
show_progress 1.34 0;
ui_print "Hello world!";
set_progress 0.5;
ui_print " "; #blank line
set_progress 1.34;
ui_print "Done!";
Also worth noting he just uses busybox unzip to extract files from the flashable zip directly and goes from there.
ex:
ui_print "Extracting files!"
cd /tmp
unzip -o "$ZIP"
mai77 said:
what value does OUTFD have?
Click to expand...
Click to collapse
I put ui_print "Test: $OUTFD" in a script and the value of OUTFD appears to increase with every zip flashed.
Not much use knowing it in that case.
Nice work, I used this in my little zip. However, it doesn't work with TWRP. Is there any way to accomplish that?
sorry to put this here but could anyone direct me towards the cwm or TWRP version for "jxjpb" (asia) baseband pls?
klenamenis said:
Nice work, I used this in my little zip. However, it doesn't work with TWRP. Is there any way to accomplish that?
Click to expand...
Click to collapse
TWRP names the extracted update-binary "updater", so you can add something like this (or modify the regex in the existing line):
Code:
[ $OUTFD != "" ] || OUTFD=$(ps | grep -v "grep" | grep -o -E "updater(.*)" | cut -d " " -f 3)
_that said:
TWRP names the extracted update-binary "updater", so you can add something like this (or modify the regex in the existing line):
Code:
[ $OUTFD != "" ] || OUTFD=$(ps | grep -v "grep" | grep -o -E "updater(.*)" | cut -d " " -f 3)
Click to expand...
Click to collapse
Shouldn't be necessary with any reasonably current recovery. That was just a hack Chainfire wrote to get the FD back in the CWM3 days.
All that should be required (and has always worked for me) is to make the update-binary your shell script, then:
Code:
OUTFD=$2;
See my other updated commands above. And some zips I've made which should provide good references for people: Nexus Louder, Xposed Framework Installer, and Nexus BootUnlocker. All available in my Odds and Ends thread, linked in my sig.
osm0sis said:
Shouldn't be necessary with any reasonably current recovery. That was just a hack Chainfire wrote to get the FD back in the CWM3 days.
All that should be required (and has always worked for me) is to make the update-binary your shell script, then:
Code:
OUTFD=$2;
Click to expand...
Click to collapse
Yes, that works if you replace the whole update-binary with a shell script, but this method is for scripts that are called from the updater-script when using a binary updater.
I've recently switched to a shell script as updater too, but I had to write my own zip signing program because busybox unzip was unable to extract files from a zip signed by SignApk.
osm0sis said:
See my other updated commands above. And some zips I've made which should provide good references for people: Nexus Louder, Xposed Framework Installer, and Nexus BootUnlocker. All available in my Odds and Ends thread, linked in my sig.
Click to expand...
Click to collapse
Wow, nice collection! I remember some other posts from you that were very helpful, thanks!
_that said:
Yes, that works if you replace the whole update-binary with a shell script, but this method is for scripts that are called from the updater-script when using a binary updater.
I've recently switched to a shell script as updater too, but I had to write my own zip signing program because busybox unzip was unable to extract files from a zip signed by SignApk.
Wow, nice collection! I remember some other posts from you that were very helpful, thanks!
Click to expand...
Click to collapse
Nice! My misunderstanding then.
And ah yes, the old "1 and 8" issue with unzip. Might be resolved in the latest busybox 1.22.1 but I'm not 100% about that, and it'll be awhile before that makes it into recoveries.
I'd love to get hold of your zip signer if that'd be okay. I have Chainfire's solution, but I was still running into some verification problems (I think) from the MinSignApk whole file resigning.
osm0sis said:
And ah yes, the old "1 and 8" issue with unzip. Might be resolved in the latest busybox 1.22.1 but I'm not 100% about that, and it'll be awhile before it makes it into recoveries.
Click to expand...
Click to collapse
Exactly! I learned a lot about the zip format while researching this.
osm0sis said:
I'd love to get hold of your zip signer if that'd be okay. I have Chainfire's solution, but I was still running into some verification problems (I think) from the MinSignApk whole file resigning.
Click to expand...
Click to collapse
Argh! I saw your original question in that thread but I never found the solution because there were so many pages in between...
I ended up with a hack that appears to resemble Chainfire's minsignapk, but I didn't need to write my own zipadjust. Basically I simply sign the zip normally with signapk, then I unpack and repack the whole archive using 7zip (bonus: slightly better compression), and then I run the whole-zip-signer on the archive.
Here is my SignWholeFile.jar - the source code is just too ugly to publish. View attachment SignWholeFile.jar If you find that it works better than Chainfire's version, I'll clean the source and release it.
This is the script I use for signing:
Code:
#!/bin/sh
KEYDIR=~/android/aosp/build/target/product/security
SIGNAPK=~/android/aosp/prebuilts/sdk/tools/lib/signapk.jar
SIGNWHOLEFILE=~/android/src/signapk/SignWholeFile.jar
java -jar $SIGNAPK -w $KEYDIR/testkey.x509.pem $KEYDIR/testkey.pk8 "$1" "$1.signed.zip"
mv "$1" "$1.unsigned"
signedzip=$(readlink -f "$1.signed.zip")
[ -d /tmp/signapk2 ] && rm -rf /tmp/signapk2
mkdir /tmp/signapk2
pushd /tmp/signapk2
unzip $signedzip
rm $signedzip
7z a -r -mx=9 $signedzip *
#7z a -r $signedzip *
popd
mv "$1.signed.zip" "$1"
java -jar $SIGNWHOLEFILE $KEYDIR/testkey.x509.pem $KEYDIR/testkey.pk8 "$1" "$1"

[SOLVED] Shell scripting problem: unexpected "fi"

SOLVED: The file had Windows EOL formatting. *nix no likely that.
In the init script there are several instances of if statements like this:
Code:
testvar=1
if [ "$testvar" = "1" ] ; then
echo "Testvar is equal to one"
fi
Yet, when I put if statements exactly like this into a shell script and execute them in an adb shell (or connectbox shell), I get the following error:
line 4: syntax error: unexpected "fi" (expecting "then")
I've also taken if statements directly from init and they throw the same error.
Any busybox gurus here know what's up with this?
toadlife said:
In the init script there are several instances of if statements like this:
Code:
testvar=1
if [ "$testvar" = "1" ] ; then
echo "Testvar is equal to one"
fi
Yet, when I put if statements exactly like this into a shell script and execute them in an adb shell (or connectbox shell), I get the following error:
line 4: syntax error: unexpected "fi" (expecting "then")
I've also taken if statements directly from init and they throw the same error.
Any busybox gurus here know what's up with this?
Click to expand...
Click to collapse
Remove the ; and enter the then
Code:
testvar=1
if [ "$testvar" = "1" ]
then
echo "Testvar is equal to one"
fi
Nope. Still throws the same error.
This is driving me nuts. What I'm doing is editing the /init script. The loops work just fine when executed at bootup in / init, but remounting the filesystem, editing /init and rebooting just the test a change takes forever.
For now I've got my changes to init working, but it would be nice to be able to test before editing /init
I just realized that I forgot to put `#!/bin/sh` at the top of my script. But doing so doesn't seem to help. Instead I get not found error.
Weird!
toadlife said:
Nope. Still throws the same error.
This is driving me nuts. What I'm doing is editing the /init script. The loops work just fine when executed at bootup in / init, but remounting the filesystem, editing /init and rebooting just the test a change takes forever.
For now I've got my changes to init working, but it would be nice to be able to test before editing /init
Click to expand...
Click to collapse
Code:
testvar=1
if [ $testvar = `1` ] (`=~ key)
then
echo "Testvar is equal to one"
fi
[/QUOTE]
It gives the echo, but also 1: not found.
Here is the actual code I put into my init:
(this works)
Code:
#Super cool battery thingy
RUNSCBS=`/bin/grep -o "run.scbs=.*" /proc/cmdline | /bin/sed -e "s/.*run.scbs=//g" -e "s/ .*//g"`
if [ "$RUNSCBS" = "1" ] ; then
dev=$(cat /sys/class/scbs/0/dev | sed -e "s/:/ /g")
mknod /dev/scbs0 c $dev
scbs -d -co /sdcard/scbs.conf
fi
# Debug logs
TAKELOGS=`/bin/grep -o "take.logs=.*" /proc/cmdline | /bin/sed -e "s/.*take.logs=//g" -e "s/ .*//g"`
if [ "$TAKELOGS" = "1" ] ; then
logfiledate=`expr substr \`date -Iseconds|tr -d :|tr -d \+|tr -d \-|tr -d T\` 1 14`
tar -cz -f "$card"/debuglogs_"$logfiledate".tar.gz "$card"/debuglogs_*.txt
cat /proc/kmsg>"$card"/debuglogs_kmsg_"$logfiledate".txt &
logcat -v time >"$card"/debuglogs_logcat_time_"$logfiledate".txt &
logcat -v time -b radio>"$card"/debuglogs_logcat_time_radio_"$logfiledate".txt &
fi
Ooooo I really like the idea of having logging running from init. Does that work well? Do the logs ever 'loop' and you end up missing things, or do they just keep on churnin?
arrrghhh said:
Ooooo I really like the idea of having logging running from init. Does that work well? Do the logs ever 'loop' and you end up missing things, or do they just keep on churnin?
Click to expand...
Click to collapse
AFAIK, they go forever. I started doing it last night by just putting the static command in the /init and the logging was still going when I got up this morning.
This morning wanted to see if I could make logging and scbs triggerable by an option in the command line.
Both are working for me now.
Know if where talking about scripts, i have a question too.
This is my RIL logs script:
Code:
#! /system/bin/sh
i="0"
while [ $i -lt 2 ]
do
date=`date +%Y%m%d%H%M`
if [ -d /sdcard/logs/ril/$date/ ]
then
echo "/sdcard/logs/ril/$date/ exists!"
else
mkdir /sdcard/logs/ril/$date/
echo " Made direction /sdcard/logs/ril/$date!"
fi
logcat -v time > /sdcard/logs/ril/$date/logcat-time.txt &
logcat -v time -b radio > /sdcard/logs/ril/$date/logcat-time.txt &
sleep 18000 && kill -0 $! && kill $!
cd /sdcard/logs/ril/
tar -czf ril$date.tar.gz $date
rm -r $date
cd /
done
The thing, i believe, is that only the logcat -v time -b radio is killed and when it's sleeping it's not doing that in the background.
Sleeping for 18000 seconds (5h), because if it's running for a day the logcat log will be more than 10 mb or so.
lol.
Your date string...
Code:
date +%Y%m%d%H%M
...is a bit simpler than mine...
Code:
expr substr `date -Iseconds|tr -d :|tr -d \+|tr -d \-|tr -d T` 1 14
(I couldn't figure out the `date` syntax)
Christiaan91 said:
Know if where talking about scripts, i have a question too.
This is my RIL logs script:
Code:
#! /system/bin/sh
i="0"
while [ $i -lt 2 ]
do
date=`date +%Y%m%d%H%M`
if [ -d /sdcard/logs/ril/$date/ ]
then
echo "/sdcard/logs/ril/$date/ exists!"
else
mkdir /sdcard/logs/ril/$date/
echo " Made direction /sdcard/logs/ril/$date!"
fi
logcat -v time > /sdcard/logs/ril/$date/logcat-time.txt &
logcat -v time -b radio > /sdcard/logs/ril/$date/logcat-time.txt &
sleep 18000 && kill -0 $! && kill $!
cd /sdcard/logs/ril/
tar -czf ril$date.tar.gz $date
rm -r $date
cd /
done
The thing, i believe, is that only the logcat -v time -b radio is killed and when it's sleeping it's not doing that in the background.
Sleeping for 18000 seconds (5h), because if it's running for a day the logcat log will be more than 10 mb or so.
Click to expand...
Click to collapse
Hmm. I haven't set up gscript myself yet, but you might need to nohup the logcats to get them to stay once gscript shuts down.
arrrghhh said:
Ooooo I really like the idea of having logging running from init. Does that work well? Do the logs ever 'loop' and you end up missing things, or do they just keep on churnin?
Click to expand...
Click to collapse
I have found one issue. It's seems that whenever scbs runs, locat fails to open the log devices. I just disabled scbs and logcat worked. I'm going to try swapping the code around so scbs runs after the logging starts.
It seems scbs blows up logcat, even when it is triggered after logging starts. Ughhh.
Entropy512 said:
Hmm. I haven't set up gscript myself yet, but you might need to nohup the logcats to get them to stay once gscript shuts down.
Click to expand...
Click to collapse
logcat will be going, even when you close the terminal, but when you deleted the files they stop. So that's not a problem, cuz i won't delete.
BTW: is it possible to silently run scripts? Like this one?
./pathtoscript1 & ./pathtoscript2 & ./pathtoscript3
Christiaan91 said:
logcat will be going, even when you close the terminal, but when you deleted the files they stop. So that's not a problem, cuz i won't delete.
BTW: is it possible to silently run scripts? Like this one?
./pathtoscript1 & ./pathtoscript2 & ./pathtoscript3
Click to expand...
Click to collapse
What do you mean "silently run" - do you mean disable any printing to stdout?
./pathtoscript1 &>/dev/null & ; ./pathtoscript2 &>/dev/null &
should do the trick The &>/dev/null routes all output to /dev/null
Man, you guys go way overboard on this stuff. This is my gscript logging script.
Code:
cd /sdcard
mv logg.txt logg.0.txt
mv logr.txt logr.0.txt
nohup logcat -v time > logg.txt &
nohup logcat -v time -b radio > logr.txt &
nohup klogd > klog.txt
highlandsun said:
Man, you guys go way overboard on this stuff. This is my gscript logging script.
Code:
cd /sdcard
mv logg.txt logg.0.txt
mv logr.txt logr.0.txt
nohup logcat -v time > logg.txt &
nohup logcat -v time -b radio > logr.txt &
nohup klogd > klog.txt
Click to expand...
Click to collapse
Yeah, well we don't all have kung-fu coding ablities like you, so we go overboard with what we can overboard with.
Besides, I think it might be beneficial to put something like the code I wrote into the official init, so noobs can more easily provide debug logs.
One thing to keep in mind, busybox = /bin/sh, statically compiled sh is /system/bin/sh. I got tired of not having arrow key support whenever I su'ed (since /bin/su spawns a root /system/bin/sh regardless of what's in /etc/passwd) so I bind mounted /bin/sh (which is a symlink to busybox) over the one in /system in my user.conf. I haven't come across any ill effect, but if you feel that the shell difference may be causing issues, you could try that route, since it's very easy to undo.
-- Starfox
Starfox said:
One thing to keep in mind, busybox = /bin/sh, statically compiled sh is /system/bin/sh. I got tired of not having arrow key support whenever I su'ed (since /bin/su spawns a root /system/bin/sh regardless of what's in /etc/passwd) so I bind mounted /bin/sh (which is a symlink to busybox) over the one in /system in my user.conf. I haven't come across any ill effect, but if you feel that the shell difference may be causing issues, you could try that route, since it's very easy to undo.
-- Starfox
Click to expand...
Click to collapse
Thanks for the tip. I'll give that a shot.
LOL. I'm an idiot
Figured out what the problem was. The file had Windows EOL formatting.
That's what I get for using Windows to edit shell scripts.

[24 MAY] Dorimanx-ROM-HIGH-END 3.1.9 N277 ODEX NO-HOME-REFRESH+ZRAM+SKIN+TWEAKS+CRON

Welcome to
{
"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"
}
This ROM is based on latest nightly of CM7 with my kernel and my tablet tweaks added to create the probably smoothest and fastest ROM your HD2 ever had.
​
It´s available for MAGLDR and CLK Boot loader.​
Mirrors are ready for you to get my ROM and test it.
For all new users please read all info + change log before asking thanks.​
Critical thing that you need to know.
This ROM works with SWAP / NO SWAP
FOR SWAP CREATION SEE PAGE 2
DON'T WANT SWAP!?, INSTALL REVERT TO LIGHT!
[ This ROM based on DORIMANX 1.62Ghz OC KERNEL AND LATEST NIGHTLY CM7 + My TWEAKS ]
LINKS TO KERNELS AND BIG THANKS TO:TYTUNG, HIEROS, MARC1706, AmeriCanAndroid
My kernel GIT
Kernel Made by ME in Mirrors! see below for thread link.
LINK to GPS LIBS by Tytung And BIG Thanks once more!
Link To GPS-LIBS​
If you like this ROM and want to help me, rate this page with 5 STARS and give me a THANKS!​
​
GPS LIBS 2.1 NMEA with AGPS Support 5 to 20 second to GPS lock -> Link
Added GPS Status app to test GPS,BIG Thanks to Tytung
Camera that make picks with 100% Jpeg quality + Video on "HD" 800x480 6Mbit/s in MPEG4 format! smooth with no delays. 30MB/minute Found It HERE Thanks LeJay!
Added MIUI Camera v17 Fixed2, for all. (Thanks to MongooseHelix)
Latest nightly created for BRAVO phone. (Masked as HD2)
DATA Connection is above 2.5Mbits download! and Radio Auto switch 3G or H according to signal or Idle DATA to save Power!
TABLET TWEAKS, With big help from Lit
Cool Skin with ICS 4.0 transition and lot's of nice icons, created by UOT kitchen
Battery % advance by 1% not by 5% also shows % on charger connected
Added CRONTAB ability as ADD-ON this will make ROM free of dead file cache and RAM / SWAP cache on different time, Read Page 3 for info.
Lots of scripts that do kernel tweaking, partition remounting, CPU down-volting, cache rearrange, send marked downloads to RAM-DRIVE and more
ROM Support Apps2SD! NO NEED To install external scripts!!! all apps will be installed to EXT partition by default, if no EXT exist then to NAND drive!
ROM now supports DATA To EXT, this mod will move all app data to EXT and speed access to them by 3 times!
With DATA to EXT quadrant score is 2800+ on light rom, 2600+ on heavy loaded rom.
ROM has media / video decoder/ encoder drivers that allow loud sound from speaker and smooth video record and play back
ROM has 2 modes, with swap and without it. (HIGH END / LIGHT) (read more below)
Added HACKED DPI check Market , now you can download and install any app, by using any density resolution!
Default CM7 FM Radio
Ads block in HOSTS file, more than 23500 ads blocked
Full root with new superuser 3.X already updated to latest SU
Preinstalled Busybox 1.19.4 ,configured and ready
CLK Ril_Wrapper 4 installed to fix the connection problem
Added GTALK 1.3 with voice / video support
Added latest Google Apps limited pack, only needed apps
DATA / WIFI / GPS / AUTO DIM LIGHTS and blink lights Fixed LIB!
Working WIFI Tethering app > Barnacle Wifi Tether (Found by Rudyfastcat )
MMS blurry pics fix for T-Mobile US users by Tytung! > HERE
Dorimanx-Kernel made by me (kernel thread)
ZRAM support (compcache)
Aroma Installer Menu, that will guide you on installation!
Click to expand...
Click to collapse
If you are here and want this ROM then you have already CLK / MAG partition installed and ready.
If not please check how too in any different ROM long guide for starters,
This is the most advanced ROM for now.​
Decide which version you want :
With SwapHigh-End-Version
-you will need an auto task-killer since the Internal Auto killer is DISABLED!!!
-Recommended are System Tuner Pro + Advanced Task Killer
-to make it High-End create a SD-ext as usual + create a swap partition of 256MB and flash my ROM​
Without Swap Lite-Version
-Home-Refreshes will be present (but not always!)
-to make your ROM a lite version choose it in install menu!​
Flash the CWM partition layout from Mirrors,
Do a backup of SD card,format it and create a SDext and swap(256Mb)
Flash “Dorimanx-Rom-X.X.X-Nightly-XXX-All-in-One !!
Everything will be done by my scripts and ROM
Boot and restore all your stuff and customize it to your personal wishes.
Make a backup via recovery after all to have a backup if you do something bad later.
Click to expand...
Click to collapse
Enjoy!!
---> This ROM is in constant grow, and Bug find and repair, so if you don't like to flash updates often! then use an other ROM <---
Things to know about ROM
On each boot, you will see Ember Lights blink 3 times and switch to Green!
This is how you know that ROM is loading OK, and there is no boot loop,
When Rom will be almost fully loaded the Green Light will blink 3 times and switch off.
My advice not to unlock phone till you see the GREEN light blink then wait 5 seconds and unlock, this way Home app will load fast and no delays.
When Light blink 3 times green it's tell you that CPU is released and ready for more jobs!
If you see the Ember light again and again and no animation then ROM in Boot loop. (95% will not happen ) I test my ROM many times before upload.
How to update (ROM already installed but not latest version):
Clear cache.
Clear Dalvik cache (not necessary if you don´t have problems dont do it!)
Download and flash new release like usual
REBOOT.
When booted, wait till CPU will be free, 3 green blinks!
REBOOT!!!
No permission fix needed, but if some FC on some apps, do it! and clear there data! should fix all problems.
Be Happy
This is all the GUIDE you need.
Have fun!
Here is new mirror provided by Willflint
Here is my mirror provided by looki75
Here is my mirror provided by Netson99
Here is my mirror provided by Guinhill
MIRROR 4
PERSONAL REQUEST!
If MAIN Mirror is SLOW please use the BACKUPS!
Also if you find this ROM and my help worth 5 STARS then rate this page with 5 STARS!​
​Here i will post names of people that helped me with development testing and donated to get me going
All people that DONATED or helping me with this project are considered true members of my team!
Willflint, Looki75, Netson99 and Guinhill = Huge donation!!! The Mirror sites! all credits and respect to them!
Krook6023=Main Page modification!!! He is the creator of LOGOS and rearrangements! HUGE DONATION!
Tytung,Marc1706, AmeriCanAndroid,Fhasovic=For Help with KERNEL! and GPS Libs!
Louie317=HUGE Donation! 100$,Honored member!
Jonas2295=HUGE Donation! one more HD2 that he partially donated to me for help in development! 2 is better then one + Main Page Text modding!
Nixda99 & Amarullz =HUGE Donation to this ROM! The AROMA Installer boot menu. (Developed by Amarullz and tuned for ROM by Nixda99 and Me)
Tiger22=Donation X5,Support,active help,Veteran and Honored member!
Denny02ng=Donation X5,Support,respected Veteran and honored member!
Belzebuth=Donation X4,Support,active help,respected Veteran and Honored member!
Bologna=Donation X4,Support,active help,respected Veteran and Honored member!
Hinnne=Donation X3,CLK Kernel Testing,support,active help,respected veteran member!
Howell=Promotion of our ROM on French Android HD2 Portal with high success!,Honored Member!
Ccbm3=HUGE Support!,For creating the ROM Review and upload to YouTube! Great JOB!
Pirlano=Honored Member!, for helping me find the way to move DATA to EXT! and make our ROM super Fast!
Rudyfastcat=active help,feedback,support,respected veteran member!
Feanor91= active feedback and support,respected veteran member!
Visentinel=active help,feedback,support,respected veteran member!
Lit=Big Help with Tablet Tweaks,support,active help,And Promotion of our ROM in Russian Forum!
Themadproducer= Donations + active feedback and support,respected veteran member!
Gerardroid =Donation X2 + active help,feedback,support,respected veteran member!
Allcomb =BIG $$ Donation + active help,feedback,support,
Miguelidanez=Donation X2,Support,respected veteran member!
MystaMagoo =Donation X2,Support,active help,respected veteran member!
Barjel=Donation X2,active feedback,support,
Dmunseyautotech=Donation X2,Support,
Tmotard X2=Donation,Support,great support.
Tageeboy =Donation + active help,feedback,support,
kantjer=Donation,support,
Gho57=Donation,support,
SkooterD=Donation,Support,active help,
Guinhill=Donation,Support,
Justaguyh=Donation,Support,
Blek42=Donation,Support,
GigahurtzUK=Donation,Support,
Rebel01st=Donation,Support,
Joescian=Donation,Support,active help,
Gubi99=Donation,Support,
Dirtytwo=Donation,Support,
A3r0n1=Donation,Support,
AzureD=Donation,Support,
Sajin1=Donation,Support,
Michie=Donation,Support,
Htc-android=Donation,Support,
Traukoman=Donation,Support,
Marzinho=Donation,Support,
Faka tm*Sap*=Donation,Support,
M4a1a2=Donation,Support,
WillieStylez=Donation,Support,[FONT=&quot]
[/FONT]Vicente=Donation,Support,[FONT=&quot]
[/FONT]Marc New***=Donation,Support,[FONT=&quot]
[/FONT]Ic3fox=Donation,Support,[FONT=&quot]
[/FONT]Patrick O'k***=Donation,Support,
D1wepn=Donation,Support,
Screemi=Donation,Support,
KRAZzysoldier=Donation,Support,
Mappazza=Donation,Support,
Pedmond=active feedback and support,
Ccristal=active help,feedback,support
THANKS TO YOU ALL!
You want to be in my list?
-Then help people to use my ROM.
-Give feedback on bugs or suggestions
-Provide Mirror
-DONATE!
And Be respected!
Hey I got something nice for you in time that you download.
Watch my best friend rock band play!
And my ROM out of BOX review! made by Ccbm3
​ If you Donated and I didn't added you to the list,
First I am sorry for that,
Please PM me, I will add ASAP
​24/5/12 Time 14:30
New ROM 3.1.9 Nightly 277 from last offline source! + Kernel 7.1A
Change Log HERE
02/5/12 Time 02:47AM
New ROM 3.1.7 Nightly 276 from last offline source! + Kernel 6.7
Change Log HERE
14/4/12 Time 23:58
New ROM 3.1.6 Nightly 275 from last offline source! + Kernel 6.5B (ROM DELETED)
Change Log HERE
Fixed ROM 3.1.6.1 + kernel 6.5C (ROM DELETED)
Change Log HERE
Fixed ROM 3.1.6.2 + kernel 6.5D
Change Log HERE
30/3/12 Time 22:24
New ROM 3.1.5.1 Nightly 274 from last offline source! + Kernel 6.3
*fixed root and updated to last 6.3 kernel update.
24/3/12 Time 4:10AM
New ROM 3.1.4 Nightly 273 from last offline source! + Kernel 6.1
Change Log HERE
ROM 3.1.3 was not added here, i was too busy.
05/3/12 Time 1:35
New ROM 3.1.2 Nightly 271 from last source + Kernel 5.4
Change Log HERE
21/2/12 Time 1:00
New ROM 3.1.1 Nightly 270 from source + Kernel 5.3
Change Log HERE
21/2/12 Time 1:00
New ROM 3.1.0 Nightly 269 from source + Kernel 4.7
Change Log HERE
Change log trimmed dates!
New ROM 3.0.9 Nightly 268 from source + Kernel 4.7
Change Log HERE
New ROM 3.0.8 Nightly 267 from source + Kernel 4.0
Change Log HERE
New ROM 3.0.6 Nightly 265 from source + Kernel 3.6
Change Log HERE
New ROM 3.0.5 Nightly 264 from source + Kernel 3.3
Change Log HERE
New ROM 3.0.3 + Kernel 3.2
Change Log HERE
New ROM 3.0.1 + Kernel 3.0
Change log HERE
New ROM 3.0.0 + Kernel 2.9
Change Log HERE
New ROM 2.9.9 + Kernel 2.7
Change Log HERE
New ROM 2.9.8 + Kernel 2.5
Change Log HERE
New ROM 2.9.7 + kernel 2.3
Change Log HERE
New ROM all in one 2.9.5
Change Log HERE
New ROM 2.9.4 Nightly 245
Change Log HERE
New ROM 2.9.3 Nightly 242
Change Log HERE
New ROM 2.9.0 Nightly 231!
Change Log HERE
New ROM 2.8.9 based on Stable CM7 7.1.0!
Change Log HERE
New ROM 2.8.8 Nightly 220 Base 2.3.7!
Change Log HERE
New ROM 2.8.6
Change log HERE
NEW ROM 2.8.5 nightly 210
Change log HERE
NEW ROM 2.8.4 nightly 209
Change log HERE and HERE
NEW ROM 2.8.3 nightly 207
Change log HERE
New ROM 2.8.2 nightly 203!
Change log HERE
Fix home/call buttons if not working after install!
1. Install AnyCut from Android Market
2. Go to the home screen
3. Long press on the wallpaper
4. Tap "Shortcut"
5. Tap "Any Cut"
6. Tap "Activity"
7. Choose "Setup Wizard" from the list of activities
8. Tap "OK"
9. There should now be a Setup Wizard icon on your home screen. Follow the wizard through to completion and the dial / home / hangup hardware keys should now be behaving normally again.
Boot Boost Addon (All kernels)
***On Boot, Max speed to 1.47Ghz or 1157Ghz this is more stable speed, and will prevent stuck on boot when phone overheated above 42C
This UPDATE IS NOT MUST!!! ONLY IF YOU WANT!!!
***Included new fixed SQL LITE from Samsung thread that fix lag in I/O (Big Thanks to the developers that provided it.)
UPDATE ABOUT GPS!
3 GPS.conf files with regions + AGPS auto download tweaks and new tweaks for 2.0 only + More Tweaks found by me.
gps.conf_Auto_AGPS_update_every_24hr_(asia).zip
gps.conf_Auto_AGPS_update_every_24hr_(europe).zip
gps.conf_Auto_AGPS_update_every_24hr_(north-america).zip
Or you can change GPS.conf manually by looking here for our NTP server name for country go HERE
Find your region and change the Asia to your in gps.conf
save and reboot or do it before flash!
About SWAP!
ROM will activate 3 kind of swap
It's will turn ON (only if you have already created swap file on partition, or set partition for swap (the hard way) )
SD-EXT SWAP
SD-SWAP
EXT dedicated SWAP partition
***If you have SWAP already, or EXT or SD-SWAP/EXT-SWAP, no need to run the swap activation scripts.
***I have created 2 scripts for disabling SD swap before use of USB storage.
I have put them in your /sdcard/gscript
so you only need the app (gscript light or full)
then load this scripts, when you need usb storage run swapoff script. when done run swapon.
or you can install dual mount app. i can’t live without it so try it.
Camera!
Camera taking better pick now!
And video recording is with m4v decoder and mp4 file output, video is super! with no lag!
On "HD" camera is on 800x480 6Mbits frameRate="24" Video codec="m4v" fileFormat="mp4"
Sound aac bitRate="96000" sampleRate="16000" 30MB in one minute!!!
On "HIGH" camera is on 720x480 3Mbits frameRate="24" Video codec="m4v" fileFormat="mp4"
Sound aac bitRate="96000" sampleRate="16000" 23MB in one minute!!!
To switch from High to HD just choose HD in camera,
if you switch and no difference in screen size then choose LOW and back to HIGH or HD its will change...
Libaudio Drivers
I have uploaded 5 different audio drivers! (Credit to developers)
You can test them one by one, and if you get phone call bug then use the next one, till you be happy with one of them.
Older Changelog
Links for Nightly Updates:
CHANGE LOG
DOWNLOADS FOR BRAVO
​
This ROM is special, its tweaked to MAX! its super fast and has lots of RAM+SWAP
In order to use this ROM as HIGH END you must know that default AndroidAutoKiller is disabled!
This why it's so stable and home app never refresh,
But you must control your free RAM with app called " System Tuner PRO (was know as process monitor pro) " look for it and you will find it.
Also i recommend to use Advanced task killer pro with system tuner pro!
This app will control your RAM and not let to ROM to overload it self and reboot.
I have excluded all my apps and services that i want to run in RAM all the time and the rest are killed when i turn my screen off! or when no more RAM exist.
This setting is inside this application.
It's best that RAM will always be more then 40MB!
The Light ROM (update) set the auto killer back on line, this will limit you to open only 40 apps + services + system stuff, and after app 41 the home screen will refresh and all big apps in RAM will be closed. this is bug in CM7 not related to me.
I just found a way to disable it. (HIGH END)
I have many tweaks working in this Rom,
CRON script that TASK activation by time set.
it's running script every 10 minutes
Script sit in /sdcard/phonePrioritizer/script.txt
It's contain function called renice.
It's set CPU power priority to apps and services that exist in RAM.
I have tweaked the system services and stock apps to best setting for priority.
you can add custom apps
you can use renice range from -15 (big priority to service / app ) to 15 (very low priority to app / service)
The -20 to -15 reserved for system. do not use it or instability can be felt.
To add custom app to priority script install autokiller from market open your app push home, go to autokiller app and to services ,
find your open app, click long on it and choose more info,
you will see that package name, this is what you need, write it down and go and edit the script.txt according my example at the bottom of the script.
We Are Number One! In NAND ROM NO SENSE!
​
Keep the feedback flowing, I need to know how it's working for you.!
Lets make best ROM for US!
DON'T FORGET TO PUSH THE THANKS! BUTTON
YOU CAN ALSO DONATE TO KEEP ME GOING!
LOOK FOR BUTTON "Donate To Me" under my nickname!
Thanks for using my ROM!
I am here for you so write comments!
​
SWAP THE HARD WAY!
What is swap?
Swap is extension or RAM on sdcard, for ability to load more apps in RAM and get fast multy tasking (apps stay in ram)
Many people think that this is not needed any more. well i must disagree it's way better with swap when you don't have any more RAM to spare.
When no RAM Android start to kill apps that sit in RAM and by doing this kills my apps that i use all the time,
So phone loads them again and use CPU power in process and killing other apps!
so it's a circle a loop, with swap no problem!
I have 37 apps in memory all the time.​
So here is the guide to activate SWAP on your device The hard way!​
Again read about it and only if you think you need it and you are heavy user like me!
Then follow closely to instructions!
1) This procedure will erase your SDCARD!!!
So before you begin backup all your stuff from SDCARD and the extended Linux partition to your computer drive!
You can use Titanium backup PRO to backup all, and then move all to your disk.
And after you finish, restore all back.
2)when you ready to format your SDCARD, Download Recovery_150M_system_5M_cache[v3.1.0.1].zip from my ROM mirror!
unzip to comp and install it, (how to you must know by now)
3)when all done, enter to new recovery console, go to advanced and use the partition sdcard
Choose your preferred size of extended partition, then it's will ask you about the size of the SWAP partition! choose 256MB (the MAX) finish and turn your device OFF.
4)remove your SDCARD and using card reader format the FAT32 partition with 32Block NOT the 4096 by default. (this will increase reading and writing performance)
5)copy your stuff back as was to SD.
6)If your ROM working then proceed to 7 if not install your ROM and after restart install my tweaks.
7)now is the fun part! you have swap activated and working! no need to do any thing more!
Now you should see that you have SWAP of 256MB and 0 Used
Go to terminal and run
free​ It's will start to grow and shrink automatically depend on your RAM use and be activated on boot!.​
SD SWAP THE EASY WAY!
In Easy way Swap you don't need to reformat or even reboot your phone to create swap!
If you installed my ROM and you don't have swap but you want to stay on HIGH END ROM,
Then you can do this to enable SD swap
Download script sdswap200.sh or dataswap250.sh from my mirror.
Run in in GSCRIPT App or copy it to SDCARD root,
Open Terminal:​
type this:
Code:
su -
sh /sdcard/sdswap200.sh
OR
sh /sdcard/dataswap250.sh
wait for it to finish!
done you have 200mb of swap! with sdwapscript on sdcard OR 250MB swap on EXT (DATA) partiton
You must have 200mb FREE on sdcard before you run this script! OR 250 on EXT DATA partition.
Every time you reboot swap will be activated! NO need to run script any more.
​
Real Working Auto Brightness module​
Here is the Auto Brightness module that you can configure via Settings ( lights.qsd8k.so )
But You will lose the Blinking Notification Light! it's just will be ON (Red Light) if you have notification, or OFF if you don't.
My settings that work just great for me
After installation go to settings > Display settings > Brightness
And set the Automatic Brightness ON
Then go to settings > CyanogenMod settings > Display > Automatic backlight.
*At Light sensor filter check-box ENABLED
*At windows length use 10sec
*Reset threshold use 400LUX
*Sample interval use 2sec
At Light Levels check-box Use Custom
*Screen dim level use 10
*Edit other levels...
Firs of all : Set number of levels to 7 and push the save & apply, you should see now 7 levels
It's should look like that:
Code:
[B]
Upper = (this is changing automatically when you set all the rest)[/B] [B]
Lower Upper Screen Buttons[/B] [B]
0 14 25 255[/B] [B]
15 149 40 255[/B] [B]
150 224 50 255[/B] [B]
225 499 70 0[/B] [B]
500 999 80 0[/B] [B]
1000 2999 100 0[/B] [B]
3000 INFINITY 250 0 (this is the max level)[/B]
Save & Apply go back <--
*Check-Box the Allow light decrease
*At decrease hysteresis use 50%
Have fun with the setting if you like.
CROND TASKER! MODULE!
​I have finally cooked the CROND task service configuration, Thanks to LIT!
I have uploaded file CRON-TASKS.zip to mirror.
Cron will start 2 minutes after Full BOOT!!!
SO HOW TO CONFIGURE IT BEFORE INSTALL!!!!
Open the zip!
in folder /system/etc/int.d
open file 08wcron with notepad ++ of EditPlus (not with notepad)
find this:
TZ=IDT-3
This is the TIME ZONE! it's important!
PUSH THIS LINK!
Find you country in that LINK!
Example!
I see for Israel
Friday, August 12, 2011 at 01:44:22 IDT
Current time zone offset:UTC/GMT +3 hours
So i need to SET! opposite! -3 (WHY? have no idea, but this is the only way)
TZ=IDT-3
Then save and install
WHAT IS IT DO?
First it's will remove the Phone prioritizer app, and save you 60MB ram,
CRON will do this!:
Run the prioritizer script every 10 minutes to speed up the phone!
1-59/10 * * * * sh /mnt/sdcard/phonePrioritizer/script.txt;date > /data/cron-renice;echo "runing script.txt every 10MIN" >> /data/cron-renice
Run Clear file Cache every 4AM!
0 4 * * * sh /mnt/sdcard/phonePrioritizer/reboot.txt;date > /data/cron-clear-file-cache;echo "runing reboot.txt to clear cache without reboot every 4:00AM" >> /data/cron-clear-file-cache
Run Clear RAM Cache every 6 hours day/night to speed up the phone!
0 0-23/6 * * * sync;sysctl -w vm.drop_caches=3;sleep 3;sysctl -w vm.drop_caches=0;date > /data/cron-clear-ram-cache;echo "runing clear ram cache every 6 Hours" >> /data/cron-clear-ram-cache
Clear SWAP and re-enable it back! Release all the LAG cache
(works for HIGH END, no change for LIGHT ROM)
20 4 * * * swapoff -a;sleep 5;swapon -a;date > /data/cron-clear-swap;echo "runing clear swap every 4:20AM" >> /data/cron-clear-swap
Script that hold the tsks above is in /data/data/cron/root (in install ZIP)
when in phone then in /data/cron/root
Examples:
* * * * * sh /sdcard/SOMESCRIPT.sh (this will run the script every minute!)
0 5 * * * sh /sdcard/SOMESCRIPT.sh (this will run the script every 5:00AM)
30 5 * * * sh /sdcard/SOMESCRIPT.sh (this will run the script every 5:30AM)
1-59/30 * * * * sh /sdcard/SOMESCRIPT.sh (this will run the script every 30 minutes!)
There are too many combinations, search google for crontab settings
Also i have packed small script name cron-check.sh it's will go to /sdcard/gscript
so load it with gscript and then you can check the status of CRON!
this is what you will see!
/data/cron-clear-file-cache:Thu Aug 11 04:00:01 PDT 2011
/data/cron-clear-file-cache:runing reboot.txt to clear cache without reboot every 4:00AM
/data/cron-clear-ram-cache:Thu Aug 11 18:06:56 PDT 2011
/data/cron-clear-ram-cache:runing clear ram cache every 6 Hours
/data/cron-clear-swap:Thu Aug 11 04:20:06 PDT 2011
/data/cron-clear-swap:runing clear swap every 4:20AM
/data/cron-renice:Thu Aug 11 21:21:01 PDT 2011
/data/cron-renice:runing script.txt every 10MIN
if you see this with your time, then all ok!
But you need to wait till it's will be executed!
so first you will see the:
/data/cron-renice:Thu Aug 11 21:21:01 PDT 2011
/data/cron-renice:runing script.txt every 10MIN
after 10 minutes,
all the rest after first execution!
To see if cron RUNNING!
crond is installed with the busybox!
in terminal do:
ps | grep crond
you get something like this (after you install configured ZIP)
# ps | grep crond
root 4338 1 2188 420 c00bf130 00008a7c S crond
So have fun with it
All my work will be posted here free for all, i will updat on new tweaks.
********HERE I WILL POST MY WORK********
MY /SYSTEM/ETC/INIT.D SCRIPTS:
01MountAll
Code:
#!/system/bin/bash
# Created by Dorimanx
echo 1 > /sys/devices/platform/leds-microp/leds/amber/brightness
L="log -p i -t cm"
$L "Welcome to Android `getprop ro.build.version.release` / `getprop ro.modversion`";
$L " ";
$L " DORIMANX SUPER FAST AND TWEAKED TO THE MAX ROM ";
$L " ";
$L " ";
stop
#creating debug log for admin.
echo "creating debug log for admin at /data/mountall-script-debug.sh"
echo "new boot" > /data/mountall-script-debug.sh
echo "Pre BOOT Start" >> /data/mountall-script-debug.sh
date >> /data/mountall-script-debug.sh
##############################################################################################################################################
Enable-EXT-check-and-repair-and-speedUP () {
echo "Repairing ext file system and speeding access"
echo "Repairing ext file system and speeding access" >> /data/mountall-script-debug.sh
if [ -e /dev/block/mmcblk0p2 ]; then
echo "Ext file system found..."
echo "Setting journal_data_writeback on sd-ext partition to speed the access"
cat /proc/mounts > /etc/mtab
echo "Converting EXT3 to EXT4 if not done yet by user if done then ignore"
echo "Converting EXT3 to EXT4 if not done yet by user if done then ignore" >> /data/mountall-script-debug.sh
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2
echo "Convert is DONE, you have EXT4 NOW"
echo "Convert is DONE, you have EXT4 NOW" >> /data/mountall-script-debug.sh
tune2fs -o journal_data_writeback /dev/block/mmcblk0p2
tune2fs -m2 /dev/block/mmcblk0p2
echo "e2fsck running"
e2fsck -vyf /dev/block/mmcblk0p2
tune2fs -l /dev/block/mmcblk0p2
tune2fs -r 2048 /dev/block/mmcblk0p2
estatus=$?
if [ $estatus -gt 0 ]
then
echo "One or more errors were found in your ext4 partition"
echo "One or more errors were found in your ext4 partition" >> /data/mountall-script-debug.sh
if [ $estatus -eq 1 ]
then
echo "File system errors were corrected successfully"
echo "File system errors were corrected successfully" >> /data/mountall-script-debug.sh
elif [ $estatus -eq 2 ]
then
echo "Serious file system errors were found and corrected successfully"
echo "Serious file system errors were found and corrected successfully" >> /data/mountall-script-debug.sh
elif [ $estatus -eq 4 ]
then
echo "Serious file system errors were found and COULD NOT BE FULLY CORRECTED"
echo "Serious file system errors were found and COULD NOT BE FULLY CORRECTED" >> /data/mountall-script-debug.sh
else
echo "e2fsck has encountered technical errors and cannot continue. Script will ABORT"
echo "e2fsck has encountered technical errors and cannot continue. Script will ABORT" >> /data/mountall-script-debug.sh
fi
#statexit=1
else
#statexit=0
echo "Your ext file system was checked and was clean..No repair was necessary."
echo "Your ext file system was checked and was clean..No repair was necessary." >> /data/mountall-script-debug.sh
fi
else
echo "No Ext file system found...Skipping"
echo "No Ext file system found...Skipping" >> /data/mountall-script-debug.sh
fi
}
############################################
#Trigger, without # =ON with #OFF default=ON
Enable-EXT-check-and-repair-and-speedUP
##############################################################################################################################################
Check-FAT-Partition-and-repair () {
echo "Repairing SDCARD FAT Partition"
echo "Repairing SDCARD FAT Partition" >> /data/mountall-script-debug.sh
if [ -e /dev/block/mmcblk0p1 ]
then
echo "Sdcard found.."
echo "Sdcard found.." >> /data/mountall-script-debug.sh
mount -t vfat /dev/block/vold/179:1 /mnt/sdcard
echo "DosFsck running..."
fsck_msdos -p -f /dev/block/mmcblk0p1
dosstatus=$?
if [ $dosstatus -gt 0 ]
then
echo "One or more errors were found in your Fat32 partition"
echo "One or more errors were found in your Fat32 partition" >> /data/mountall-script-debug.sh
if [ $dosstatus -eq 1 ]
then
echo "File system errors were corrected successfully"
echo "File system errors were corrected successfully" >> /data/mountall-script-debug.sh
elif [ $dosstatus -eq 2 ]
then
echo "Serious file system errors were found and corrected successfully"
echo "Serious file system errors were found and corrected successfully" >> /data/mountall-script-debug.sh
else
echo "dosfsck has encountered technical errors and cannot continue. Script will ABORT"
echo "dosfsck has encountered technical errors and cannot continue. Script will ABORT" >> /data/mountall-script-debug.sh
fi
else
echo "Your Fat32 file system was checked and was clean..No repair was necessary."
echo "Your Fat32 file system was checked and was clean..No repair was necessary." >> /data/mountall-script-debug.sh
fi
else
echo "Your Fat32 file system could not be read Script will abort"
echo "Your Fat32 file system could not be read Script will abort" >> /data/mountall-script-debug.sh
fi
umount -l /mnt/sdcard
}
############################################
#Trigger, without # =ON with #OFF default=ON
#Check-FAT-Partition-and-repair
##############################################################################################################################################
Find-and-Mount-SD-EXT-and-SpeedUP () {
BB="logwrapper busybox";
echo "find SD Card"
for MMC_NUM in `seq 0 9`;
do
MMC_TYPE=`cat /sys/block/mmcblk$MMC_NUM/device/type`
if [ "$MMC_TYPE" = "SD" ];
then
# 2nd partition of sdcard should be the sd-ext if exist
SD_EXT_PART=/dev/block/mmcblk${MMC_NUM}p2
break
fi
done
if [ -b "$SD_EXT_PART" ];
then
log -p i -t mountsd "Mounting EXT filesystem..";
echo "Mounting EXT filesystem.." >> /data/mountall-script-debug.sh
echo "mount and set perms"
$BB mount -o rw,nobh,barrier=0,noatime,nodiratime,data=writeback,nosuid,nodev,nobh,nouser_xattr,noauto_da_alloc,commit=60,inode_readahead_blks=1,delalloc $SD_EXT_PART /sd-ext;
######################
#backup config for tests.
#$BB mount -o rw,nobh,barrier=0,noatime,nodiratime,data=writeback,nosuid,nodev,nobh,nouser_xattr,noauto_da_alloc,commit=240,journal_async_commit,inode_readahead_blks=1,delalloc $SD_EXT_PART /sd-ext;
######################
fi
if [ "$?" = 0 ];
then
$BB chown 1000:1000 /sd-ext;
$BB chmod 777 /sd-ext;
log -p i -t mountsd "sd-ext successfully mounted";
echo "sd-ext successfully mounted" >> /data/mountall-script-debug.sh
else
log -p e -t mountsd "Unable to mount filesystem for /sd-ext";
echo "Unable to mount filesystem for /sd-ext" >> /data/mountall-script-debug.sh
fi
}
############################################
#Trigger, without # =ON with #OFF default=ON
Find-and-Mount-SD-EXT-and-SpeedUP
##############################################################################################################################################
Enable-Dalvik2SD () {
if [ ! -e /data/dalvik-on-data-now ]; then
echo "Enable Dalvik2SD"
echo "Enable Dalvik2SD" >> /data/mountall-script-debug.sh
if [ -e /dev/block/mmcblk0p2 ];
then
echo "move dalvik cache from internal memory to sdcard"
echo "move dalvik cache from internal memory to sdcard" >> /data/mountall-script-debug.sh
if [ ! -d /sd-ext/dalvik-cache ];
then
mkdir /sd-ext/dalvik-cache;
busybox chown 1000:1000 /sd-ext/dalvik-cache;
busybox chmod 777 /sd-ext/dalvik-cache;
fi
echo "move dalvik to sd-ext"
echo "move dalvik to sd-ext" >> /data/mountall-script-debug.sh
busybox rm -rf /data/dalvik-cache;
echo "Create BIND to SD-EXT"
echo "Create BIND to SD-EXT" >> /data/mountall-script-debug.sh
mkdir /data/dalvik-cache
mount -o bind /sd-ext/dalvik-cache /data/dalvik-cache
echo "clean up old whiteouts in SD-EXT"
echo "clean up old whiteouts in SD-EXT" >> /data/mountall-script-debug.sh
for i in local misc property system tombstones;
do
if [ -h /sd-ext/$i ];
then rm -rf /sd-ext/$i;
fi
busybox rm -f /sd-ext/app/*.odex
setprop cm.dc2sd.active 1;
echo "+++ dalvik2sd enabled"
echo "+++ dalvik2sd enabled" >> /data/mountall-script-debug.sh
done;
else
echo "NO EXT Partition Detected"
echo "NO EXT Partition Detected" >> /data/mountall-script-debug.sh
fi
DC2SD_ACTIVE=`getprop cm.dc2sd.active`
if [ "$DC2SD_ACTIVE" != 1 ];
then
# replace symlinks with directories so we can boot without sd
rm -rf /data/dalvik-cache;
mkdir /data/dalvik-cache;
busybox chown 1000:1000 /data/dalvik-cache;
busybox chmod 777 /data/dalvik-cache;
fi;
else
echo "YOU HAVE DALVIK MOVED TO NAND DATA"
echo "YOU HAVE DALVIK MOVED TO NAND DATA" >> /data/mountall-script-debug.sh
fi
}
############################################
#Trigger, without # =ON with #OFF default=ON
Enable-Dalvik2SD
##############################################################################################################################################
Apps2SD-Script () {
# Apps2SD using symlinks and bind mounts
# Original Apps2SD script by [email protected] (cyanogen)
# Adapted for Oxygen ROM by AdamG
# Fixed for slow detection of SD cards by _thalamus and output a bit more debugging info so we can see where problems are arising.
# execute any postinstall script then kill it
enablea2sd () {
echo "mount and set perms"
echo "enablea2sd mount and set perms" >> /data/mountall-script-debug.sh
busybox chown 1000:1000 /sd-ext;
busybox chmod 777 /sd-ext;
echo "move apps from internal memory to sdcard"
echo "move apps from internal memory to sdcard" >> /data/mountall-script-debug.sh
for i in app
do
if [ -h /data/$i ]; then
rm -rf /data/$i
fi;
if [ ! -d /sd-ext/$i ]; then
mkdir /sd-ext/$i;
chown 1000:1000 /sd-ext/$i
fi;
if [ ! -d /data/$i ]; then
mkdir /data/$i
chown 1000:1000 /data/$i
fi;
if [ -d /data/$i ]; then
cp -a /data/$i/* /sd-ext/$i/
rm -f /data/$i/*
mount --bind /sd-ext/$i /data/$i
chown 1000:1000 /sd-ext/$i
chmod 777 /sd-ext/$i -R
fi;
done;
for p in app-private;
do
if [ -h /data/$p ]; then
rm -rf /data/$p
fi;
if [ ! -d /sd-ext/$p ]; then
mkdir /sd-ext/$p;
chown 1000:1000 /sd-ext/$p
fi;
if [ ! -d /data/$p ]; then
mkdir /data/$p
chown 1000:1000 /data/$p
fi;
if [ -d /data/app-private ]; then
cp -a /data/app-private/* /sd-ext/app-private/
rm -f /data/app-private/*
mount --bind /sd-ext/app-private /data/app-private
chown 1000:1000 /sd-ext/app-private
chmod 777 /sd-ext/app-private -R
fi;
done;
busybox chown 1000:1000 /sd-ext/$i;
busybox chmod 777 /sd-ext/$i
# clean up old whiteouts
for i in local misc property system tombstones;
do
if [ -h /sd-ext/$i ]; then
rm -f /sd-ext/$i;
fi
done;
# please don't put odex files in the app directory people
# it causes dexopt to crash when switching builds
busybox rm -f /sd-ext/app/*.odex
setprop oxygen.a2sd.active 1;
echo "sd-ext-ok" > /sd-ext/ext-ok
echo "+++ Apps-to-SD successfully enabled";
echo "+++ Apps-to-SD successfully enabled" >> /data/mountall-script-debug.sh
}
disablea2sd () { # replace symlinks with directories so we can boot without sd
for i in app app-private;
do
if [ -h /data/$i ];
then
rm -rf /data/$i;
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 777 /data/$i;
fi;
done;
setprop oxygen.a2sd.active 0;
}
if [ -e /dev/block/mmcblk0p1 ]; # We check for the presence of the FAT partition first to see if the SD has initialised.
then
echo "SD Card has been initialised...checking for ext partition.";
echo "SD Card has been initialised...checking for ext partition."; >> /data/mountall-script-debug.sh
if [ -e /dev/block/mmcblk0p2 ]; # If false, it isn't there so we don't have to sleep the script and delay the boot.
then
enablea2sd;
else
echo "No ext partition present, apps2sd disabled";
echo "No ext partition present, apps2sd disabled" >> /data/mountall-script-debug.sh
disablea2sd;
fi;
else
sleep 4; #Enables time for a slow SD to be detected and populate the device nodes.
if [ -e /dev/block/mmcblk0p2 ];
then
echo "enablea2sd for slow SD card";
echo "enablea2sd for slow SD card" >> /data/mountall-script-debug.sh
enablea2sd;
else
echo "No ext partition present after sleep, apps2sd disabled";
echo "No ext partition present after sleep, apps2sd disabled" >> /data/mountall-script-debug.sh
disablea2sd;
fi;
fi;
sync;
}
############################################
#Trigger, without # =ON with #OFF default=ON warning. do not add # at Apps2SD-Script, if you wish to disable apps2SD then remove # at disablea2sd below.
Apps2SD-Script
############################################
#Trigger, without # =ON with #OFF default=OFF
#disablea2sd
##############################################################################################################################################
#This is in case that ROM looks for dalvik in cache. also fix recovery.
Mount-Dalvik-Cache-to-Cache-folder-and-fix-recovery () {
echo "Mounting Dalvik also to cache for ROM in case needed" >> /data/mountall-script-debug.sh
if [ ! -d /cache/dalvik-cache ]; then
mkdir /cache/dalvik-cache
fi
chown 1000:1000 /cache/dalvik-cache
chmod 777 /cache/dalvik-cache
mount -o bind /sd-ext/dalvik-cache /cache/dalvik-cache
if [ ! -d /mnt/cache ]; then
mkdir /mnt/cache
fi
if [ ! -d /mnt/cache/recovery ]; then
mkdir /mnt/cache/recovery
fi
chmod 777 /mnt/cache/recovery
if [ -h /cache/recovery ]; then
rm -rf /cache/recovery
mkdir /cache/recovery
chown 1000:2001 /cache/recovery
chmod 777 /cache/recovery
fi
}
############################################
#Trigger, without # =ON with #OFF default=ON
Mount-Dalvik-Cache-to-Cache-folder-and-fix-recovery
##############################################################################################################################################
#This script will check if your EXT has more than 250MB free before DATA move. if no room data will remain in NAND data partition.
#If found 250mb FREE on EXT then you will see light blink. = GREEN ON/OF - RED ON/OFF - GREEN ON/OF - RED ON and OFF when data transfered.
Check-and-move-DATA-To-EXT () {
if [ -e /sd-ext/ext-ok ]; then
echo "checking if you have more than 250MB free on EXT before DATA move." >> /data/mountall-script-debug.sh
echo "checking if you have more than 250MB free on EXT before DATA move."
EXTSIZE=$(df -k /sd-ext | tail -n1 | tr -s ' ' | cut -d ' ' -f4)
if [ $EXTSIZE -gt 250000 ]; then
echo "Cool You have more than 250MB free on EXT partition moving data to EXT"
echo "Cool You have more than 250MB free on EXT partition moving data to EXT" >> /data/mountall-script-debug.sh
sync
sysctl -p
if [ ! -d /sd-ext/data ]; then
mkdir /sd-ext/data
chmod 777 /sd-ext/data
chown 1000:1000 /sd-ext/data
fi
if [ ! -d /data/data ]; then
mkdir /data/data
chmod 777 /data/data
chown 1000:1000 /data/data
fi
echo "Copy Data to EXT" >> /data/mountall-script-debug.sh
echo "Copy Data to EXT"
cd /sd-ext/data
find . ! -name . -prune -type l -exec rm {} \;
cd /data/data
find . ! -name . -prune -type l -exec rm {} \;
cp -a /data/data/* /sd-ext/data/ 2> /dev/null
echo "data moved OK" > /data/data-on-ext-now
echo "GOOD data moved OK"
echo "GOOD data moved OK" >> /data/mountall-script-debug.sh
chmod 444 /data/data-on-ext-now
else
echo "YOU DONT HAVE ROOM FOR DATA ON EXT PARTITION YOU NEED 250MB FREE"
echo "YOU DONT HAVE ROOM FOR DATA ON EXT PARTITION YOU NEED 250MB FREE" >> /data/mountall-script-debug.sh
fi
fi
}
if [ -e /data/data-on-ext-now ]; then
echo "Activating DATA BIND from EXT to DATA"
echo "Activating DATA BIND from EXT to DATA" >> /data/mountall-script-debug.sh
rm -rf /data/data/* 2> /dev/null
mount --bind /sd-ext/data /data/data
echo "You moved the DATA to EXT All OK"
echo "You moved the DATA to EXT All OK" >> /data/mountall-script-debug.sh
sync
sysctl -p
fi
############################################
#Trigger, without # =ON with #OFF default=OFF
#Check-and-move-DATA-To-EXT
##############################################################################################################################################
#Remount Debug to NONE to reduce resource drain.
if [ -e /sys/kernel/debug ]; then
umount /sys/kernel/debug
mount -t debugfs none /sys/kernel/debug
fi
##############################################################################################################################################
#This mod will move system + user APPS + DATA to NAND in case that DATA was moved to EXT!
Mod2-Update () {
if [ -e /sd-ext/ext-ok ]; then
if [ -e /data/data-on-ext-now ]; then
echo "Moving NEW user data to nand to release the SDCARD for RAM Services"
echo "Moving NEW user data to nand to release the SDCARD for RAM Services" >> /data/mountall-script-debug.sh
DATASIZE=$(df -k /data | tail -n1 | tr -s ' ' | cut -d ' ' -f4)
if [ $DATASIZE -gt 70000 ]; then
if [ ! -d /data/data-nand ]; then
mkdir /data/data-nand
chown 1000:1000 /data/data-nand
chmod 777 /data/data-nand
fi
#####################################################################
cd /sd-ext/data
find . ! -name . -prune -type l -exec rm {} \;
#Dorimanx added apps data, new and old.
cp -a com.protocol.x.USB /data/data-nand/ 2> /dev/null
cp -a com.innowebtech.g0t0 /data/data-nand/ 2> /dev/null
cp -a xxbcn.AllAppsOrganizerPlusB /data/data-nand/ 2> /dev/null
cp -a com.fede.launcher /data/data-nand/ 2> /dev/null
cp -a com.nitrodesk.droid20.nitroid /data/data-nand/ 2> /dev/null
cp -a net.xdevelop.rotator* /data/data-nand 2> /dev/null
cp -a com.rechild.advancedtaskkille* /data/data-nand 2> /dev/null
cp -a com.quoord.tapatalk* /data/data-nand 2> /dev/null
cp -a ccc71.bmw.pro /data/data-nand 2> /dev/null
cp -a ccc71.pmw.pro /data/data-nand 2> /dev/null
cp -a com.sebastian.seal /data/data-nand 2> /dev/null
cp -a org.adwfreak.launcher /data/data-nand 2> /dev/null
cp -a net.dinglisch.android.taskerm* /data/data-nand 2> /dev/null
cp -a mobi.mgeek.TunnyBrowser* /data/data-nand 2> /dev/null
cp -a net.rgruet.android.g3watchdog* /data/data-nand 2> /dev/null
cp -a com.dropbox.android* /data/data-nand 2> /dev/null
cp -a com.keramidas.titaniumbackup* /data/data-nand 2> /dev/null
cp -a de.shapeservices.implus* /data/data-nand 2> /dev/null
cp -a uk.co.blueNotify* /data/data-nand 2> /dev/null
cp -a com.handcent.nextsms* /data/data-nand 2> /dev/null
cp -a com.handcent.lang.nextsms* /data/data-nand 2> /dev/null
cp -a com.adobe.flashplayer* /data/data-nand 2> /dev/null
cp -a com.dooblou.WiFiFileExplorer* /data/data-nand 2> /dev/null
cp -a com.maxmpz.audioplayer* /data/data-nand 2> /dev/null
cp -a com.opera.browser* /data/data-nand 2> /dev/null
cp -a com.qs.enhancedemail* /data/data-nand 2> /dev/null
cp -a com.tomanyz.lockWatch* /data/data-nand 2> /dev/null
cp -a com.snapwood.smugfolio* /data/data-nand 2> /dev/null
cp -a com.whatsapp* /data/data-nand 2> /dev/null
cp -a com.infonetservice.phono* /data/data-nand 2> /dev/null
cp -a se.catharsis.android.calendar* /data/data-nand 2> /dev/null
cp -a org.uguess.android.sysinfo.* /data/data-nand 2> /dev/null
cp -a com.alienmanfc6.wheresmydroid* /data/data-nand 2> /dev/null
cp -a com.snowbee.colorize* /data/data-nand 2> /dev/null
cp -a com.netqin.mobileguard* /data/data-nand 2> /dev/null
cp -a org.zeam* /data/data-nand 2> /dev/null
cp -a com.Amazon.kindle* /data/data-nand 2> /dev/null
cp -a com.ebay.mobile* /data/data-nand 2> /dev/null
cp -a com.imdb.mobile* /data/data-nand 2> /dev/null
cp -a org.iii.romulus.meridian* /data/data-nand 2> /dev/null
cp -a com.speedsoftware.rootexplorer* /data/data-nand 2> /dev/null
cp -a hk.suiaing.android.lock.screenlock* /data/data-nand 2> /dev/null
cp -a nextapp.systempanel* /data/data-nand 2> /dev/null
cp -a com.facebook.katana* /data/data-nand 2> /dev/null
cp -a com.abcOrganizer.* /data/data-nand 2> /dev/null
cp -a com.mediawoz.goweather* /data/data-nand 2> /dev/null
cp -a org.gpo.greenpower* /data/data-nand 2> /dev/null
cp -a com.zegoggles.smssync* /data/data-nand 2> /dev/null
cp -a com.swype.android.inputmethod* /data/data-nand 2> /dev/null
cp -a com.it.braincrash.volumeace* /data/data-nand 2> /dev/null
cp -a com.alk.copilot.eumarket.* /data/data-nand 2> /dev/null
cp -a com.sirma.mobile.bible.android* /data/data-nand 2> /dev/null
cp -a com.bt.android.elixir* /data/data-nand 2> /dev/null
cp -a de.stohelit.folderplayer* /data/data-nand 2> /dev/null
cp -a com.osa.android.navdroyd* /data/data-nand 2> /dev/null
cp -a com.carl.tc* /data/data-nand 2> /dev/null
cp -a com.gau.go.* /data/data-nand 2> /dev/null
##########################################################################################################
#User apps data
#Add here you custome apps. use example, cp -a YOUR APP DATA FOLDER /data/data-nand 2> /dev/null
#After you finish adding, REBOOT. your app data will be moved to NAND and files in sd-ext will be deleted.
##########################################################################################################
echo "NEW-data-nand-migrated" >> /data/mountall-script-debug.sh
##########################################################################################################
DATAEXTDELETE=`ls /data/data-nand`;
for c in $DATAEXTDELETE
do
rm -rf /sd-ext/data/$c
done
echo "data-nand-migrated" > /data/data-nand-migrated
#Mount data to /data/data
ln -s /data/data-nand/* /sd-ext/data/
#done
echo "DATA of Migrated to NAND Apps, deleted from sd-ext."
echo "DATA of Migrated to NAND Apps, deleted from sd-ext." >> /data/mountall-script-debug.sh
echo "System DATA and limited app DATA Mounted."
echo "System DATA and limited app DATA Mounted." >> /data/mountall-script-debug.sh
cd /
else
echo "Your data partiotion dont have 70MB FREE for SYSTEM NAND MOD"
echo "Your data partiotion dont have 70MB FREE for SYSTEM NAND MOD" >> /data/mountall-script-debug.sh
fi
else
echo "You didnt moved DATA TO EXT with MOD #1, you cant use MOD #2, first move all data to EXT"
echo "You didnt moved DATA TO EXT with MOD #1, you cant use MOD #2, first move all data to EXT" >> /data/mountall-script-debug.sh
fi
fi
}
##############################################
#Trigger, without # =ON with #OFF default=ON
#This is the MOD #2 Moving NEW DATA for system to use them from NAND to speedup.
#Mod2-Update
##############################################################################################################################################
BOOT-UP-FIX () {
if [ -e /sd-ext/ext-ok ]; then
if [ -e /data/first-boot ]; then
cd /sd-ext/data
find . ! -name . -prune -type l -exec rm {} \;
cp -a /data/data-nand/* /sd-ext/data 2> /dev/null
rm -rf /data/data-nand/* 2> /dev/null
rm -f /data/first-boot 2> /dev/null
echo "dalvik-cache" > /sd-ext/dalvik-cache/cache-ok
fi
fi
}
##############################################
#Trigger, without # =ON with #OFF default=ON
BOOT-UP-FIX
##############################################################################################################################################
DALVIK-CACHE-FIX () {
if [ -e /sd-ext/ext-ok ]; then
if [ ! -e /sd-ext/dalvik-cache/cache-ok ]; then
cd /sd-ext/data
find . ! -name . -prune -type l -exec rm {} \;
cp -a /data/data-nand/* /sd-ext/data 2> /dev/null
rm -rf /data/data-nand/* 2> /dev/null
echo "dalvik-cache" > /sd-ext/dalvik-cache/cache-ok
fi
fi
}
##############################################
#Trigger, without # =ON with #OFF default=ON
DALVIK-CACHE-FIX
##############################################################################################################################################
echo "Fixing System Owners"
busybox chown 0:2000 /system/etc/init.d/*
busybox chown 0:0 /cache
busybox chown 1000:2001 /cache/recovery
busybox chown 1000:1000 /cache/dalvik-cache
busybox chown 1000:2001 /cache/recovery
busybox chown 1000:1000 /dev/smd27
busybox chown 0:0 /dev
busybox chown 0:0 /system/lib/*
busybox chown 0:0 /system/lib/hw/*
busybox chown 0:2000 /dev/cpu_dma_latency
echo "Fixing System permissions"
busybox chmod 777 /dev/smd27
busybox chmod 755 /dev
busybox chmod 777 /dev/cpu_dma_latency
busybox chmod 755 /system/etc/init.d/*
busybox chmod 644 /system/etc/gps.conf
busybox chmod 644 /system/etc/hosts
busybox chmod 644 /system/etc/sysctl.conf
busybox chmod 777 /system/lib/*
busybox chmod 777 /system/lib/hw/*
busybox chmod 755 /system/lib/egl/*
busybox chmod 644 /system/build.prop
busybox chmod 777 /cache/ -R
echo "DONE"
##############################################################################################################################################
#This will copy the SU to xbin also and remove the simlink
CopyRoot () {
#Checking and fixing ROOT
rm -rf /system/xbin/su
cp /system/bin/su /system/xbin/
chmod 6777 /system/xbin/su
chown 0:0 /system/xbin/su
#Done
}
############################################
#Trigger, without # =ON with #OFF default=ON
CopyRoot
##############################################################################################################################################
#This is ZIP Align Script. it's will fix all the apps in /system/app and in /sd-ext/app every boot, already alinged apps will not be checked again.
#Temp dir is on SDCARD to give all big apps a chance to be fixed.
ZIPALIGN () {
echo "Activating zipalign for all apps"
echo "Activating zipalign for all apps" >> /data/mountall-script-debug.sh
LOG_FILE=/data/zipalign.log
ZIPALIGNDB=/data/zipalign.dba
SYSTEM=$(mount|grep "/system "|awk '{ print $1 }')
[ -e $LOG_FILE ] && rm $LOG_FILE
[ -f $ZIPALIGNDB ] || touch $ZIPALIGNDB
MissingApps=`cat /data/zipalign.dba | grep eu.chainfire.cf3d`
if [ $MissingApps !=eu.chainfire.cf3d ]; then
echo "/data/app/eu.chainfire.cf3d-1.apk" >> /data/zipalign.dba
echo "adding Missing APPS"
else
echo "Missing Apps Already Added"
fi
echo "Starting Dorimanx Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE
mount -t vfat /dev/block/vold/179:1 /mnt/sdcard
for DIR in /system/app /data/app ; do
cd $DIR
for APK in *.apk ; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ] ; then
echo "Already checked: $DIR/$APK" | tee -a $LOG_FILE
else
zipalign -c 4 $APK
if [ $? -eq 0 ] ; then
echo "Already aligned: $DIR/$APK" | tee -a $LOG_FILE
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB
else
echo "Now aligning: $DIR/$APK" | tee -a $LOG_FILE
if [ ! -d /mnt/sdcard/zipalign ]; then
mkdir /mnt/sdcard/zipalign
chmod 777 /mnt/sdcard/zipalign
fi
zipalign -f 4 $APK /mnt/sdcard/zipalign/$APK
cp -a /mnt/sdcard/zipalign/$APK $APK
rm -f /mnt/sdcard/zipalign/$APK
chmod 644 /system/app/*
chmod 644 /data/app/*
chown 1000:1000 /system/app/*
chown 1000:1000 /data/app/*
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB
fi
fi
done
done
touch $ZIPALIGNDB
umount /mnt/sdcard
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE
echo "Automatic ZipAlign finished" >> /data/mountall-script-debug.sh
}
############################################
#Trigger, without # =ON with #OFF default=ON
ZIPALIGN
##############################################################################################################################################
echo "Writing debug info for dorimanx support. file name /data/mountall-script-debug.sh, post it if you have problems"
if [ -d /sd-ext/data ] && [ -e /data/data-on-ext-now ]; then
echo "DATA IS ON EXT MOD #1 ONLINE" >> /data/mountall-script-debug.sh
else
echo "DATA IS ON NAND, MOD #1 is OFFLINE" >> /data/mountall-script-debug.sh
fi
if [ -e /data/data-nand-migrated ]; then
echo "System DATA and Choosen DATA migrated to NAND, MOD #2 ONLINE" >> /data/mountall-script-debug.sh
else
echo "MOD #2 not activated"
fi
echo "Starting the Android Virtual Machine, let the HIGH POWER be with you, ROM DEV DORIMANX"
echo "Starting the Android Virtual Machine, let the HIGH POWER be with you, ROM DEV DORIMANX" >> /data/mountall-script-debug.sh
echo "Pre BOOT finish" >> /data/mountall-script-debug.sh
date >> /data/mountall-script-debug.sh
start
# execute any postinstall script then kill it
if [ -e /data/firstboot.sh ];
then
log -p i -t boot "Executing firstboot.sh..";
logwrapper /system/bin/sh /data/firstboot.sh;
rm -f /data/firstboot.sh;
fi;
echo "ALL DONE, END OF FILE"
sleep 2
echo 0 > /sys/devices/platform/leds-microp/leds/amber/brightness
sleep 2
exit 1
MY /BOOT/initrd.gz changes:
init.htcleo.rc (all credits to Tytung!!! i just make some edits)
init.rc (all credits to Tytung!!! i just make some edits)
logo.lge
To Extract the initrd.gz
copy the initrd.gz to sdcard
mkdir /initdir
cd /initdir
cp /sdcard/initrd.gz /initdir
chmod 777 initrd.gz
chown 0:0 initrd.gz
zcat initrd.gz | cpio -i -d
rm initrd.gz
EDIT What you want!
Pack the files back to initrd.gz
find . | cpio -o -H newc | gzip -9 > initrd.gz
you can then use this initrd.gz for MAG ROM (copy to boot inside ROM zip)
Or you need to compile it with the kernel module for CLK!
HOW to Compile CLK boot.img
take the zImage , initrd.gz , mkbootimg, and copy to ANY Linux BOX not the PHONE!!!
i used Centos 5
and winscp to transfer files to linux box.
mkdir /clkboot
Copy all 3 files to /clkboot
cd /clkboot
chown 0:0 *
chmod 777 *
run this:
mkbootimg --kernel zImage --ramdisk initrd.gz --cmdline "console=null" --base 0x11800000 -o boot.img
ls -la
you will see the new boot.img
copy in to main root dir on zipped CLK rom.
i will attach the mkbootimg as zip extract it when copying to Linux box.
also there are 2 more files.
repack-bootimg.pl
and
unpack-bootimg.pl
one of them unpack the boot.img extract the initrd.gz + kernel.gz (create folder with all files only for initrd.gz)
and the repack-bootimg.pl will get all back to boot-new.img (in rom folder it's should be as boot.img)
HAVE FUN!
​
wWOWOO Im going to test now!! Cant wati but are the recovery partitions in the rom or are they 150 and cache 5?
Edit: Bootanimation is craZY1!!!! really nice one!!
oh and rom fast as lightning!!
Hi man, I download 2.5.0 now, I will try for swap.
Your too fast man, your too fast....
All right lets have some fun
Just flashed new v2.5.0
You have tried the rest now get ready to try the best!
From my HD2 with Dorimanx Nandroid
New sheriff in town, let's play
I do not use the swap,so is that right for me to choose the HIHG-END rom?
err sorry but what does SWAP do?
shendan said:
I do not use the swap,so is that right for me to choose the HIHG-END rom?
Click to expand...
Click to collapse
LOL....
Post 1:
"if you don't have SWAP then install the REVERT to LIGHT after installing my ROM via CWM before you reboot."
dogntbone said:
err sorry but what does SWAP do?
Click to expand...
Click to collapse
Swap is a sort of ram exension on SDCARD, so you have "more" ram, so more speed for application.
Dorimanx rom is the fastest rom I have ever tried. It works perfectly but, Dorimanx, you have to quickly update your post with all the things new users have to do for creating swap, manage app in ram and so on, because without that, I thnk some people will be in trouble to use your rom as I am at start of using Hig end.
Edit : Oups...Dorimanx : swap not activated on 2.5.0. Trying swapon -a : answer /etc/fstab no such file or directory...Mistake is mine or yours?
the only tweaks that i need for cm7 is tablet tweaks(the soft keys) with percentual battery and your skin(great lookin theme).. it is possible to install Framework-res-TabletTweak-130711+MY-SKIN.zip with Typhoon 3.4.0 or it is not compatible ?
Manual Network selection does not work..it says "Error while searching for networks". This is of much importance to me as i live close to Croatian border and their signal is stronger in certain places in my home.
Other than that, this rom just flies!
feanor91 said:
Swap is a sort of ram exension on SDCARD, so you have "more" ram, so more speed for application.
Dorimanx rom is the fastest rom I have ever tried. It works perfectly but, Dorimanx, you have to quickly update your post with all the things new users have to do for creating swap, manage app in ram and so on, because without that, I thnk some people will be in trouble to use your rom as I am at start of using Hig end.
Click to expand...
Click to collapse
Thanks,
YES i am working on update all needed info!
SO PEOPLE IF YOU DON'T HAVE SWAP INSTALL THE LIGHT REVERT!!!!
stirkac said:
Manual Network selection does not work..it says "Error while searching for networks". This is of much importance to me as i live close to Croatian border and their signal is stronger in certain places in my home.
Other than that, this rom just flies!
Click to expand...
Click to collapse
OK this is good feedback!
You are using the CLK i guess!
Then something wrong with kernel.
I will revert back to STABLE one that working for all.
I will post new CLK ROM soon.
Thanks!
Thanks for the rom been trying it out and most of it works I just get random reboots on the 2.4.6 other than that all seem well. I will be updating to latest and hope it will go away.
On a side note is there any way you can make that we can revert to stock theme??
Toda for taking the time to help us all out.
Sent from my HTC HD2 using XDA Premium App
What size must have a swap partition? 2x RAM?
I am running on clk with 2.5.0 and I also have swap partition (created through CWM as in your description), but since 2.4.6 and also in 2.5.0 when I type "free" I have "0 0 0" for swap partition, also /system/etc/fstab" doesn't exist.
I did a completely clean installation of 2.5.0, no data partition, nothing.
Any idea?
Update: I now have the swap file by executing your "swap.sh" file from your instructions page. But I thought, this isn't neccessary with your own roms?
bigbadmoshe said:
Thanks for the rom been trying it out and most of it works I just get random reboots on the 2.4.6 other than that all seem well. I will be updating to latest and hope it will go away.
On a side note is there any way you can make that we can revert to stock theme??
Toda for taking the time to help us all out.
Sent from my HTC HD2 using XDA Premium App
Click to expand...
Click to collapse
I will make revert to stock theme zip file!
check in my mirrors in 10 minutes!

[TIP][TRICK][SCRIPT] ISD for Link2SD #2P, ESD as ISD, 300MB ESD, VM#, NTP.

Thank you, for taking the time to put this together for the E4GT community. Nice work
Great. I always wanted to know how to do it.
I decided to write a script to do this automatically.
[size=+1]As before, I provide this with no warranties or guarantees. Use at your own risk. Make a NAND backup of at least System and Data before attempting.[/size]
The script assumes you have busybox and root access.
The script does not check for supported hardware. It has only been tested on the SPH-D710.
The script will check for /mnt/sdcard/external_sd, /mnt/emmc, and /mnt/sd-ext and that at least one is mounted. It bails otherwise. If your external SD card is mounted elsewhere, you can add it to line 9 of the script file (`mountpoint <real path to external SD (no symlinks)>`).
This script must be executed from a live boot (ie, not from recovery) using either Root Explorer, Scripter, a terminal emulator, ADB, or anything else that will run scripts as root.
The file must be on an EXT# partition (just put it in /data and you'll be fine) with 777 permissions unless you're using Scripter.
The script backs up your vold.fstab file to /data/vold.fstab.bak. If the backup file exists, the script will restore it, delete the Link2SD file, and delete the backup file.
Executing the script from Recovery is not advisable.
Executing the script after it has already been executed and the backup file no longer exists is also not advisable.
Your phone will reboot immediately after the script has executed.
Method 1 (terminal emulator or ADB shell):
Put the file from the zip into the /data directory.
Use the following commands from the shell:
Code:
su
chmod 777 /data/eg.link2sd.sh
sh /data/eg.link2sd.sh
Method 2 (Root Explorer | Root Browser):
Put the file from the zip into the /data directory.
Long tap the file, click "Permissions", check every box (the bottom row (there are only two boxes in that row) can be unchecked), and tap Ok.
Tap the file and tap "Execute".
Method 3 (Scripter):
Put the file from the zip wherever, but remember where.
Open Scripter, tap the "+", tap "Import", find the file, and tap it.
Tap the file in the list, tap "Run script", make sure "Execute script as root" is checked, and tap "Execute".
The full script:
Code:
#!/system/bin/sh
LOG=/data/testlog.log
VTEMP=/data/eg.vold.fstab
LTEMP=/data/eg.11link2sd
TEMPFILE=/data/eg.temp
BVOLD=/data/vold.fstab.bak
EXTMOUNTED=""
for N in `mountpoint /mnt/emmc` `mountpoint /mnt/sdcard/external_sd` `mountpoint /mnt/sd-ext`
do
if [ $N ]; then
echo "Found external card. ($N)";
EXTMOUNTED="Yes";
break;
fi
done
if [ ! $EXTMOUNTED ]; then
echo "Can't find external SD card. Make sure it's inserted and mounted and try again.";
exit;
fi
mount -o remount,rw /system
# System files
MOUNTPOINTS=/proc/mounts
VOLD=/system/etc/vold.fstab
LINK2SD=/system/etc/init.d/11link2sd
EXTPATH="";
EXTDEV="";
INTPATH="";
INTDEV="";
LINK2SDPATH="";
LINK2SDDEV="";
x=0;
while [ $x -lt $(cat $MOUNTPOINTS | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $MOUNTPOINTS | tail -n 1`;
DEVICE=`echo "$LINE" | cut -d' ' -f1`;
POINT=`echo "$LINE" | cut -d' ' -f2`;
if [ $POINT = "/mnt/sdcard/external_sd" ] || [ $POINT = "/mnt/emmc" ] || [ $POINT = "/mnt/sd-ext" ]; then # It's the external SD
EXTPATH=$POINT;
EXTDEV=$DEVICE;
elif [ $POINT = "/mnt/sdcard" ]; then
INTPATH=$POINT;
INTDEV=$DEVICE;
elif [ $POINT = "/data/sdext2" ]; then
LINK2SDPATH=$POINT;
LINK2SDDEV=$DEVICE;
fi
done
if [ -f $BVOLD ]; then
echo "Restoring backup. ($BVOLD > $VOLD, '' > $LINK2SD)";
cp $BVOLD $VOLD;
rm $LINK2SD;
rm $BVOLD;
exit;
else
echo "Making backup. ($VOLD > $BVOLD)";
cp $VOLD $BVOLD;
fi
if [ $EXTPATH ] && [ $EXTDEV ]; then
echo "External SD ==";
echo "$EXTPATH: $EXTDEV";
fi
if [ $INTPATH ] && [ $INTDEV ]; then
echo "Internal SD ==";
echo "$INTPATH: $INTDEV";
fi
if [ $LINK2SDPATH ] && [ $LINK2SDDEV ]; then
echo "Link2SD ==";
echo "$LINK2SDPATH: $LINK2SDDEV";
fi
echo "" > $VTEMP;
echo "" > $LTEMP;
echo "" > $TEMPFILE;
echo "#!/system/bin/sh" > $LTEMP;
echo "#added by link2sd" >> $LTEMP;
echo "LOG=/data/link2sd-11link2sd.log" >> $LTEMP;
echo "echo \"\$(date) mounting...\" > \$LOG" >> $LTEMP;
echo "" >> $LTEMP;
VEXT="";
VINT="";
x=0;
while [ $x -lt $(cat $VOLD | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $VOLD | tail -n 1`;
ACTION=`echo "$LINE" | cut -d' ' -f1`;
DEVID=`echo "$LINE" | cut -d' ' -f2`;
POINT=`echo "$LINE" | cut -d' ' -f3`;
PART=`echo "$LINE" | cut -d' ' -f4`;
DEVICE=`echo "$LINE" | cut -d' ' -f5`;
if [ "$POINT" = "$EXTPATH" ]; then # It's the external SD
echo "#$LINE" >> $TEMPFILE;
echo "INT 1" >> $TEMPFILE;
VEXT="$ACTION $DEVID $INTPATH $PART $DEVICE";
elif [ "$POINT" = "$INTPATH" ]; then
echo "#$LINE" >> $TEMPFILE;
echo "EXT 1" >> $TEMPFILE;
VINT="$ACTION $DEVID $EXTPATH 12 $DEVICE";
echo "mount -t vfat -o rw /dev/block/mmcblk0p$PART /data/sdext2 1>>\$LOG 2>>\$LOG" >> $LTEMP;
else
echo "$LINE" >> $TEMPFILE;
fi
done
x=0;
while [ $x -lt $(cat $TEMPFILE | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $TEMPFILE | tail -n 1`;
ACTION=`echo "$LINE" | cut -d' ' -f1`;
if [ "$ACTION" = "EXT" ] && [ "$VEXT" ]; then
echo "$VEXT" >> $VTEMP;
elif [ "$ACTION" = "INT" ] && [ "$VINT" ]; then
echo "$VINT" >> $VTEMP;
else
echo "$LINE" >> $VTEMP;
fi
done
echo "" >> $LTEMP;
echo "mount >> $LOG" >> $LTEMP;
echo "\"\$(date) mount finished\" >> \$LOG" >> $LTEMP;
cp $LTEMP $LINK2SD;
cp $VTEMP $VOLD;
rm $LTEMP;
rm $VTEMP;
rm $TEMPFILE;
chmod 777 $LINK2SD;
mount -o remount,ro /system
reboot;
I can't seem to get this to work without errors and system app crashes on Stock rooted JB 4.1.2.
Nice write up. Thanks for the time spent to put this together
E4GT Rom-a-holic!!!
egingell said:
I can't seem to get this to work without errors and system app crashes on Stock rooted JB 4.1.2.
Click to expand...
Click to collapse
Someone smarter than me can validate or disprove my answer here, but I believe JB has different file system mount points than ICS. (he said he did this on BK)
CyberpodS2 said:
Someone smarter than me can validate or disprove my answer here, but I believe JB has different file system mount points than ICS. (he said he did this on BK)
Click to expand...
Click to collapse
You are correct. JB has a different pre load set up. I think you are rite...this was created on the ICS Kuban.
E4GT Rom-a-holic!!!
CyberpodS2 said:
Someone smarter than me can validate or disprove my answer here, but I believe JB has different file system mount points than ICS. (he said he did this on BK)
Click to expand...
Click to collapse
robrooter said:
You are correct. JB has a different pre load set up. I think you are rite...this was created on the ICS Kuban.
E4GT Rom-a-holic!!!
Click to expand...
Click to collapse
That's just it, it works fine, but System, Settings, and some other system apps crash consistently while the internal sdcard is mounted to Link2SD's directory and the external sdcard mounted in its place. I even made sure to edit my scripts to change where the external and internal would be remounted to (it's /storage/sdcard0 and /storage/extSdCard respectively).
P.S.: It's 4.2 that changes how mounts are seen by or accessible to apps.
Edit: To clarify, the directories get successfully changed around as intended.
Edit 2: Oh, and the phone reboots itself after a few minutes. I had to fix it via Recovery with ADB because the phone wouldn't stay up long enough to do it the normal* way. * Transferring files to the SD card via USB and moving them to their proper destinations via Root Explorer.
I figured out why I was having a problem. I was mounting /dev/block/mmcblk0p12 to /storage/extSdCard. The problem is that Android 4.1.2 stock uses /dev/block/mmcblk0p12 as "overflow" for system apps.
I am currently unwilling to test this on my phone at this time. My setup would require /dev/block/mmcblk0p11 to be an EXT4 file system which, judging by what I see in init.rc, is going to get reformatted as exFAT on boot. Besides, Link2SD has since been fixed to find the second partition on the external SD card for the SGS2.
I have successfully mounted my internal SD card to /data/sdext2, mounted my external SD card to /storage/sdcard0, and bound /storage/sdcard0 to /storage/extSdCard (for backward compatibility) using the following scripts.
[size=+1]I provide this information with no warranties or guarantees and I only tested it on the Sprint Epic 4G Touch with stock rooted Jelly Bean 4.1.2. Use it at your own risk.[/size]
Requires:
root
busybox
basic knowledge of shell scripts and Linux (not necessarily required, but it doesn't hurt)
Notes:
Make sure /system/etc/init.d/12binds, /system/bin/debuggerd, and /system/bin/debuggerd.bin are executable. Just to be safe, you can execute this from a terminal emulator (the asterisk will make it get multiple files at the same time).
Code:
mount -o remount,rw /system
chmod 755 /system/bin/debuggerd*
chmod 755 /system/etc/init.d/12binds
mount -o remount,ro /system
The reason I converted my SD card to EXT4 is so I can move&bind internal app data (the stuff in /data/data/app.package.name) to /data/sdext2/data/app.package.name and preserve file permissions. exFAT does not support this.
Terminal emulator - Executing this command will wipe the SD card and convert it to EXT4. This is optional:
Code:
mkfs.ext2 /dev/block/mmcblk0p11
/system/etc/vold.fstab
Code:
[color=green]## Vold 2.0 Generic fstab
## - San Mehat ([email protected])
##
#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label - Label for the volume
## mount_point - Where the volume will be mounted
## part - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
## storage_struct - ex) series, "/mnt/sdcard/extStorages" / parallel
######################
# internal sdcard[/color]
{
ums_sys_path = /sys/class/android_usb/f_mass_storage/lun0/file
secure_format = enable
discard = enable
}
[color=green]#dev_mount sdcard /storage/sdcard0 11 /devices/platform/dw_mmc/mmc_host/mmc0/mmc0 encryptable_nonremovable[/color]
dev_mount sdcard /storage/sdcard0 1 /devices/virtual/block/cyasblkdevblk0
[color=green]# external sdcard[/color]
{
ums_sys_path = /sys/class/android_usb/f_mass_storage/lun1/file
android_secure_containers = enable
}
[color=green]# This partition is 300MB (the smallest I could make it using MiniTool Partition
# Widard) and is [b]not[/b] set to active. It does not mount, which is how I want it. I know
# I'm wasting 300MB of disk space, but that's ok by me.
# This line is here to prevent "damaged SD card" errors.[/color]
dev_mount sdcard1 /storage/extSdCard 2 /devices/virtual/block/cyasblkdevblk0
/system/bin/debuggerd - Make sure you rename the original to /system/bin/debuggerd.bin if you haven't already done so.
Code:
[color=green]#!/system/bin/sh[/color]
LOG=/data/link2sd-debuggerd.log
echo "$(date) mounting..." > $LOG
[color=green]# Delete or comment out this line if you want to make your external SD card into
# an internal and external SD card (both partitions set to active).
# I have not tried setting both partitions on my external SD card to active, so
# I don't know if they will both mount.
# This line binds the internal SD card's directory to the external SD card's
# directory. In other words both internal and external SD cards will be
# the same physical media. You will have duplicates in Music and Gallery.
# If you are not concerned with backward compatibility, you
# can delete or comment out this line.[/color]
mount -o bind /storage/sdcard0 /storage/extSdCard 1>>$LOG 2>>$LOG
[color=green]# Change "ext4" to "vfat" if you did not convert your internal SD card to EXT4.[/color]
mount -t ext4 -o rw,noatime,barrier=0,nobh,errors=continue /dev/block/mmcblk0p11 /data/sdext2 1>>$LOG 2>>$LOG
echo "" >> $LOG
echo "init.d" >> $LOG
[color=green]# Leave this line in if you want init.d support.[/color]
busybox run-parts /system/etc/init.d 1>>$LOG 2>>$LOG
echo "" >> $LOG
mount >> $LOG
echo "$(date) mount finished" >> $LOG
echo debuggerd.bin launched >> $LOG
exec /system/bin/debuggerd.bin
/system/etc/init.d/12binds - This is optional and requires more work than you might think and requires your internal card be EXT4, exFAT will not work. It also requires the "run-parts" line in /system/bin/debuggerd.
Code:
[color=green]#!/system/bin/sh[/color]
LOG=/data/symlink.log;
echo "Symlink" > $LOG
busybox mount -o rw,remount /system
busybox mount -o rw,remount /
cd /data/sdext2/data/
for APP in *; do
cd /data/sdext2/data/$APP;
for DIR in *; do
if [ $DIR != "lib" ]; then # don't bind the lib folder, Link2SD does stuff with it.
echo "" 1>>$LOG 2>>$LOG;
echo "Binding /data/sdext2/data/$APP/$DIR => /data/data/$APP/$DIR" 1>>$LOG 2>>$LOG;
mount -o bind "/data/sdext2/data/$APP/$DIR" "/data/data/$APP/$DIR" 1>>$LOG 2>>$LOG;
fi
done
done
busybox mount -o ro,remount /system
busybox mount -o ro,remount /
Make sure it is executable (chmod 755 /system/etc/init.d/12binds)
To make the above work:
If this is too much for you, don't do it.
Copy /data/data/app.package.name to /data/sdext2/data or if the folder already exists in /data/sdext2/data, copy the contents of /data/data/app.package.name to /data/sdext2/data/app.package.name. Use Root Explorer or any other root file explorer that will preserve the owner of the files and their permissions. Do not use the "move" option or you will be making new folders and trying to figure out what the owner and group should be!
Open each folder except lib in /data/data/app.package.name and delete everything in them.
Execute /system/etc/init.d/12binds or reboot.
I bought an SGS4 and promptly broke the SD card I got for it, so I took the one from my S2 and put it in the S4. I then changed the vold.fstab file back to stock. Unfortunately since the internal SD card is EXT formatted, it won't mount as an SD card. This means that any app that relies on the SD card may not work. Apps that use the path work if I mount the SD card via shell script, but there's a caveat: the files that get put there (e.g. $sdcard/Android/data/<app name>/cache/<stuff>) have their owner/group set to that of the app and no other app can use it without changing the files' owner, group, and permissions first. Camera and Gallery apps won't work at all regardless of whether or not I mount the SD card, at least not the ones I've tried (stock camera and gallery, Camera ICS, Gallery ICS, and Social Gallery). Otherwise the phone works fine without error.
Edit: If I mount a temporary file system (mount -t tmpfs /dev/null /storage/sdcard0), I can get the Camera to work, but the Gallery still complains and any pictures get deleted after reboot. This gave me an idea, though: mount the tmpfs and then bind /data/sdext2 to /storage/sdcard0. This worked, for the most part. Gallery apps still don't like it, but the Camera works. I still have to change the owner, group, and permissions to be able to do anything with pics.
For the record, this seems to work the best:
Code:
chown media_rw:media_rw /data/sdext2
chown media_rw:media_rw /data/sdext2/DCIM
chown media_rw:media_rw /data/sdext2/DCIM/*
chown media_rw:media_rw /data/sdext2/DCIM/Camera/*
chmod -r 775 /data/sdext2
/system/bin/debuggerd
Code:
#!/system/bin/sh
LOG=/data/debuggerd.log
echo "$(date) mounting..." > $LOG
mount -t ext4 -o rw,noatime,barrier=0,nobh,errors=continue /dev/block/mmcblk0p11 /data/sdext2 1>>$LOG 2>>$LOG
mount -t tmpfs /dev/null /storage/sdcard0 1>>$LOG 2>>$LOG
mount -o bind /data/sdext2 /storage/sdcard0 1>>$LOG 2>>$LOG
echo "" >> $LOG
echo "init.d" >> $LOG
/system/xbin/busybox run-parts /data/local/init.d 1>>$LOG 2>>$LOG
echo "" >> $LOG
mount >> $LOG
echo "$(date) mount finished" >> $LOG
echo debuggerd.bin launched >> $LOG
exec /system/bin/debuggerd.bin
I could change it back to exFAT, but I don't wanna.
egingell said:
I decided to write a script to do this automatically.
[size=+1]As before, I provide this with no warranties or guarantees. Use at your own risk. Make a NAND backup of at least System and Data before attempting.[/size]
The script assumes you have busybox and root access.
The script does not check for supported hardware. It has only been tested on the SPH-D710.
The script will check for /mnt/sdcard/external_sd, /mnt/emmc, and /mnt/sd-ext and that at least one is mounted. It bails otherwise. If your external SD card is mounted elsewhere, you can add it to line 9 of the script file (`mountpoint <real path to external SD (no symlinks)>`).
This script must be executed from a live boot (ie, not from recovery) using either Root Explorer, Scripter, a terminal emulator, ADB, or anything else that will run scripts as root.
The file must be on an EXT# partition (just put it in /data and you'll be fine) with 777 permissions unless you're using Scripter.
The script backs up your vold.fstab file to /data/vold.fstab.bak. If the backup file exists, the script will restore it, delete the Link2SD file, and delete the backup file.
Executing the script from Recovery is not advisable.
Executing the script after it has already been executed and the backup file no longer exists is also not advisable.
Your phone will reboot immediately after the script has executed.
Method 1 (terminal emulator or ADB shell):
Put the file from the zip into the /data directory.
Use the following commands from the shell:
Code:
su
chmod 777 /data/eg.link2sd.sh
sh /data/eg.link2sd.sh
Method 2 (Root Explorer | Root Browser):
Put the file from the zip into the /data directory.
Long tap the file, click "Permissions", check every box (the bottom row (there are only two boxes in that row) can be unchecked), and tap Ok.
Tap the file and tap "Execute".
Method 3 (Scripter):
Put the file from the zip wherever, but remember where.
Open Scripter, tap the "+", tap "Import", find the file, and tap it.
Tap the file in the list, tap "Run script", make sure "Execute script as root" is checked, and tap "Execute".
The full script:
Code:
#!/system/bin/sh
LOG=/data/testlog.log
VTEMP=/data/eg.vold.fstab
LTEMP=/data/eg.11link2sd
TEMPFILE=/data/eg.temp
BVOLD=/data/vold.fstab.bak
EXTMOUNTED=""
for N in `mountpoint /mnt/emmc` `mountpoint /mnt/sdcard/external_sd` `mountpoint /mnt/sd-ext`
do
if [ $N ]; then
echo "Found external card. ($N)";
EXTMOUNTED="Yes";
break;
fi
done
if [ ! $EXTMOUNTED ]; then
echo "Can't find external SD card. Make sure it's inserted and mounted and try again.";
exit;
fi
mount -o remount,rw /system
# System files
MOUNTPOINTS=/proc/mounts
VOLD=/system/etc/vold.fstab
LINK2SD=/system/etc/init.d/11link2sd
EXTPATH="";
EXTDEV="";
INTPATH="";
INTDEV="";
LINK2SDPATH="";
LINK2SDDEV="";
x=0;
while [ $x -lt $(cat $MOUNTPOINTS | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $MOUNTPOINTS | tail -n 1`;
DEVICE=`echo "$LINE" | cut -d' ' -f1`;
POINT=`echo "$LINE" | cut -d' ' -f2`;
if [ $POINT = "/mnt/sdcard/external_sd" ] || [ $POINT = "/mnt/emmc" ] || [ $POINT = "/mnt/sd-ext" ]; then # It's the external SD
EXTPATH=$POINT;
EXTDEV=$DEVICE;
elif [ $POINT = "/mnt/sdcard" ]; then
INTPATH=$POINT;
INTDEV=$DEVICE;
elif [ $POINT = "/data/sdext2" ]; then
LINK2SDPATH=$POINT;
LINK2SDDEV=$DEVICE;
fi
done
if [ -f $BVOLD ]; then
echo "Restoring backup. ($BVOLD > $VOLD, '' > $LINK2SD)";
cp $BVOLD $VOLD;
rm $LINK2SD;
rm $BVOLD;
exit;
else
echo "Making backup. ($VOLD > $BVOLD)";
cp $VOLD $BVOLD;
fi
if [ $EXTPATH ] && [ $EXTDEV ]; then
echo "External SD ==";
echo "$EXTPATH: $EXTDEV";
fi
if [ $INTPATH ] && [ $INTDEV ]; then
echo "Internal SD ==";
echo "$INTPATH: $INTDEV";
fi
if [ $LINK2SDPATH ] && [ $LINK2SDDEV ]; then
echo "Link2SD ==";
echo "$LINK2SDPATH: $LINK2SDDEV";
fi
echo "" > $VTEMP;
echo "" > $LTEMP;
echo "" > $TEMPFILE;
echo "#!/system/bin/sh" > $LTEMP;
echo "#added by link2sd" >> $LTEMP;
echo "LOG=/data/link2sd-11link2sd.log" >> $LTEMP;
echo "echo \"\$(date) mounting...\" > \$LOG" >> $LTEMP;
echo "" >> $LTEMP;
VEXT="";
VINT="";
x=0;
while [ $x -lt $(cat $VOLD | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $VOLD | tail -n 1`;
ACTION=`echo "$LINE" | cut -d' ' -f1`;
DEVID=`echo "$LINE" | cut -d' ' -f2`;
POINT=`echo "$LINE" | cut -d' ' -f3`;
PART=`echo "$LINE" | cut -d' ' -f4`;
DEVICE=`echo "$LINE" | cut -d' ' -f5`;
if [ "$POINT" = "$EXTPATH" ]; then # It's the external SD
echo "#$LINE" >> $TEMPFILE;
echo "INT 1" >> $TEMPFILE;
VEXT="$ACTION $DEVID $INTPATH $PART $DEVICE";
elif [ "$POINT" = "$INTPATH" ]; then
echo "#$LINE" >> $TEMPFILE;
echo "EXT 1" >> $TEMPFILE;
VINT="$ACTION $DEVID $EXTPATH 12 $DEVICE";
echo "mount -t vfat -o rw /dev/block/mmcblk0p$PART /data/sdext2 1>>\$LOG 2>>\$LOG" >> $LTEMP;
else
echo "$LINE" >> $TEMPFILE;
fi
done
x=0;
while [ $x -lt $(cat $TEMPFILE | wc -l) ]
do
let x=x+1;
LINE=`head -n $x $TEMPFILE | tail -n 1`;
ACTION=`echo "$LINE" | cut -d' ' -f1`;
if [ "$ACTION" = "EXT" ] && [ "$VEXT" ]; then
echo "$VEXT" >> $VTEMP;
elif [ "$ACTION" = "INT" ] && [ "$VINT" ]; then
echo "$VINT" >> $VTEMP;
else
echo "$LINE" >> $VTEMP;
fi
done
echo "" >> $LTEMP;
echo "mount >> $LOG" >> $LTEMP;
echo "\"\$(date) mount finished\" >> \$LOG" >> $LTEMP;
cp $LTEMP $LINK2SD;
cp $VTEMP $VOLD;
rm $LTEMP;
rm $VTEMP;
rm $TEMPFILE;
chmod 777 $LINK2SD;
mount -o remount,ro /system
reboot;
Click to expand...
Click to collapse
[email protected]_a51dtul:/ # sh /data/eg.link2sd.sh
sh /data/eg.link2sd.sh
/data/eg.link2sd.sh[16]: mountpoint: not found
/data/eg.link2sd.sh[16]: mountpoint: not found
/data/eg.link2sd.sh[16]: mountpoint: not found
Can't find external SD card. Make sure it's inserted and mounted and try again.
[email protected]_a51dtul:/ #
plz help.........my sd card second partion ext4
He... Plz help link2sd not work for htc 820 dual sim lolypop 5.0.2 full rooted or busybox.
Link2sd problem-any apps link success all linked but big problem just manually restart my phone show link2sd error mount open link 2sd and tap quckreboot, but not apps linked show my desktop alwas error view and mount script alwas error.
Plz help....how to work link2sd apps linked and mount script for lolypop 5.0.2 htc 820 dual
That script was written for the Galaxy S2 with ICS. You'll have to modify it to work in whatever device and OS you have and I don't have either of them, so you're on your own.
Sent from: SGS2 - JB 4.1.2 GB27 / SGS4 - JB 4.2.2 MF9
egingell said:
That script was written for the Galaxy S2 with ICS. You'll have to modify it to work in whatever device and OS you have and I don't have either of them, so you're on your own.
Sent from: SGS2 - JB 4.1.2 GB27 / SGS4 - JB 4.2.2 MF9
Click to expand...
Click to collapse
Mods like this eventually burn out extsdcards, when that happens the device won't boot, they also don't work without the modified sdcard inserted. If it ever burns out it is nearly impossible to get the device working again. Just a heads up.
Change Default VM Number in Lollipop
XDA Thread
Sent from: SGS5 - LP 5.1.1 / SGS4 - LP 5.0.1
Google seems to have closed outbound connections to the NTP port (123). Lucky, one can easily reopen it with the following script. Execute it as root post-boot with ROM Toolbox or similar.
Code:
#!/system/bin/sh
iptables -A OUTPUT -p udp --dport 123 -j ACCEPT
Edit: So it turns out that init.d is too soon. It must be executed post-boot using a script executer like ROM Toolbox, Tasker, Script Manager, etc.
Sent from: SGS5 - LP 5.1.1 / SGS4 - LP 5.0.1

[GUIDE] Run Sickbeard/Transmission/sabnzbd/SSH/Samba/More on Shield

I've seen lots of people saying its not possible to make the shield an all in one solution for downloading, but after hours of tinkerering I've got a semi easy way of running the above services (and tons more) from the shield. This does requrie a bit of command line-fu , but I think I've got most of the hard work done. When its all said and done, we'll have a working entware-ng installation ( https://github.com/Entware-ng/Entware-ng)
--This guide is a work in progress, there are a few other items I'll add that will improve user experience, but as it stands now it should work as intended. I also haven't gotten a samba config to work yet, so if anyone can figure it out, let me know and I'll update a section on it
I've addapted this guide from a few github projects , but that likely means some commands/steps are actually useless on the shield:
https://github.com/erichlf/AndroidSeedBox
(will add other sources later)
AS ALWAYS MAKE A BACKUP OF DATA -- I AM NOT RESPONSIBLE IF YOUR DEVICE LOSES DATA (to my knowledge, there is no risk of bricking your device doing this, at worst a factory reset/reflash)
Pre-reqs:
Shield has to have ROOT
ADB set up on PC
Busybox : http://www.apkmirror.com/apk/jrummy-apps-inc/busybox-for-android/
Rom Toolbox Lite : Not on apk mirror, so side load from your favorite place
For this process, I recommend having your shield next to your computer, and share inputs with your monitor. You can do 90% of it from an ADB shell, but a few parts you will need to use a terminal on the shield itself, and keyboard is way easier than controller
Install Busybox on the shield, but use the oldest version available (I think the wget for 1.26 messes with the process)
run "ADB Shell" and run these commands on the shield (You can copy/paste multiple lines into the cmd window):
Code:
su
mount -o rw,remount /
ls /data/entware-ng >/dev/null 2>&1 || mkdir /data/entware-ng
cd .; ln -s /data/entware-ng /opt
ls /data/entware-ng/rootbin >/dev/null 2>&1 || mkdir /data/entware-ng/rootbin
cd .; ln -s /data/entware-ng/rootbin /bin
ls /data/entware-ng/rootlib >/dev/null 2>&1 || mkdir /data/entware-ng/rootlib
cd .; ln -s /data/entware-ng/rootlib /lib
ls /data/entware-ng/tmp >/dev/null 2>&1 || mkdir /data/entware-ng/tmp
cd .; ln -s /data/entware-ng/tmp /tmp
ls /data/entware-ng/home >/dev/null 2>&1 || mkdir /data/entware-ng/home
ls /data/entware-ng/home/root >/dev/null 2>&1 || mkdir /data/entware-ng/home/root
ls /data/entware-ng/home/user >/dev/null 2>&1 || mkdir /data/entware-ng/home/user
chmod 0755 /data/entware-ng/home/root
chown root.root /data/entware-ng/home/root
chmod 0755 /data/entware-ng/home/user
We've set up our staging area, and created a new home directory.
Now lets install Entware
Code:
ls /data/entware-ng/bin >/dev/null 2>&1 || mkdir /data/entware-ng/bin
ls /data/entware-ng/lib >/dev/null 2>&1 || mkdir /data/entware-ng/lib
ln -s /system/bin/sh /bin/sh
wget http://pkg.entware.net/binaries/armv7/installer/entware_install.sh -O /data/entware-ng/entware_install.sh
sh /data/entware-ng/entware_install.sh
Now lets install a new Busybox and Wget
Code:
/opt/bin/opkg install busybox
/opt/bin/opkg install wget
cd /bin; ln -s /data/entware-ng/bin/busybox sh
cd /bin; ln -s /data/entware-ng/bin/busybox echo
cd /bin; ln -s /data/entware-ng/bin/busybox rm
cd /bin; ln -s /data/entware-ng/bin/busybox rmdir
cd /bin; ln -s /data/entware-ng/bin/busybox sed
cd /bin; ln -s /data/entware-ng/bin/busybox mkdir
cd /bin; ln -s /data/entware-ng/bin/busybox head
cd /bin; ln -s /data/entware-ng/bin/busybox sort
cd /bin; ln -s /data/entware-ng/bin/busybox dirname
cd /bin; ln -s /data/entware-ng/bin/busybox ln
cd /bin; ln -s /data/entware-ng/bin/busybox mv
cd /bin; ln -s /data/entware-ng/bin/busybox cat
cd /bin; ln -s /data/entware-ng/bin/busybox chown
cd /bin; ln -s /data/entware-ng/bin/busybox chmod
cd /bin; ln -s /data/entware-ng/bin/busybox pgrep
This next step may be optional. Sets up resolv.conf (which may already exist, I'm not sure) and mtab (I don't know what this is)
Code:
echo nameserver 8.8.8.8 >/data/entware-ng/etc/resolv.conf
ls /etc >/dev/null 2>&1 || mkdir /etc
mount -o rw,remount /system
ls /etc/resolv.conf >/dev/null 2>&1 && rm /etc/resolv.conf
cd .; ln -s /data/entware-ng/etc/resolv.conf /etc/resolv.conf
cd .; ln -s /proc/mounts /etc/mtab
Create Passwd file
Code:
echo root:x:0:0:root:/opt/home/root:/bin/sh >/data/entware-ng/etc/passwd
echo shell:x:2000:2000:shell:/opt/home/user:/bin/sh >>/data/entware-ng/etc/passwd
cd .; ln -s /data/entware-ng/etc/passwd /etc/passwd
echo root:x:0:root >/data/entware-ng/etc/group
echo shell:x:2000:shell >>/data/entware-ng/etc/group
cd .; ln -s /data/entware-ng/etc/group /etc/group
echo /bin/sh > /etc/shells
echo PATH=/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin > /etc/profile
echo export PATH >> /etc/profile
OPTIONAL: If you want to use Open SSH with password instead of certs you can do the following step. I have done this, and haven't noticed any issues, but it may lessen the security of Root
Code:
/data/entware-ng/bin/busybox passwd root
Now let's create a script that will initialize Entware-ng after reboot
Code:
echo \#\!/system/bin/sh > /data/entware-ng/entware-init.sh
echo mount -o rw,remount rootfs / >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng /opt >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/rootlinb /lib >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/rootbin /bin >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/tmp /tmp >> /data/entware-ng/entware-init.sh
echo ln -s /system/bin/sh /bin/sh >> /data/entware-ng/entware-init.sh
echo mount -o ro,remount rootfs >> /data/entware-ng/entware-init.sh
chmod 755 /data/entware-ng/entware-init.sh
Now lets create a start script that calls the initialize script we just made, but also returns a shell in the new environment
Code:
echo \#\!/system/bin/sh > /data/entware-ng/start.sh
echo ls '/opt >/dev/null 2>&1 ||' su -c /data/entware-ng/entware-init.sh >> /data/entware-ng/start.sh
echo export PATH=/opt/sbin:/opt/bin:/opt/rootbin:/opt/local/bin:/system/bin >> /data/entware-ng/start.sh
echo if busybox test $(busybox id -u) = 0; then HOME=/opt/home/root; else HOME=/opt/home/user; fi >> /data/entware-ng/start.sh
echo export HOME >> /data/entware-ng/start.sh
echo '/opt/etc/init.d/rc.unslung start' >> /data/entware-ng/start.sh
echo /bin/sh >> /data/entware-ng/start.sh
chmod 755 /data/entware-ng/start.sh
Now, lets install different services. These are optional, and there are tons more, but this will get transmission/sickbeard/ssh going
Code:
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install vim
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install samba36-server
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install transmission-web transmission-daemon-openssl
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install python
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install python-setuptools
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install python-pip
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install python-cheetah
PATH=/data/entware-ng/bin:/bin /data/entware-ng/bin/opkg install openssh-server
Copy the start.sh and sysinit to the home environment
Code:
cp /data/entware-ng/start.sh /data/entware-ng/home/root/start.sh
cp /data/entware-ng/start.sh /data/entware-ng/home/root/sysinit
chown root.root /data/entware-ng/home/root/start.sh
chmod 755 /data/entware-ng/home/root/start.sh
chown root.root /data/entware-ng/home/root/sysinit
chmod 755 /data/entware-ng/home/root/sysinit
mount -o ro,remount /
mount -o ro,remount /system
Start the new environment
Code:
sh /data/entware-ng/home/root/sysinit
SICKBEARD CONIG
Install a few pre-reqs for sickbeard
Code:
pip install transmissionrpc
pip install cherrypy
Create a file in init.d to allow sickbeard to start on reboot. Please note, you will need to change the path to where your sickbeard directory is.
I'm not going to cover setting up sickbeard, there are other guides for that. I did find that it couldn't be bound to 0.0.0.0 , or local host, it needed to be hard coded for the shields IP, so I recommend setting it up as a static IP in your router.
Code:
echo PATH=/opt/bin:/opt/sbin:$PATH > /opt/etc/init.d/S96sickbeard
echo /opt/bin/python <YOUR PATH TO>/SickBeard.py -d --port 8081 >> /opt/etc/init.d/S96sickbeard
chmod 755 /opt/etc/init.d/S96sickbeard
chmod +x /opt/etc/init.d/S96sickbeard
OPENSSH CONFIG
OPTIONAL - If you want to use SSH we need to generate keys
Code:
ssh-keygen -f /opt/etc/ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f /opt/etc/ssh/ssh_host_dsa_key -N '' -t dsa
ssh-keygen -f /opt/etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa -b 521
Now you'll have to get on the shield and use a terminal emulator to edit your sshd_config file. Here's a copy of mine, but I do not promise how secure it is.
Code:
# $OpenBSD: sshd_config,v 1.99 2016/07/11 03:19:44 tedu Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# The default requires explicit activation of protocol 1
Protocol 2
# HostKey for protocol version 1
#HostKey /opt/etc/ssh/ssh_host_key
#HostKeys for protocol version 2
HostKey /opt/etc/ssh/ssh_host_rsa_key
HostKey /opt/etc/ssh/ssh_host_dsa_key
HostKey /opt/etc/ssh/ssh_host_ecdsa_key
#HostKey /opt/etc/ssh/ssh_host_ed25519_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024
# Ciphers and keying
#RekeyLimit default none
# Logging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
StrictModes no
#MaxAuthTries 6
#MaxSessions 10
#RSAAuthentication yes
#PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# For this to work you will also need host keys in /opt/etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
PermitEmptyPasswords yes
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
UsePrivilegeSeparation no
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /opt/var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner none
# enable DSCP QoS values (per RFC-4594)
#IPQoS AF21 AF11
# override default of no subsystems
Subsystem sftp /opt/lib/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
To edit this, on the shield (Rom Toolbox Lite has a terminal emulator) run
Code:
su
cd /opt
sh ./start.sh
cd /opt/etc/ssh
vi ./sshd_config
TRANSMISSION
You'll have to configure your transmission settings, but they're located
/opt/etc/transmission/settings.json
Persist after reboot / Start Transmission/SSH/Sickbeard on boot
On the shield, open Rom Toolbox lite, and go down to "Scripter"
Import the sysinit script located /opt/home/root/sysinit and set the script to run at boot as root
Reboot and you should be able to connect via SSH, and have
Why do we need the passwd and group file ? Won't we use android's UID/GID ?
Can this method somehow be used to create custom group where we could put android's UID ?
I don't know why that step is needed, I got it from the guide I listed, and it worked without any apparent issues, so I left it in. My guess is openssh wants it to be there, but I'm not sure
So after you run all that is there a Interface for Sickbeard etc?
ahoslc said:
So after you run all that is there a Interface for Sickbeard etc?
Click to expand...
Click to collapse
It would be running on <shield IP>:8081 which you could access from the shield, or any other device on your network. Transmission would be :9091
Thanks for this. I'm trying to get python3-pip, acd_cli, and encfs installed on my Shield TV so I can mount my Amazon Cloud Drive and decrypt files for use with Plex. I have this set up on my NAS but it is too weak to do transcoding. I did set up the NAS as a middleman and mounted shares from it on the Shield TV, and while it does work, the extra step is really slow.
edit: I managed to get acd_cli working but I cannot mount my Amazon Cloud Drive share, I get I/O errors when I try to cd into it. Wonder if there's a kernel issue.
psycho_asylum said:
Thanks for this. I'm trying to get python3-pip, acd_cli, and encfs installed on my Shield TV so I can mount my Amazon Cloud Drive and decrypt files for use with Plex. I have this set up on my NAS but it is too weak to do transcoding. I did set up the NAS as a middleman and mounted shares from it on the Shield TV, and while it does work, the extra step is really slow.
edit: I managed to get acd_cli working but I cannot mount my Amazon Cloud Drive share, I get I/O errors when I try to cd into it. Wonder if there's a kernel issue.
Click to expand...
Click to collapse
So I was able to get this working https://github.com/dsoprea/GDriveFS and could cd into my google drive (But couldn't get Plex to see any files in the directory)
Soooo, even if you do get it working, its possible Plex won't be able to see it
Edit-- Did you install fuse-utils ?
chasx003 said:
Edit-- Did you install fuse-utils ?
Click to expand...
Click to collapse
Not specifically. I would think it would have been listed as a dependency and automatically installed, libfuse was though. I ended up factory restoring my Shield after I botched something, so now I'm just at 5.1 stock using the built-in Samba for now.
which version of busybox works? I am having trouble with wget and I tried v1.21.0
chasx003 said:
I've seen lots of people saying its not possible to make the shield an all in one solution for downloading, but after hours of tinkerering I've got a semi easy way of running the above services (and tons more) from the shield. This does requrie a bit of command line-fu , but I think I've got most of the hard work done. When its all said and done, we'll have a working entware-ng installation ( https://github.com/Entware-ng/Entware-ng)
[..]
FIRST
Now let's create a script that will initialize Entware-ng after reboot
Code:
echo \#\!/system/bin/sh > /data/entware-ng/entware-init.sh
echo mount -o rw,remount rootfs / >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng /opt >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/rootlinb /lib >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/rootbin /bin >> /data/entware-ng/entware-init.sh
echo ln -s /data/entware-ng/tmp /tmp >> /data/entware-ng/entware-init.sh
echo ln -s /system/bin/sh /bin/sh >> /data/entware-ng/entware-init.sh
echo mount -o ro,remount rootfs >> /data/entware-ng/entware-init.sh
chmod 755 /data/entware-ng/entware-init.sh
[..]
SECOND
Now lets create a start script that calls the initialize script we just made, but also returns a shell in the new environment
Code:
echo \#\!/system/bin/sh > /data/entware-ng/start.sh
echo ls '/opt >/dev/null 2>&1 ||' su -c /data/entware-ng/entware-init.sh >> /data/entware-ng/start.sh
echo export PATH=/opt/sbin:/opt/bin:/opt/rootbin:/opt/local/bin:/system/bin >> /data/entware-ng/start.sh
echo if busybox test $(busybox id -u) = 0; then HOME=/opt/home/root; else HOME=/opt/home/user; fi >> /data/entware-ng/start.sh
echo export HOME >> /data/entware-ng/start.sh
echo 'for file in /data/opt/etc/init.d/*' >> /data/entware-ng/start.sh
echo do >> /data/entware-ng/start.sh
echo ' $file start' >> /data/entware-ng/start.sh
echo done >> /data/entware-ng/start.sh
echo /bin/sh >> /data/entware-ng/start.sh
chmod 755 /data/entware-ng/start.sh
[..]
THIRD
Copy the start.sh and sysinit to the home environment
Code:
chown root.root /data/entware-ng/home/root/start.sh
chmod 755 /data/entware-ng/home/root/start.sh
chown root.root /data/entware-ng/home/root/sysinit
chmod 755 /data/entware-ng/home/root/sysinit
mount -o ro,remount /
mount -o ro,remount /system
[..]
FOURTH
Start the new environment
Code:
sh /data/opt/home/root/sysinit
Reboot and you should be able to connect via SSH, and have
Click to expand...
Click to collapse
In my quote there has to be something missing between the "first" and "second" steps and the "third" one.. are the two files we've just made the missing files in the home/root directory? Or where they supposed to come from somewhere else?
Also the "fourth" step, there are no /data/opt directory in my installation.
MartiniGM said:
In my quote there has to be something missing between the "first" and "second" steps and the "third" one.. are the two files we've just made the missing files in the home/root directory? Or where they supposed to come from somewhere else?
Also the "fourth" step, there are no /data/opt directory in my installation.
Click to expand...
Click to collapse
Ah! Sorry for not replying until now, life has been busy.
You are correct, there are some typos / things out of order! I'm going to go through this and fix it and will update the OP
I've taken this guide and installed rTorrent (due to superior web client and RSS capability). If anyone needs help on that, I can chime in.
Great tuto !
Working fine one Nvidia Shield TV 2017 with latest update (whithout reboot)
But after reboot I lost /opt and /bin on root :-O
mkdir /opt working fine after mount -o rw,remount /
but if i reboot it disappear
any idea ?
android.stackexchange.com said:
(root) directory is not a persistent filesystem on Android. It's a initramfs, which is packed into the boot image on your device. Although you can remount it with write permissions, changes will always be lost the next time you boot because the original ramdisk will be re-extracted from the boot image on the next boot.
Click to expand...
Click to collapse
So we need to :
$ mkboot boot.img /output-folder
$ cd /output-folder
$ gunzip -c ramdisk | cpio -i
... make some changes in the ramdisk and possibly /output-folder/img_info ...
$ find . | cpio -o -H newc | gzip > newramdisk.cpio.gz
$ cd ..
$ mkboot /output-folder newboot.img
If you're rooted, a better solution is to simply install in a chroot, either using debootstrap or other; you can obtain a nearly complete Linux system this way (init in a chroot is weird, stuff like openssh will still have to be started separately after boot, either manually or by an app/script).
If you're not rooted, you can use proot for simple path redirection; this is how termux installs arch on unrooted devices.
Using either option (chroot, proot) requires having binary files that aren't in a noexec partition; generally this means private app storage, not sdcard that's accessible to other apps. If you're building a chroot, you should be able to include the external/public storage folder in it, however a chroot also requires the partition not be mounted with nodev option.
***Note that I don't actually have a shield TV*** (I'm just interested in getting one) so I can't say if the shield's storage is mounted noexec, but the android data partition generally is. I can, however, verify that the process in general works on Android, however, as I've got two tablets running Lineage/Nougat with chroots, and a stock Moto G6 with archlinux arm in proot. To check for partitions mounted as nodev or noexec, run `mount|TERM=xterm grep --color -E 'nodev|noexec'`. You might check to see if you can use /data/local instead of app's private storage.
For installing BusyBox, *should* be a `busybox --install -s [DIR]` option that copies the binary to the destination, then symlinks applets. This should be simpler than symlinking a bunch of applets manually.
If you want a system-wide BusyBox I recommend stericson busybox: https://play.google.com/store/apps/details?id=stericson.busybox
For a terminal emulator on Android, I highly recommend termux, which is available on Google play and F-Droid. It has support for 256 color, styles, a package manager, Android integration (ie notifications from Linux scripts), boot scripts, widgets, etc: https://play.google.com/store/apps/details?id=com.termux
Another alternative: you can set up user-mode Linux for something closer to virtualization, but I have yet to see any UML binaries for use with Android; this would also make it difficult to run networking and to access files from outside the guest, but will provide a full working system with init support, and would not require root to set up and run--however, I think UML networking requires root and/or kernel support, though, and UML generally requires a disk image much like other virtualization tools. Qemu might be workable instead of UML with fewer issues.
Note that all of these solutions are still running under an Android app, and as such are subject to the android task killer. Not sure if there's any way around this without having something run directly by Android's own init system.
Efreak2004 said:
If you're rooted, a better solution is to simply install in a chroot, either using debootstrap or other; you can obtain a nearly complete Linux system this way (init in a chroot is weird, stuff like openssh will still have to be started separately after boot, either manually or by an app/script).
If you're not rooted, you can use proot for simple path redirection; this is how termux installs arch on unrooted devices.
Using either option (chroot, proot) requires having binary files that aren't in a noexec partition; generally this means private app storage, not sdcard that's accessible to other apps. If you're building a chroot, you should be able to include the external/public storage folder in it, however a chroot also requires the partition not be mounted with nodev option.
***Note that I don't actually have a shield TV*** (I'm just interested in getting one) so I can't say if the shield's storage is mounted noexec, but the android data partition generally is. I can, however, verify that the process in general works on Android, however, as I've got two tablets running Lineage/Nougat with chroots, and a stock Moto G6 with archlinux arm in proot. To check for partitions mounted as nodev or noexec, run `mount|TERM=xterm grep --color -E 'nodev|noexec'`. You might check to see if you can use /data/local instead of app's private storage.
For installing BusyBox, *should* be a `busybox --install -s [DIR]` option that copies the binary to the destination, then symlinks applets. This should be simpler than symlinking a bunch of applets manually.
If you want a system-wide BusyBox I recommend stericson busybox: https://play.google.com/store/apps/details?id=stericson.busybox
For a terminal emulator on Android, I highly recommend termux, which is available on Google play and F-Droid. It has support for 256 color, styles, a package manager, Android integration (ie notifications from Linux scripts), boot scripts, widgets, etc: https://play.google.com/store/apps/details?id=com.termux
Another alternative: you can set up user-mode Linux for something closer to virtualization, but I have yet to see any UML binaries for use with Android; this would also make it difficult to run networking and to access files from outside the guest, but will provide a full working system with init support, and would not require root to set up and run--however, I think UML networking requires root and/or kernel support, though, and UML generally requires a disk image much like other virtualization tools. Qemu might be workable instead of UML with fewer issues.
Note that all of these solutions are still running under an Android app, and as such are subject to the android task killer. Not sure if there's any way around this without having something run directly by Android's own init system.
Click to expand...
Click to collapse
Using chroot isn`t good solution. Emulators not effective too.
Stericon`s busybox is paid, meefik`s busybox is free and has more utils.
Termux is heavy, I use Teeminal Emulator: https://f-droid.org/app/jackpal.androidterm
You be able to install a lot of lightweight linux utils by installing entware-ng. For example, git pkg has 300 Mb size in termux and 15 Mb in entware.
Entware has a lot of conmon with optware and openwrt
this is a wonderful guide I'm surprised more people don't use it great job!

Categories

Resources