Substratum not working - Moto G7 Play Questions & Answers

I have substratum working on 2 other modded moto devices but can't get it to work on this XT1952-4. I am running Descendant-4.0.1_a64_ab Pie. The substratum version is one thousand twenty two. My device is successfuly rooted using @Spaceminer modded phh root. I have Magisk on the other 2 devices. If anyone has any ideas on this I would appreciate it. Thanks

Motomizer said:
I have substratum working on 2 other modded moto devices but can't get it to work on this XT1952-4. I am running Descendant-4.0.1_a64_ab Pie. The substratum version is one thousand twenty two. My device is successfuly rooted using @Spaceminer modded phh root. I have Magisk on the other 2 devices. If anyone has any ideas on this I would appreciate it. Thanks
Click to expand...
Click to collapse
I think that I have a solution if you can run a command from termux or adb for me.
Code:
ls /system/bin | grep .sh
Give me the output of that. I'll probably need you to send me a file afterwards, but I need to get the name of it first. I'll recognize it when I see it. If you get a special character error, drop the dot off of sh.

Wow, I wasn't expecting the legend himself replying. I don't have termux so I will get on the computer and do adb

It says cannot access '/system/bin'

I installed termux and got the following result:
crash_dump32
lshal
phh-on-boot.sh
rw-system.sh
twrp.sh

Motomizer said:
I installed termux and got the following result:
crash_dump32
lshal
phh-on-boot.sh
rw-system.sh
twrp.sh
Click to expand...
Click to collapse
Rename phh-on-boot.sh to phh-on-boot.txt and send it to me. Use the paperclip to attach it. Use a root explorer to copy it to your sdcard first. Or from termux...
Code:
su
cp /system/bin/phh-on-boot.sh /sdcard/phh-on-boot.sh
You can also concatenate it and pipe the output to a text file like this...
Code:
su
cat /system/bin/phh-on-boot.sh > /sdcard/phh-on-boot.txt

Spaceminer said:
Rename phh-on-boot.sh to phh-on-boot.txt and send it to me. Use the paperclip to attach it. Use a root explorer to copy it to your sdcard first. Or from termux...
Code:
su
cp /system/bin/phh-on-boot.sh /sdcard/phh-on-boot.sh
You can also concatenate it and pipe the output to a text file like this...
Code:
su
cat /system/bin/phh-on-boot.sh > /sdcard/phh-on-boot.txt
Click to expand...
Click to collapse
Ok, I copied and renamed the file easily with a file manager. I can't find a paperclip symbol anywhere to attach it. Is there a post quota to allow attachments?

Motomizer said:
Ok, I copied and renamed the file easily with a file manager. I can't find a paperclip symbol anywhere to attach it. Is there a post quota to allow attachments?
Click to expand...
Click to collapse
I believe there is a quota. 10 if I'm not mistaken. Just use the code button "#" and paste the text of it in a reply.

Spaceminer said:
I believe there is a quota. 10 if I'm not mistaken. Just use the code button "#" and paste the text of it in a reply.
Click to expand...
Click to collapse
[#!/system/bin/sh
[ "$(getprop vold.decrypt)" = "trigger_restart_min_framework" ] && exit 0
if [ -f /vendor/bin/mtkmal ];then
if [ "$(getprop persist.mtk_ims_support)" = 1 ] || [ "$(getprop persist.mtk_epdg_support)" = 1 ];then
setprop persist.mtk_ims_support 0
setprop persist.mtk_epdg_support 0
reboot
fi
fi
#Clear looping services
sleep 30
getprop | \
grep restarting | \
sed -nE -e 's/\[([^]]*).*/\1/g' -e 's/init.svc.(.*)/\1/p' |
while read -r svc ;do
setprop ctl.stop "$svc"
done
if grep -qF android.hardware.boot /vendor/manifest.xml || grep -qF android.hardware.boot /vendor/etc/vintf/manifest.xml ;then
bootctl mark-boot-successful
fi
]

Motomizer said:
[#!/system/bin/sh
[ "$(getprop vold.decrypt)" = "trigger_restart_min_framework" ] && exit 0
if [ -f /vendor/bin/mtkmal ];then
if [ "$(getprop persist.mtk_ims_support)" = 1 ] || [ "$(getprop persist.mtk_epdg_support)" = 1 ];then
setprop persist.mtk_ims_support 0
setprop persist.mtk_epdg_support 0
reboot
fi
fi
#Clear looping services
sleep 30
getprop | \
grep restarting | \
sed -nE -e 's/\[([^]]*).*/\1/g' -e 's/init.svc.(.*)/\1/p' |
while read -r svc ;do
setprop ctl.stop "$svc"
done
if grep -qF android.hardware.boot /vendor/manifest.xml || grep -qF android.hardware.boot /vendor/etc/vintf/manifest.xml ;then
bootctl mark-boot-successful
fi
]
Click to expand...
Click to collapse
Try this and see if it works. Place the file on your internal storage, then open up termux and run the following commands.
Code:
mount -o remount,rw /
mv /sdcard/phh-on-boot.txt /sdcard/phh-on-boot.sh
cp -f /sdcard/phh-on-boot.sh /system/bin
chmod 0755 /system/bin/phh-on-boot.sh
reboot
After rebooting, see if substratum will work.
For future reference, the code brackets work like so on XDA...
Code:
The text goes here...[/CODE ← Close this with another bracket. "]"
[CODE]The text goes here...
The bracket was closed, so now it looks different.
This helps formatting when working with scripts.

Spaceminer said:
Try this and see if it works. Place the file on your internal storage, then open up termux and run the following commands.
Code:
mount -o remount,rw /
mv /sdcard/phh-on-boot.txt /sdcard/phh-on-boot.sh
cp -f /sdcard/phh-on-boot.sh /system/bin
chmod 0755 /system/bin/phh-on-boot.sh
reboot
After rebooting, see if substratum will work.
For future reference, the code brackets work like so on XDA...
Code:
The text goes here...[/CODE ← Close this with another bracket. "]"
[CODE]The text goes here...
The bracket was closed, so now it looks different.
This helps formatting when working with scripts.
Click to expand...
Click to collapse
I knew that file I sent you didn't look right, but didn't know how to fix it. Thanks for the code bracket lesson and your patience. Unfortunately the code you had me run in termux didn't get substratum working. So you know, when I first ran into problems on this g7 play I copied the substratum apk over to my z play to see if the package was corrupt but it works fine there. Same with the themes.

Motomizer said:
I knew that file I sent you didn't look right, but didn't know how to fix it. Thanks for the code bracket lesson and your patience. Unfortunately the code you had me run in termux didn't get substratum working. So you know, when I first ran into problems on this g7 play I copied the substratum apk over to my z play to see if the package was corrupt but it works fine there. Same with the themes.
Click to expand...
Click to collapse
Can you check the build number on substratum? Find it in your app list and check near the bottom of it's info. Should look something like the attached screenshot. I'll see what I can dig up about it.

Spaceminer said:
Can you check the build number on substratum? Find it in your app list and check near the bottom of it's info. Should look something like the attached screenshot. I'll see what I can dig up about it.
Click to expand...
Click to collapse
I was trying to send a screenshot of the app info but I guess I can't do that yet, either. Next to the i in a circle at the bottom it reads:
version one thousand twenty two
They spell it out instead of using numerical digits. I have seen it like that even on older versions.
There is more information at ApkMirror. It's even compatible with Android 10. I didn't know that.

@Spaceminer
Could it be that Descendant-4.0.1_a64_ab Pie doesn't have OMS support? I did a full xda search on that and got no results. When I have time I will install another gsi rom and see what happens.

Motomizer said:
@Spaceminer
Could it be that Descendant-4.0.1_a64_ab Pie doesn't have OMS support? I did a full xda search on that and got no results. When I have time I will install another gsi rom and see what happens.
Click to expand...
Click to collapse
It's been quite awhile since I've tested descendant. That could be the case but I doubt it. OMS should be baked into the source code. I have been wrong before though. I'll see what I can find about that.

Spaceminer said:
It's been quite awhile since I've tested descendant. That could be the case but I doubt it. OMS should be baked into the source code. I have been wrong before though. I'll see what I can find about that.
Click to expand...
Click to collapse
I was just at the descendant telegram group and asked about OMS support. Dil3mma4 himself answered and said that they never really cared about substratum, nor do they now.

Motomizer said:
I was just at the descendant telegram group and asked about OMS support. Dil3mma4 himself answered and said that they never really cared about substratum, nor do they now.
Click to expand...
Click to collapse
I think this is the answer. It looks like it's unsupported.

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.

[Acer A200] GUIDE FOR ICS OTA ROOT

Your warranty is now void.
I am not responsible for bricked devices, dead SD cards, thermonuclear war, or getting flammed because you re-rooted your phone instead of your tablet because you forgot to unplug your phone from the computer while the tablet was plugged in...
Please do some research if you have any concerns about rooting your device! YOU are choosing to make these modifications, and if you point the finger at me for messing up your device, I will laugh at you.
Ok, this was a pain in the arse!
I hope I can remember the steps I took in order to get this done.
By the way, I'm using windows
adb push mempodroid /data/local
adb push su /data/local
adb shell
$ chmod 777 /data/local/mempodroid
Click to expand...
Click to collapse
Then I went to here as directed,
http://rkeene.org/projects/info/wiki/210
but didn't follow the steps as they were shown because I got stuck many times and had to start over.
So here are my steps.
1.
$ /data/local/mempodroid 0xd9f0 0xaf47 sh
Click to expand...
Click to collapse
which then should turn the $ into a #
2.
# mkdir /data/x-root /data/x-root/bin
Click to expand...
Click to collapse
3. Download this,
http://www.rkeene.org/projects/info/resources/diatribes/root-toshiba-thrive/busybox
and then move the file to where you have mempodroid and su so you can adb push them easier
4.
adb push busybox /data/x-root/bin/busybox
adb push su /data/x-root/bin/su
adb shell
Click to expand...
Click to collapse
5. This is where it got tricky. If you don't pay close attention, you will most likely do what I did and put files where they aren't supposed to go. So please, PAY ATTENTION!
If you still have the # in the shell, move forward. Otherwise,
/data/local/mempodroid 0xd9f0 0xaf47 sh
Click to expand...
Click to collapse
and then move forward once # is confirmed.
# cd /data/x-root/bin
# chmod 755 busybox
# ./busybox bash
Click to expand...
Click to collapse
Now, there is no doubting it, you will get the "bash: precmd: not found" error.
# unset PS1 PROMPT_COMMAND
# ./busybox bash
# for tool in $(./busybox --list); do ln -s busybox $tool; done
# PATH="${PATH}:/data/x-root/bin"; export PATH
Click to expand...
Click to collapse
6. AGAIN, PAY CLOSE ATTENTION HERE!!
# mknod /dev/loop0 b 7 0
# losetup -o 25165824 /dev/loop0 /dev/block/mmcblk0
Click to expand...
Click to collapse
7. This is where I ran into another problem, so pay attention.
# cd /
# mkdir /dev/tmpdir
# ls -l /dev/tmpdir
Click to expand...
Click to collapse
You will see nothing as the steps describe. This is because we skipped a step. Why? Because mount -o ro -t ext4 /dev/loop0 /dev/tmpdir for some strange reason wouldn't unmount so I could mount the next step. So instead, we move on and then check again.
Here is the removed step
# mount -o ro -t ext4 /dev/loop0 /dev/tmpdir
# ls -l /dev/tmpdir
# umount /dev/tmpdir
Click to expand...
Click to collapse
You can try this but I advise not to or you could very well run into the same issue I had where you can't unmount in order to move on with the root process
# mount -t ext4 /dev/loop0 /dev/tmpdir
# ls -l /dev/tmpdir
Click to expand...
Click to collapse
And now you will see /system mounted.
8.
# cp /data/x-root/bin/su /dev/tmpdir/bin/
# chmod 4555 /dev/tmpdir/bin/su
# umount /dev/tmpdir
# losetup -d /dev/loop0
# sync
# reboot
Click to expand...
Click to collapse
9. Now once your A200 reboot and displays the home screen, we will confirm.
adb shell
[email protected]:/ $ su
Click to expand...
Click to collapse
If the $ doesn't turn into a #, you did something wrong...
Thank you hexmare, for opening this thread and giving the guidance.
Thank you d10369319, for "/data/local/mempodroid 0xd9f0 0xaf47 sh", I would have never figured this out.
Thank you RKeene, for writing out the guide to Root the Toshiba Thrive
And Thank you Saurik along with zx2c4, for mempodroid
Ok, for some reason, /system still refuses to mount with "mount -o remount,rw /system"
So my solution is this,
$ su
# cd /data/x-root/bin
# chmod 755 busybox
# unset PS1 PROMPT_COMMAND
./busybox bash
# PATH="${PATH}:/data/x-root/bin"; export PATH
# cd /
# mknod /dev/loop0 b 7 0
# losetup -o 25165824 /dev/loop0 /dev/block/mmcblk0
# mount -t ext4 /dev/loop0 /dev/tmpdir
Click to expand...
Click to collapse
You will have to go to /dev/tmpdir in order to do anything with /system but it is the secret passage way for now...
Why is there still no A200 forum?
agentfazexx said:
Why is there still no A200 forum?
Click to expand...
Click to collapse
Maybe there will be now that we have made some progress...
agentfazexx said:
Why is there still no A200 forum?
Click to expand...
Click to collapse
+1 A200 Forum
Enjoy your ICS A200 owners. I just saw a tweet from AcerAmerica that ICS is being rolling out to A200
Hello to all,
My A200 has been upgraded today 'OTA' , to ICS (V: 4.0.3) , so Europe/France seems to be available, now.
Applying this procedure, all goes fine, and my A200 is rooted.
I'm very happy
A lot of thanks to people having discovered this procedure, particularly mempodroid which set all of this possible.
Greetings
the last time when you do losetup -d /dev/loop0
returns No such device or address?????
ive been through it twice now
*EDIT* Nevermind I figured out my problem...I was typing in reboot instead of using the hardware power button. Got root now, sweet!
I am sooo glad we can now root the a200, but I cannot get mine to work. I have went through the steps 3+ times and had issues each time. I thought I had it twice and then tried Titanium backup root and it said it didn't work.
I can't see at all where I've gone wrong..
That's very strange because Titanium Backup works just fine for me...
rom toolbox pro doesnt work when changing numbers in kernel tweaks...numbers dont stick
titanium works though
ran into a mounting issue
i was attempting to root my A200 with the OTA ICS
first attempt i ran into an issue were i am unable to mount
# mount -t ext4 /dev/loop0 /dev/tmpdir
mount: invalid argument
so i then replaced ext4 to EXT4 and i then received error
# mount -t EXT4 /dev/loop0 /dev/tmpdir
mount: No such device
could some one please tell me where i went wrong thank you in advance
what i do wrong when i try adb push mempodroid /data/local i get evertime this here :/
D:\android-sdk-windows\platform-tools>adb push mempodroid /data/local
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: device not found
Click to expand...
Click to collapse
Ghorn
ghorn222 said:
what i do wrong when i try adb push mempodroid /data/local i get evertime this here :/
Ghorn
Click to expand...
Click to collapse
Go download the drivers from Acer's website for this device
johnsonj067 said:
i was attempting to root my A200 with the OTA ICS
first attempt i ran into an issue were i am unable to mount
# mount -t ext4 /dev/loop0 /dev/tmpdir
mount: invalid argument
so i then replaced ext4 to EXT4 and i then received error
# mount -t EXT4 /dev/loop0 /dev/tmpdir
mount: No such device
could some one please tell me where i went wrong thank you in advance
Click to expand...
Click to collapse
You have to follow the guide to the T or you will run into numerous problems and stop signs. Try again
daimerion said:
rom toolbox pro doesnt work when changing numbers in kernel tweaks...numbers dont stick
titanium works though
Click to expand...
Click to collapse
That's because we don't have a custom kernel yet. Just wait a little while.
Unfortunate the root isn't 100% cool my boot loader Is unlocked though.
Droid 3 bldr is locked down however changing numbers in rom toolbox works w/o custom kernals or modules.
http://www.acertabletforum.com/foru...iscussions/3649-how-unlock-boot-loader-4.html
^this Does work
su file?
This may be a stupid question, but where does one get the su file they're supposed to push to the tablet in the first step? I searched and searched, and finally found one that I downloaded, but when I tried this method with that su file, everything seems to work perfectly, but when I reboot and type su I get a segmentation fault. This is feels like something everyone knows but me, because every guide I can find that has anything to do with rooting from adb it seems the possession of an the su file is just assumed.
shwilson24 said:
This may be a stupid question, but where does one get the su file they're supposed to push to the tablet in the first step? I searched and searched, and finally found one that I downloaded, but when I tried this method with that su file, everything seems to work perfectly, but when I reboot and type su I get a segmentation fault. This is feels like something everyone knows but me, because every guide I can find that has anything to do with rooting from adb it seems the possession of an the su file is just assumed.
Click to expand...
Click to collapse
Did u use reboot command or the power button on the tab? It only worked for me when I used the power button to turn off then on
daimerion said:
Did u use reboot command or the power button on the tab? It only worked for me when I used the power button to turn off then on
Click to expand...
Click to collapse
I tried using the power button. Same result. Where did you get the su file from?

[Q] Installing package thru script

Hi Guys
I'm knocking my head over the wall since one week. I'm trying to write a sh script that could install apk from a folder located on sdcard.
Writing the script seems simple, but running it doesn't give me the attended result.
Here is my script :
Code:
!/system/bin/sh
if [ -f /data/200notrestored ]
then
if ! cat /proc/mounts | grep /mnt/sdcard
then
mount /dev/block/mmcblk0p1 /mnt/sdcard;
fi;
if ! cat /proc/mounts | grep /data
then
mount /data;
fi;
test=""
while [ "$test" == "" ]
do
sleep 3;
test=`busybox ps | grep systemui | grep -v "$(echo grep systemui)"`
done
for app in /sdcard/.apps/toinstall/*.apk
do
pm install -r $app;
done;
busybox rm -f /data/200notrestored
fi;
this script is located in /system/etc/init.d fodler and is then supposed to run during the boot.
I've seen that it is run, but not fully.
The command line
Code:
pm install -r $app;
seems to be not working at all.
I tried to replace this command by "cp" and then the package is well copied.
Why do I need to use "pm" command... simply because someapk does't support the "cp" command, and need a proper install to be run.
So here is my question :
has someone succeed in writing a script (run during boot) that install an apk ?
If yes , how ?
I know for example that the script works well on a DHD... why not on a Desire ?
Any help appreciate.
thx
Just for information
Running the script thru Termianl emulator works fine.
What can be the issue when the file is run at boot (put in init.d folder) ? What is the difference from runnihbgit at boot and in terminal ?
any idea ?
thx

Any fix BT MAC 41:49.. in STOCK ROM

Hi, there is a way to fix this problem? I cant use bluetooth with my GF and brother. all of us with LG E975.. Thanks in advance..
¿Help?
xjox said:
Hi, there is a way to fix this problem? I cant use bluetooth with my GF and brother. all of us with LG E975.. Thanks in advance..
Click to expand...
Click to collapse
Nope...!!
Forgive my ignorance, but what exactly are you trying to fix? I understand you somehow can't use BT, but what's wrong with the MAC address?
kt-Froggy said:
Forgive my ignorance, but what exactly are you trying to fix? I understand you somehow can't use BT, but what's wrong with the MAC address?
Click to expand...
Click to collapse
ya once unlocking the bootloader its mac is getting changed to 41:4E.... see faust kernel thread..he has mentioned this in his OP..
hasan4791 said:
ya once unlocking the bootloader its mac is getting changed to 41:4E.... see faust kernel thread..he has mentioned this in his OP..
Click to expand...
Click to collapse
Couldn't find the thread, sorry... My MAC is 41:4E, BL is unlocked. Still don't quite understand the problem, but don't want to hijack the thread. I'll go do some searching and reading...
kt-Froggy said:
Couldn't find the thread, sorry... My MAC is 41:4E, BL is unlocked. Still don't quite understand the problem, but don't want to hijack the thread. I'll go do some searching and reading...
Click to expand...
Click to collapse
ya he mentioned that in our devices BT loades its MAC form bootloader and we are using nexus bootloader to unlock it obviously something fissy is happening...!!
Hello, faust93 helped me with this problem, his response was to create a file with the following content in /etc/init.d
#!/system/bin/sh
BT_ADDR=$(/system/bin/btnvtool -p 2>&1 | awk '/address/ {print $2}' | awk -F "." '{print "\\x"$1 "\\x"$2 "\\x"$3 "\\x"$4 "\\x"$5 "\\x"$6}')
echo -ne $BT_ADDR | dd bs=1 seek=16384 of=/dev/block/platform/msm_sdcc.1/by-name/misc
and don't forget to setting rwx-r-xr-x permissions on this file (chmod 755 filename)
then reboot your phone, switch bt on and see if mac has changed.
thanks go to Mr. faust93. And Sorry for my english.
Enviado desde mi LG-E975 mediante Tapatalk
Cntauro said:
Hello, faust93 helped me with this problem, his response was to create a file with the following content in /etc/init.d
#!/system/bin/sh
BT_ADDR=$(/system/bin/btnvtool -p 2>&1 | awk '/address/ {print $2}' | awk -F "." '{print "\\x"$1 "\\x"$2 "\\x"$3 "\\x"$4 "\\x"$5 "\\x"$6}')
echo -ne $BT_ADDR | dd bs=1 seek=16384 of=/dev/block/platform/msm_sdcc.1/by-name/misc
and don't forget to setting rwx-r-xr-x permissions on this file (chmod 755 filename)
then reboot your phone, switch bt on and see if mac has changed.
thanks go to Mr. faust93. And Sorry for my english.
Enviado desde mi LG-E975 mediante Tapatalk
Click to expand...
Click to collapse
not working on CIS 10B ROM :crying:
christboanerges said:
not working on CIS 10B ROM :crying:
Click to expand...
Click to collapse
Use file inside this zip
rwx-r-xr-x permissions on this file (chmod 755 filename)
Cntauro said:
Use file inside this zip
rwx-r-xr-x permissions on this file (chmod 755 filename)
Click to expand...
Click to collapse
not change
====
instal busybox , restart now my mac bluetooth change
thanks bro :good:
Hey I've tried to type the 2 lines present in the script inside and adb hsell with root right,
My BT_ADDR env variable seem to take the good value 3D:42:91 .... and everything look to go good (no error) but this doesn't seem to work.
After rebooting my bt mac is again 41:4E ... blablabla...
Any idea why?
For info I'm running on E97510d-EUR-XX, and the build is JZO54K.
PS: Do I have to remound the partitions to be writable before doing the "echo -ne $BT_ADDR | dd bs=1 seek=16384 of=/dev/block/platform/msm_sdcc.1/by-name/misc" or just being root is enouth? I get no error from dd so I think I don't have to?
saq__d__aus said:
Hey I've tried to type the 2 lines present in the script inside and adb hsell with root right,
My BT_ADDR env variable seem to take the good value 3D:42:91 .... and everything look to go good (no error) but this doesn't seem to work.
After rebooting my bt mac is again 41:4E ... blablabla...
Any idea why?
For info I'm running on E97510d-EUR-XX, and the build is JZO54K.
PS: Do I have to remound the partitions to be writable before doing the "echo -ne $BT_ADDR | dd bs=1 seek=16384 of=/dev/block/platform/msm_sdcc.1/by-name/misc" or just being root is enouth? I get no error from dd so I think I don't have to?
Click to expand...
Click to collapse
Ya on reboot yu need to run that script
Sent from my LG-E975 powering Stock 4.1.2
nope stil not working, i'have tried before reboot, after reboort, with BT tunred on/off ... :/
Bluetooth MAC address...
All greetings!
Such problem appeared on smart phone LG E975 on which is installed CM 12.
At me generally writes it "is not known". At some writes 00:00:00:00:5a:ad.
How to solve? For KitKat the decision does not help.
Cntauro said:
Use file inside this zip
rwx-r-xr-x permissions on this file (chmod 755 filename)
Click to expand...
Click to collapse
thank you but can you help me to excute this script
I made a fix for this long time ago... Here's the thread :
http://forum.xda-developers.com/showthread.php?t=3076208

Categories

Resources