Fast Superuser for ICSROM [21 Feb 2013] - Atrix 4G Android Development

I may have fixed the lag in Root Explorer and other apps on ICSROM. No need to continue reading unless you also have this problem.
Not much in the way of Atrix rootin’ guides of late, so I downloaded Chainfire's latest UPDATE-SuperSU-v1.04.zip here: http://forum.xda-developers.com/showthread.php?t=1538053
Direct link: http://download.chainfire.eu/310/SuperSU/UPDATE-SuperSU-v1.04.zip
knowing that…
Chainfire quote: “ZIP does not work on all devices, needs fix. Note that if you are already rooted, installing through Market is by far the easiest way to install SuperSU !”
True to these sage words, the CWM install crashed. And /tmp/recovery.log showed no details.
So I switched to Ubuntu and tried the same thing. Same results.
So I opened the zip and found:
Reference to a /tools directory not contained in the zip
Many lines of code for manual deletion of superuser related files
Temporary rearrangement of heavyweight apps to make room for 2MB of superuser files
Broken update-binary
So I completely re-designed it.
Code:
/META-INF/com/google/android/updater-script:
assert(getprop("ro.product.device") == "olympus" || getprop("ro.build.product") == "olympus");
ui_print(" ");
ui_print("Fast Superuser for Atrix 4g ICS!");
ui_print("Initial Release: 21 Feb 2013");
ui_print("sendust7 @ xda-developers");
ui_print("Credits: Chainfire (SuperSU v1.04)");
ui_print(" ");
ui_print(" Removing old superuser files from /system, /cache,");
ui_print(" /data and /preinstall");
package_extract_file("find-rm-su.sh", "/tmp/find-rm-su.sh");
set_perm(0, 0, 0777, "/tmp/find-rm-su.sh");
run_program("/sbin/busybox", "sh", "/tmp/find-rm-su.sh", "/dev/block/mmcblk0p12","/system");
run_program("/sbin/busybox", "sh", "/tmp/find-rm-su.sh", "/dev/block/mmcblk0p15","/cache");
run_program("/sbin/busybox", "sh", "/tmp/find-rm-su.sh", "/dev/block/mmcblk0p16","/data");
run_program("/sbin/busybox", "sh", "/tmp/find-rm-su.sh", "/dev/block/mmcblk0p17","/preinstall");
ui_print(" ");
ui_print(" Mount /system and /data");
run_program("/sbin/busybox", "mount", "/system");
run_program("/sbin/busybox", "mount", "/data");
ui_print(" ");
ui_print(" Extract new superuser files");
package_extract_dir("system", "/system");
ui_print(" ");
ui_print(" Set permissions");
set_perm(0, 0, 06755, "/system/xbin/su");
set_perm(0, 0, 0644, "/system/app/Superuser.apk");
set_perm(0, 0, 0644, "/system/app/Supersu.apk");
ui_print(" ");
ui_print(" Unmount /system and /data");
unmount("/system");
unmount("/data");
ui_print(" ");
ui_print(" Done... Reboot and enjoy!");
and…
Code:
find-rm-su.sh:
#!/system/bin/sh
# Find and remove all instances of superuser in ROM
# sendust7 @ xda-developers
MOUNT_DEVICE=$1
MOUNT_POINT=$2
if [ -d "${MOUNT_POINT}" ]
then
echo "Directory: ${MOUNT_POINT} exists (OK)"
else
mkdir ${MOUNT_POINT}
fi
mount -t ext4 ${MOUNT_DEVICE} ${MOUNT_POINT}
/sbin/busybox find ${MOUNT_POINT} -name su -exec rm {} \;
/sbin/busybox find ${MOUNT_POINT} -name *[Ss][Uu]per[Ss][Uu]* -exec rm -r {} \;
/sbin/busybox find ${MOUNT_POINT} -name *[Ss][Uu]per[Uu][Ss]* -exec rm -r {} \;
umount ${MOUNT_POINT}
Superuser-Atrix-ICS-v1.0.zip: http://www.mediafire.com/?34tka3vjlfyj8fv
CWM flash and voila... root returns to ICSROM. And Root Explorer now opens in the blink of an eye.
Then I ported Superuser-Atrix-ICS to SD with a few small changes to updater-script:
Superuser-Atrix-ICS-v1.0-SD.zip: http://www.mediafire.com/?6d75i66d02liejh
Superuser-Atrix-ICS-v1.0.zip and Superuser-Atrix-ICS-v1.0-SD.zip are tested working on my dual boot configuration: ICSROM (EMMC) and MROM ICS (SD) --- though I didn’t see any improvement on MROM since root apps already load fast on it.
I have not observed any degradation in performance thus far.
Tips:
A second reboot may be needed to smooth things out.
If adb hangs after entering “su”, look at your phone and see if adb is requesting superuser. This one is easy to miss since we tend to be watching our adb computer screen instead of phone.
ICSROM 146 defaults to “USB connected as mass storage” so you can easily drag-drop files to/from computer. But for development I think it is better to initialize to “Media Device MTP” so apps like Root Explorer can access memory.
You can selectively turn off superuser notifications by going to SuperSU > Apps. This page displays apps that have already requested SU permission. Alternatively you can turn off SU request notifications globally with SuperSU Settings > Show notifications.
Lessons learned: Do what Chainfire says and download/install his SuperSU from Google Play, lol. OR... if you’re curious like me and want to know what’s going on inside the black box, you tear into the zip file and do it the hard way -- After all, that is often how we learn
Enjoy.
Credits: Chainfire (SuperSU)

Nice work. Keep it up.

saintmonte said:
Nice work. Keep it up.
Click to expand...
Click to collapse
I probably won't ever use this but I know that others surely will, and for that, YOU are the man sendust7!

constructive criticism:
You can use -iname In the find to make it case insensitive search.
Your searching the entire mount points which can take a while and is a bit dangerous. You only need to search /data/app and /system/app for apks.
you only need to search /system/*bin for su.
you should use -depth in your find to prevent cascading down directories.
The thing is your script still isn't universal because a developer can name the super user apk ANYTHING in their rom. just mentioning.
I commend for taking initiative though.
<ducks and runs>

calisro said:
constructive criticism:
You can use -iname In the find to make it case insensitive search.
Your searching the entire mount points which can take a while and is a bit dangerous. You only need to search /data/app and /system/app for apks.
you only need to search /system/*bin for su.
you should use -depth in your find to prevent cascading down directories.
The thing is your script still isn't universal because a developer can name the super user apk ANYTHING in their rom. just mentioning.
I commend for taking initiative though.
<ducks and runs>
Click to expand...
Click to collapse
Thanks for the CC...
Actually the -iname option is unnecessarily expansive since it would desensitize the "per" in Superuser and SuperSU.
Also it is necessary to search all mount points --- including preinstall --- since superuser apk's and binaries may be hiding there as well (see ICSROM ramdisk).
I deliberately did not use the -depth option for the reason given immediately above. The idea is to not only remove superuser files with ".apk" extension, but all data associated with them as well.
Finally, I did not intend for this version to be universal as it applies strictly to Atrix 4g running ICS. But I did post the source code to help explain what I did and to enable easier porting to another ROM or device.
Thanks again, and have a great day!

sendust7 said:
Thanks for the CC...
Actually the -iname option is unnecessarily expansive since it would desensitize the "per" in Superuser and SuperSU.
Also it is necessary to search all mount points --- including preinstall --- since superuser apk's and binaries may be hiding there as well (see ICSROM ramdisk).
I deliberately did not use the -depth option for the reason given immediately above. The idea is to not only remove superuser files with ".apk" extension, but all data associated with them as well.
Finally, I did not intend for this version to be universal as it applies strictly to Atrix 4g running ICS. But I did post the source code to help explain what I did and to enable easier porting to another ROM or device.
Thanks again, and have a great day!
Click to expand...
Click to collapse
sure...
I tested it for you but as you can see it will delete things it shouldn't.
# find / -name *[Ss][Uu]per[][Uu]*
system/app/Superuser.apk
data/data/com.android.browser/app_databases/localstorage/http_superuser.com_0.
alstorage
data/data/com.estrongs.android.pop/cache/.apps/s.system.app.Superuser.apk
data/data/com.estrongs.android.pop/cache/.apps/s.sdcard.AndroZip.system.app.Supuser.apk
data/data/com.estrongs.android.pop/cache/.apps/ssystem.app.Superuser.apk
data/data/eu.chainfire.exynosabuse/files/superuser.png
cache/dalvik-cache/[email protected]@[email protected]
I know your offended but I was just trying to help others not have unintended consequences.
You can search all mount points but you should narrow the scope down to required directories.
also rom developers will also call supersu SUPERSU.apk which why I mentioned iname.
oh well.
Thanks again.

calisro said:
sure...
I tested it for you but as you can see it will delete things it shouldn't.
# find / -name *[Ss][Uu]per[][Uu]*
system/app/Superuser.apk
data/data/com.android.browser/app_databases/localstorage/http_superuser.com_0.
alstorage
data/data/com.estrongs.android.pop/cache/.apps/s.system.app.Superuser.apk
data/data/com.estrongs.android.pop/cache/.apps/s.sdcard.AndroZip.system.app.Supuser.apk
data/data/com.estrongs.android.pop/cache/.apps/ssystem.app.Superuser.apk
data/data/eu.chainfire.exynosabuse/files/superuser.png
cache/dalvik-cache/[email protected]@[email protected]
I know your offended but I was just trying to help others not have unintended consequences.
You can search all mount points but you should narrow the scope down to required directories.
also rom developers will also call supersu SUPERSU.apk which why I mentioned iname.
oh well.
Thanks again.
Click to expand...
Click to collapse
Thanks! I will have another look at the zip in light of all your comments.
BTW, I am not offended

sendust7 said:
Thanks! I will have another look at the zip in light of all your comments.
BTW, I am not offended
Click to expand...
Click to collapse
thx Sendust. I'm sorry I assumed you may be. :beer:

Related

[INFO] Edify scripts in CWM recovery

Hi, I haven't seen any good resources for how to edit edify scripts, so I thought I would create this thread so we can pool our knowledge on the subject.
Intro
Inside your typical CWM zip there is a folder called META-INF, inside that there is a folder called com and come CERT files, inside that com folder there is a google folder, inside that is an android folder containing an update-binary file and an updater-script. If you only see an update-script, that means you are back in the Android 1.5 era and need to move on.
The updater-script
The updater-script file is a text file, it is linux formatted with regard to end of line conventions. If you use Windows then you have to edit the file using a program that keeps line feeds the way they are and has options for doing the conversion from <CR><LF> to just <LF>.
Like lisp, the contents of the text file evaluate to one big expression, but it does have the ";" end of command convention to make things more familiar, it just means perform the action on the left. (ref. google source README) You can ignore that and just treat everything as a series of commands for all practical purposes. I mention it because you need not worry about having too large a procedural block or worry about having extra spaces or worry about ending on a line boundary. You could have your entire script on one giant line and it wouldn't matter.
There are around a dozen commands, it's not terribly difficult to learn.
The updater-binary
There are a lot of updater-binary files out there in the wild, each manufacturer basically compiles there own with every other OTA update. Success in flashing your CWM zip is determined by picking the right one that works with what you are trying to do. If your knowledge says mount needs 4 arguments and the binary only supports 3, then you need to change your script to use 3 and vice versa. If you are trying to flash a radio, the updater-binary might have been recompiled to allow for that specific functionality and you will get a status 6 error when trying to flash it unless you use that update-binary. You will see the write_raw_image() function not supporting "/dev/block/mmcblk0p8" but instead "logo.bin".
However, by and large, the generic functionality is the same across the board.
​Updater-script functions (In order of interest)​
ui_print(msg1, .. msgN); This is the means you have to display something on the screen in CWM, it takes a series of comma separated arguments, each comma needs to have a space after it, this applies to all commands.
Ex. ui_print("Your version is: ", file_getprop("/system/build.prop", "ro.build.id"));
show_progress(TOTALAMOUNT, TIMEINSEC); This command and the following command control what you see in the progress bar at the bottom. It is not necessary to use it, it's just another way to display information.TIMEINSEC refers to how long it will take for the progress bar to move to the AMOUNT specified. You would use this perhaps when something is taking a long time, you know approximately how long and want the screen to keep showing something while it is going on. If you use zero for TIME then nothing is done, you have just set the maximum amount for use with set_progress. The amount is a decimal number, 0.5 would be half the progress bar being filled.
Ex. show_progress("0.300000", 10);
set_progress(AMOUNT); This command sets the pointer or fill amount of the progress bar according to the last show_progress command. It should never be greater than the total of the show_progress amount.
Ex. show_progress("0.300000", 0);
set_progress("0.15");
mount(TYPE, DEV, PATH); This is one version of the mount command. The TYPE arg is usually "MTD", which refers to memory technology device. The DEV for a MTD would be something like "system", "userdata", "cache", and the PATH would be "/system", "/data", or "/cache". You will also see TYPE be "vfat".
mount(FSTYPE, TYPE, DEV, PATH); This seems to be the more current mount command. It adds in the file system type. Ex. "ext3", "yaffs". TYPE with this command can be "MTD" or "EMMC". You would use "EMMC" with "/dev/block/mmcblk0p8".
umount(PATH); This simply removes a previous mounted PATH from the system. Ex. umount("/system"); You'll notice the double quotes around command arguments, they are not strictly necessary. Unless it's a reserved word (if then else endif) then they can be anything. "consisting of only letters, numbers, colons, underscores, slashes, and periods". So if you just spend 10 minutes uploading your zip to your phone and notice that your unmount command is umount(/system);, it will work just fine.
sleep(SECS); Simply pauses for SECS seconds.
package_extract_file(FILE, FILEWITHPATH); This command extracts one of your files from the CWM zip package and save it to the phone.
Ex. package_extract_file("bootanimation.zip", "/system/media/bootanimation.zip");
package_extract_dir(ZIPPATH, PATH); This command extracts an entire folder in your CWM zip to a folder on your phone.
Ex. package_extract_dir("system", "/system"); *This is where having system mounted would be handy, without it being mounted, the files would be copied to the ramdisk /system.
write_raw_image(PATH, PARTITION); This is one of those tricky ones, the PATH is somewhere on your phone with the image to be flashed to a PARTITION on your phone. The trouble is, how do you specify what partition gets flashed? Is there any restriction on where the file has to be? If MTD conventions are used, you are looking for "system", "boot", "recovery", "logo.bin". (All this means that each partition has a name stored somewhere, and if you know it, you can write to it.) Maybe it will accept device references like /dev/block/mmcblk0p8. This depends on the update-binary file you are using.
Ex. write_raw_image("/tmp/logo.bin", "logo.bin");
Ex. write_raw_image("/tmp/logo.bin", "/dev/block/mmcblk0p8");
write_firmware_image(PATH, PARTITION); You would think it would be the same as write_raw_image. Not sure what the difference is.
run_program(PROG, ARG1, .., ARGN); Pretty self explanatory, This command allows you to execute a program or script on the phone. Instead of all the bits of the command being separated by spaces, commas are used. It returns an error code as a string.
Ex. run_command("ls", "-R", "/system");
Assert(condition); You'll see this one a lot in OTA updates, all it does is abort the script if something goes wrong. If condition is false, the script ends displaying a description on the phone of what command caused the exit. You can put in more than one statement here, separated by ";", if any one of them returns with an error, the script exits.
Ex. Assert(mount("ext3", "EMCC", "/dev/block/mmcblk0p12", "/system")); *If you can't mount /system and your CWM zip only writes to system, you might as well stop it before continuing on to write to the ramdisk.
ifelse(condition, true path, false path); This is your basic conditional statement, the tricky bit is to figure out what statements in edify can trigger a true of false condition. As for the rest of it, the commas separate the two blocks.
Ex. ifelse(file_getprop("/system/default.prop", "ro.build.id") == "OLYFR1.2.3.4", ui_print("yes"), ui_print("false"));
abort(); This stops the script, useful with ifelse.
file_getprop(PATH, VALUE); This command looks for a text file containing A=B pairs and returns B if it can find an A.
Ex. file bob.txt exists in /tmp, it contains cool=yes, and dorky=true123 each on separate lines.
file_getprop("/tmp/bob.txt", "cool") == "yes"
file_getprop("/tmp/bob.txt", "dorky") == "true123"
getprop(VALUE); Functions the same as file_getprop, without the file part. It looks through the system value pairs for a matching value.
Ex. getprop("ro.build.id") == "OLYEM1.2.3.4"
delete(PATH1, ...,PATHN); Nothing to see here, just a delete command, full path to the file(s) as argument(s).
delete_recursive(PATH1, ...,PATHN); It's a delete everything in a folder, including subfolders command. The folder itself is deleted as well.
set_perm(UID, GID, MODE, PATH1, ..., PATHN); Set the linux permissions on a file, ownership and flags at the same time. Equivalent to chown and chmod in the one command.
Ex. set_perm(0, 0, 06755, /system/bin/su, /system/bin/shsu); *0 stands for root, so it would be owned by root, of the group root, with suid bit set and standard executable bits set.
set_perm_recursive(UID, GID, DIRMODE, FILEMODE, PATH1, ...,PATHN); Same as above except with folders instead of files. Use the DIRMODE to set the permissions and ownership of the folders themselves, and FILEMODE to set the permissions of the files within them.
symlink(TARGET, LINK1, ...,LINKN); It's the equivalent to the linux ln -s command. For our purposes, it might as well be called busybox install.
Ex. symlink("/system/bin/busybox", "/system/bin/awk", "/system/bin/wget", "/system/bin/sed");
To Be Continued..
​
References
http://devphone.org/development/edify-script-syntax-explained/
http://www.synfulgeek.com/main/index.php/articles/76-scratchpad-documenting-edify-commands-for-android-updater-scritps-based-off-of-kernel-source-code
https://github.com/koush/android_bootable_recovery/blob/eclair/edify/README
http://tjworld.net/wiki/Android/UpdaterScriptEdifyFunctions​
Tips:
You can use the abort() command to step through your updater script, for instance if you wanted to check various combinations on syntax for write_raw_image();
In /tmp there is a text file called recovery.log, do a cat /tmp/recovery.log to see extra output of your script from failed commands.
NFHimself said:
The updater-script file is a text file, it is linux formatted with regard to end of line conventions. If you use Windows then you have to edit the file using a program that keeps line feeds the way they are and has options for doing the conversion from <CR><LF> to just <LF>.
Click to expand...
Click to collapse
If you are in windows, I have found that notepad++ does the job just fine.
http://notepad-plus-plus.org/
what about the FORMAT command?
actually i have error on a CM installation, its says
Code:
format() expects 3 args, got 2.
but my format command have 3 args:
Code:
format("ext4", "/dev/block/mmcblk0p10", "/system");
NFHimself said:
Hi, I haven't seen any good resources for how to edit edify scripts, so I thought I would create this thread so we can pool our knowledge on the subject.
Intro​
Click to expand...
Click to collapse
Thanks for this... but I do have a question....
I am attempting to see if busybox is installed on a device, and if not install it, or proceed
so, so far I have:
Code:
ifelse(
BUSYBOX DOESNT EXIST,
(
ui_print("* Did not find it. Installing...");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
symlink("/system/xbin/busybox", "/system/bin/busybox");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");
),
(
ui_print("* Found it. Proceeding...");
)
);
You can see where I'm lost I was thinking of using assert to run_program("/system/xbin/busybox", "vi", "/system/xbin"); just as a simple check... but from what I can see, if the assertion fails it will stop the script, and print out the failure message, which of course is not what I am after here... or maybe I am, can it be used to do a check rather than stop the script?​
Just an idea (ie. untested):
Code:
ifelse(
run_program("/system/bin/sh", "-c", "test -e /system/xbin/busybox")
...
)
ravilov said:
Just an idea (ie. untested):
Code:
ifelse(
run_program("/system/bin/sh", "-c", "test -e /system/xbin/busybox")
...
)
Click to expand...
Click to collapse
trying to run that in adb sheel, and don't get a response, but it does seem like a good idea... I assume Edify would return a 1/0 or true/false string from it, and I can just check for that?
EDIT: Maybe I do get something back... after running that in adb shell my next line looks like the following:
Code:
1|[email protected]:/ #
Am I right in assuming that "1" is the output?
Yes. The command won't ever return any output, it only returns the exit status. Your shell is obviously set so it includes a non-zero exit status in the prompt. (Non-zero traditionally means error.)
ravilov said:
Yes. The command won't ever return any output, it only returns the exit status. Your shell is obviously set so it includes a non-zero exit status in the prompt. (Non-zero traditionally means error.)
Click to expand...
Click to collapse
that prompt means that the test failed, and I don't have busybox installed?
I'm just a tad confused... (this is my first full-on edify script), and I do have busybox installed
I appreciate the help, and once I get my tapatalk working right on my phone, I'll give ya all the "thanks" for the help with this
Eh... everything I 'test' returns the same thing
Code:
1|[email protected]:/ #
Hm, weird. It works for me...
Code:
# /system/bin/sh -c 'test -e /system/xbin/busybox'; echo $?
0 [color=silver]<-- no error - file exists[/color]
# /system/bin/sh -c 'test -e /system/xbin/busybox1'; echo $?
1 [color=silver]<-- error - file does not exist[/color]
I didn't try it in an edify script because I don't feel like rebooting my phone right now, but I don't see why it wouldn't work.
Try running the "sh -c test ..." command in adb shell while in recovery and see what happens.
Also, just a side note: backslash is NOT the same as slash. If you are going to write shell/edify scripts, you need to know at least that distinction. That is why your
Code:
tags are not working right.[/b][/i][/size]
ravilov said:
Hm, weird. It works for me...
Code:
# /system/bin/sh -c 'test -e /system/xbin/busybox'; echo $?
0 [color=silver]<-- no error - file exists[/color]
# /system/bin/sh -c 'test -e /system/xbin/busybox1'; echo $?
1 [color=silver]<-- error - file does not exist[/color]
I didn't try it in an edify script because I don't feel like rebooting my phone right now, but I don't see why it wouldn't work.
Try running the "sh -c test ..." command in adb shell while in recovery and see what happens.
Also, just a side note: backslash is NOT the same as slash. If you are going to write shell/edify scripts, you need to know at least that distinction. That is why your
Code:
tags are not working right.[/b][/i][/size][/QUOTE]
I see, I wasn't doing the echo, and what you posted shows exactly what you posted. DOH on the CODE :good:
So I have it on record (for my own personal reference)
[CODE]
ifelse(
((run_program("/system/bin/sh", "-c", "test -e /system/xbin/busybox; echo $?") == 1 ||
(run_program("/system/bin/sh", "-c", "test -e /system/bin/busybox; echo $?") == 1 ||
(run_program("/system/bin/sh", "-c", "test -e /system/xbin/busibox; echo $?") == 1 ||
(run_program("/system/bin/sh", "-c", "test -e /system/bin/busibox; echo $?") == 1),
(
ui_print("* Did not find it. Installing...");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
symlink("/system/xbin/busybox", "/system/bin/busybox");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");
),
(
ui_print("* Found it. Proceeding...");
)
);
and yes, I meant the 'busibox' part, because I have seen that in some roms
Click to expand...
Click to collapse
You guys know way more about this stuff than I do... although i am a programmer
could I get some insight over here: http://forum.xda-developers.com/showthread.php?t=2796055
having an issue getting my shell scripts to actually run...
Rockin' it from my Smartly GoldenEye 35 NF1 (muchas gracias:* @iB4STiD @loganfarrell @muniz_ri @Venom0642 @ted77usa @rebel1699* @iB4STiD) ~ 20GB free cloud https://copy.com?r=vtiraF
Check me out online @ http://kevin.pirnie.us
note: the scripts do run in adb shell
published API docs
NFHimself said:
Hi, I haven't seen any good resources for how to edit edify scripts, so I thought I would create this thread so we can pool our knowledge on the subject.
Click to expand...
Click to collapse
I found some official documentation of the API on the Android Web site here:
https://source.android.com/devices/tech/ota/inside_packages.html
NFHimself said:
[*]write_raw_image(PATH, PARTITION); This is one of those tricky ones, the PATH is somewhere on your phone with the image to be flashed to a PARTITION on your phone. The trouble is, how do you specify what partition gets flashed? Is there any restriction on where the file has to be? If MTD conventions are used, you are looking for "system", "boot", "recovery", "logo.bin". (All this means that each partition has a name stored somewhere, and if you know it, you can write to it.) Maybe it will accept device references like /dev/block/mmcblk0p8. This depends on the update-binary file you are using.
Ex. write_raw_image("/tmp/logo.bin", "logo.bin");
Ex. write_raw_image("/tmp/logo.bin", "/dev/block/mmcblk0p8");
[*]write_firmware_image(PATH, PARTITION); You would think it would be the same as write_raw_image. Not sure what the difference is.
Click to expand...
Click to collapse
I didn't do a line by line comparison between your description and theirs, but I noticed this part because I was trying to find information about these functions. Only write_raw_image() is a published API function. This is the description:
write_raw_image(filename_or_blob, partition)
Writes the image in filename_or_blob to the MTD partition. filename_or_blob can be a string naming a local file or a blob-valued argument containing the data to write. To copy a file from the OTA package to a partition, use: write_raw_image(package_extract_file("zip_filename"), "partition_name");​
Probably write_firmware_image() is used internally. It could be removed at any time, or it even could be a stub - not a good idea to use it.

[Q] Bionic Update Script - In Bootstrapper

I'm attempting to make an install script for a couple of mods just as before on the Droid X. Unfortunately I'm getting different errors at different times. One of the errors is (Status 0)... and the other is (Status 6).
Also, Mount says that it expects 4 args, got 3.
What changed?
nitro66215 said:
I'm attempting to make an install script for a couple of mods just as before on the Droid X. Unfortunately I'm getting different errors at different times. One of the errors is (Status 0)... and the other is (Status 6).
Also, Mount says that it expects 4 args, got 3.
What changed?
Click to expand...
Click to collapse
You need to use the right Syntax to mount /system . Best way... Busybox.
run program("/sbin/busybox" , "mount", "/system");
DroidTh3ory said:
You need to use the right Syntax to mount /system . Best way... Busybox.
run program("/sbin/busybox" , "mount", "/system");
Click to expand...
Click to collapse
So... I've tried this.... and I get....
Error in /sdcard/update.zip
(Status 6)
For Shi*s and giggles... I just did a test script.
ui_print(" ");
ui_print("Mount Bionic Script...");
run_program("/sbin/busybox", "mount", "/system");
ui_print("Doing Something.......");
ui_print("Installing Files");
ui_print(" ");
ui_print("** Unmounting System **");
unmount("/system");
This errors out. I have the META-INF folder from another Bionic update that someone else created, so I'm assuming that the files within (other than the script) will work as is.
Here is my mod script and update-binary. Make the appropriate folders for your mod and give it a go.
Case and spacing is essential as I am sure you know.
3G ICON VISUAL FIX
DroidTh3ory said:
Here is my mod script and update-binary. Make the appropriate folders for your mod and give it a go.
Case and spacing is essential as I am sure you know.
3G ICON VISUAL FIX
Click to expand...
Click to collapse
ui_print(" ");
show_progress(0.800000, 35);
ui_print(" ");
ui_print("** Mounting this ***** **");
run_program("/sbin/busybox", "mount", "/system");
ui_print(" ");
ui_print("** Installing Your MOD **");
ui_print(" ");
ui_print("** Unmounting System, Rock Out!! **");
unmount("/system");
show_progress(0.050000,0);
Ugh... same error. I only deleted your package extract. I'm using 7-zip and just doing store. Is that still the preferred method?
nitro66215 said:
ui_print(" ");
show_progress(0.800000, 35);
ui_print(" ");
ui_print("** Mounting this ***** **");
run_program("/sbin/busybox", "mount", "/system");
ui_print(" ");
ui_print("** Installing Your MOD **");
ui_print(" ");
ui_print("** Unmounting System, Rock Out!! **");
unmount("/system");
show_progress(0.050000,0);
Ugh... same error. I only deleted your package extract. I'm using 7-zip and just doing store. Is that still the preferred method?
Click to expand...
Click to collapse
What is it installing if there is no package extract?
I don't use 7zip, I just compress in linux... Couldn't really say in that.
DroidTh3ory said:
What is it installing if there is no package extract?
I don't use 7zip, I just compress in linux... Couldn't really say in that.
Click to expand...
Click to collapse
I plan on doing the install later, but I just wanted to do a test script without install. Just some "Hello World" text to make sure I got something going on.
I even just did that....
ui_print("Hello World");
Gave me the same error!
Ok.... so.... It is now working after a reboot of Recovery. Don't ask me why. And I am using standard windows zipping.

[DEV/Add-On]bash for android.

Hello all.
This is my first share at the Android forums:
On my first device -- Samsung Galaxy S2 - I9100 Intl. -- I have BASH shell, so I've got used to working with it so i was missing it on my second device -- LG Nexus 4 -- the installer from the market was not working on the last one...
So I've remembered seeing here a post by nubecoder saying he compiled bash 4.2.2 for android, ang gave it a shot, but it was not working as expected on my device...
I've decided to recreate it for my Nexus 4.
All credit goes to nubecoder, I've only re-created the ZIP installer.
So, I hope someone else will enjoy nubecoder (I've tested it on my device and it is working) work remake by me.
Highlights and remarks are most welcome...
1.1:
Fixed mounting order error...
If it worth a donation, PM me and I'll give my paypal donation details (I have not done it ever, so when it will be relevant, I will...)
dmagician said:
Hello all.
This is my first share at the Android forums:
On my first device -- Samsung Galaxy S2 - I9100 Intl. -- I have BASH shell, so I've got used to working with it so i was missing it on my second device -- LG Nexus 4 -- the installer from the market was not working on the last one...
So I've remembered seeing here a post by nubecoder saying he compiled bash 4.2.2 for android, ang gave it a shot, but it was not working as expected on my device...
I've decided to recreate it for my Nexus 4.
All credit goes to nubecoder, I've only re-created the ZIP installer.
So, I hope someone else will enjoy nubecoder (I've tested it on my device and it is working) work remake by me.
Highlights and remarks are most welcome...
If it worth a donation, PM me and I'll give my paypal donation details (I have not done it ever, so when it will be relevant, I will...)
Click to expand...
Click to collapse
thank you for this! i tried to install it. however i am running in to some problems. the installation partially fails with twrp. the update script tries to set the permission on some files in /data/local but the files are not there:
Code:
set_perm(0, 2000, 0666, "/data/local/.bash_history");
set_perm(0, 2000, 0666, "/data/local/.editor");
set_perm(0, 2000, 0666, "/data/local/.inputrc");
set_perm(0, 2000, 0666, "/data/local/.minttyrc");
these files are in the zip, but no permissions are set via the update-script:
Code:
.bashrc
.bashrc_support
.bashrc_user
.profile
can you help me out?
-- 1st Reserved --
-- 1st Reserved --
-- 2nd Reserved --
-- 2nd Reserved --
Fixed -- I Hope
UnitedOceanic said:
thank you for this! i tried to install it. however i am running in to some problems. the installation partially fails with twrp. the update script tries to set the permission on some files in /data/local but the files are not there:
Code:
set_perm(0, 2000, 0666, "/data/local/.bash_history");
set_perm(0, 2000, 0666, "/data/local/.editor");
set_perm(0, 2000, 0666, "/data/local/.inputrc");
set_perm(0, 2000, 0666, "/data/local/.minttyrc");
these files are in the zip, but no permissions are set via the update-script:
Code:
.bashrc
.bashrc_support
.bashrc_user
.profile
can you help me out?
Click to expand...
Click to collapse
Fixed mounting.
Explanation:
The data partition was mounted AFTER expanding contents, so the content was lost on mounting data partition.
Some changes failed
Hi there, I've tried to apply it on my N4 (4.4.2 stock with MultiROM, Dalvik / Bionic patches and 4Way Reboot / Volume Wake) and I got stuck in an error.
Here is my log:
* Mounting '/system'
* Mounting '/data'
/data is already mounted.
Extracting files
minzip: Extracted 318 file(s)
minzip: Extracted 2 file(s)
Setting permissions on /system/xbin/bash4.2.0.1
Setting different instalation shell scripts to be used...
about to run program [/sbin/sh] with 2 args
Creating 'b' shell excutable file for quick launching BASH
in /system/bin/
run_program: child exited with status 1
Created '/system/bin/b'
Creating symlink for BASH as /system/bin/bash
Setting permissions on directories:
/system/etc/terminfo
Setting permissions for /system/etc/bash.bashrc
and /system/etc/profile
Creating symlink for BASH as /system/xbin/bash
Settings '/data/local' owner to UID to 0 (root) and GID to 2000 (shell)
Settings '/data/local' owner to UID to 0 (root) and GID to 2000 (shell)
Settings permissions on '/data/local/bin' to 0755 (a=rwx)
Settings permissions on '/data/local/sbin' to 0755 (a=rwx)
Settings permissions on '/data/local/xbin' to 0755 (a=rwx)
Settings permissions on '/data/local' to 0755 (u+rwx,go+rx)
set_perm: chown of /data/local/.bash_history to 0 2000 failed: No such file or directory
set_perm: chmod of /data/local/.bash_history to 666 failed: No such file or directory
script aborted: set_perm: some changes failed
Settings permissions on '/data/local/.*' to 0666 (a=rw)
set_perm: some changes failed
E:Error executing updater binary in zip '/sdcard/Bash4.2.x-Installer(Nexus4)-v1.1.zip'
Error flashing zip '/sdcard/Bash4.2.x-Installer(Nexus4)-v1.1.zip'
Updating partition details...
Iata backup size is 2098MB, size: 13231MB, used: 8904MB, free: 4326MB.
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Set page: 'flash_done'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'settings'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'advanced'
I:Set page: 'confirm_action'
I:Set page: 'action_page'
I:Copying file /tmp/recovery.log to /data/media/0/recovery.log
Click to expand...
Click to collapse
Thank you for your help!
@dmagician thank you for the update. i just noticed the zip files contains ssh, scp, vim, nano, 7z and more :good::good: thats really aewsome!
i took a look at the scripts and i can't find anywhere a reference to these files.
Code:
/data/local/.bash_history
/data/local/.editor
/data/local/.inputrc
/data/local/.minttyrc
i need your help configuring bash. if i start bash from the default shell with "bash" the profiles is not loaded. is it possible to "symlik bash to "bash -l"? the
@Grushteniak
easiest quick fix
open terminal add this commands:
Code:
su
cd /data/local/
touch .editor
touch .inputrc
touch .minttyrc
after that flash the zip again
Worked now
@UnitedOceanic
I have created the files you asked and I had to create the '.bash_history' file too.
After that, successfully flashed it. Thank you for your help!
UnitedOceanic said:
@dmagician thank you for the update. i just noticed the zip files contains ssh, scp, vim, nano, 7z and more :good::good: thats really aewsome!
i took a look at the scripts and i can't find anywhere a reference to these files.
Code:
/data/local/.bash_history
/data/local/.editor
/data/local/.inputrc
/data/local/.minttyrc
Click to expand...
Click to collapse
These are mainly not required (I think I've packed them accidentally...), the files .bash_history and .editor are created automatically, so all of these can be safely deleted (from the device).
I will remove then sometime later - when I'll have some free time - from the ZIP...
UnitedOceanic said:
i need your help configuring bash. if i start bash from the default shell with "bash" the profiles is not loaded. is it possible to "symlik bash to "bash -l"? the
Click to expand...
Click to collapse
1st:
You can't...
Unless it is a multi-call binary like BusyBox (I'm not Linux expert... but as of my understanding -- By far: Any EXPERT that knows Linux better than me, PLEASE: Correct me if I'm wrong) -- You cannot link a binary with its switches in any way...
You can only link the the binary itself, any command line switch should be via the command line or shell script.
2nd:
There should be a small executable shell script named “b” located in /system/bin/ (its whole target is executing “/system/xbin/su -c /system/bin/bash --login” -- for ease of running and saving some taps).
Check if it exists, as the installer itself SHOULD have created it.
In case the file does not exist, you can try the following:
Open terminal emulator - any of those are good:
If you don't have any terminal emulator installed and/or don't want to install one...
ADB shell
PuTTY Tray - by Chris West (Faux):good:<--strongly recommended
If you have one installed already, open it.
If you don't have any (and/or you want one to be always available to you), IT'S TIME TO GET ONE
Open Google Play Store and search "terminal emulator", pick one and install it.
Then execute (one by one):
In case of using ADB command (option 1 listed above)
Code:
adb root
adb remount
In case of using terminal emulator (e.g. any one of options 2 or 3 as listed above)
Code:
su
mount -o remount,rw /system
and the rest: (if using ADB (e.g. option 1 listed above), prefix the commands with "adb shell" noobs: [no quotes, and with trailing space])
Code:
cd /system/bin
rm /system/bin/b
echo '#!/system/bin/sh' > /system/bin/b
echo '/system/xbin/su -c /system/bin/bash --login' >> /system/bin/b
chown 0.0 /system/bin/b
chmod 0755 /system/bin/b
remount -o remount,ro /system
exit
In some (pretty rare - I believe...) cases, you may need to add /sbin/busybox or /system/xbin/busybox
before the commands above:
As exmple, line 3:
instead of echo '#!/system/bin/sh' > /system/bin/b would be something like
/system/xbin/busybox echo '#!/system/bin/sh' > /system/bin/b​OR
/sbin/busybox echo '#!/system/bin/sh' > /system/bin/b​
UnitedOceanic said:
easiest quick fix
open terminal add this commands:
Code:
su
cd /data/local/
touch .editor
touch .inputrc
touch .minttyrc
after that flash the zip again
Click to expand...
Click to collapse
If so, (and I'm not sure of it because you are basically extracting files from a ZIP archive to location and then executing commands over them... BUT I'm neither Linux nor Edify expert... Enlightments, Corrections and Learning new things ARE ALWAYS welcome!), It is good to know that executing touch on the files will cause the installer to forcibly update them...
You meant "execute these commands" not "add this commands" -- right?
Sorry, I've misunderstood -- You ware CREATING the file by the touch command, NOT CHANGING DATE/TIME....
Could I ask what does this do? Isnt this the same thing that we can have using terminal emulator?
bamsbamx said:
Could I ask what does this do? Isnt this the same thing that we can have using terminal emulator?
Click to expand...
Click to collapse
It is not related to terminal emulator itself, but to the underlying Android shell layer.
To be specific:
It is adding SOME of the advanced BASH style capabilities to Android's shell scripting.
SOME - since not ALL (as I remember, but the most important and used, do exist) - of bash capabilities are implemented in this (small) binary.
It is an alternative to the Android's basic shell.
dmagician said:
It is not related to terminal emulator itself, but to the underlying Android shell layer.
To be specific:
It is adding SOME of the advanced BASH style capabilities to Android's shell scripting.
SOME - since not ALL (as I remember, but the most important and used, do exist) - of bash capabilities are implemented in this (small) binary.
It is an alternative to the Android's basic shell.
Click to expand...
Click to collapse
Thanks for the quick reply!!!
I do not understand too much about linux...
Could you tell me some examples of how this would benefit us??
Thanks
bamsbamx said:
Thanks for the quick reply!!!
I do not understand too much about linux...
Could you tell me some examples of how this would benefit us??
Thanks
Click to expand...
Click to collapse
It is mainly used by users - some may add - who've rooted their devices, - and ment as a low level for doing stuff that cannot be done via GUI (graphical user interface).
This is what you probably know as "hacking" - not necessarily for doing bad suff,
but for low level control of the device or for learning purposes.

[SOLVED] Can't install the 1.1 update.zip - "Installation Aborted"

Okay guys I will come straight to the point... 5 days back I announced that I will release an update for Sami OS.. In fact I was uploading the zip file.. but while uploading the zip I decided to flash the zip and try it out by myself in my phone and IT DID NOT WORK!
This is exactly what CWM says:
Code:
Installing: /sdcard/SOS_UPDATE_1.1.zip
Finding update package...
Opening update package...
Installing update...
Installation aborted.
And this is what TWRP says:
Code:
Installing '/external_sd/SOS_UPDATE_1.1.zip'...
Checking for MD5 file...
I:Cannot find file /external_sd/SOS_UPDATE_1.1.zip.md5
Skipping MD5 check: no MD5 file found.
Error flashing zip '/external_sd/SOS_UPDATE_1.1.zip'
Updating partition details...
As you can see, I tried flashing my zip file in both recoveries.. TWRP says "Failed" in Red color and CWM says "Installation aborted"..
I've attached recovery.log file from both TWRP and CWM.. I've also uploaded the entire zip file (33 MB) and its updater-script... So can anyone please take a look at them and tell me what's wrong and is causing this issue... PS: I've tried all my modified apks and jars separately in my phone and they all worked without any errors...
LINKS:
- http://www.mediafire.com/view/ticvtrx7w81s58a/recovery_TWRP.log
- http://www.mediafire.com/view/ni778ths21indzw/recovery_cwm.log
- http://www.mediafire.com/download/scpk5z4cb1pu52y/updater-script
- http://www.mediafire.com/download/t73a89f92812j35/SOS_UPDATE_1.1.zip
Thanks in advance
META-NF?!
I would add a "I" (I'm gonna try in some seconds, but should be that)
(You wrote a lot in updater-script, many things are not necessary)
Sent from Italy using Tapatalk
Toni5830 said:
META-NF?!
I would add a "I" (I'm gonna try in some seconds, but should be that)
(You wrote a lot in updater-script, many things are not necessary)
Sent from Italy using Tapatalk
Click to expand...
Click to collapse
HOLY SH*T!
LOL I DID NOT NOTICE THAT AT ALL!! Thanks man
Anyways what can I remove from my updater-script to trim or shorten it?
Sami Kabir said:
HOLY SH*T!
LOL I DID NOT NOTICE THAT AT ALL!! Thanks man
Anyways what can I remove from my updater-script to trim or shorten it?
Click to expand...
Click to collapse
LOL .
You don't need to delete every file you are updating as these will be overwritten (here my example https://www.dropbox.com/s/jm6u0istpqxvj5b/updater-script ) I also added a line to delete a lib file, polaris*something*.so (11mb), you won't need it if you delete polaris viewer
I could not test because editing updater-script whit phone caused a different error: status 6, I'm redownloading it, having a shower and then I'll try
(I flashed your rom this afternoon, I see you've worked a lot on it to change graphic and modding apk (wait me, I'll pm you when I'll need to disable animation from toggles ))
Sent from Italy using Tapatalk
iiD4x said:
LOL .
Click to expand...
Click to collapse
I'm a human.. and humans do make mistakes :silly:
Toni5830 said:
You don't need to delete every file you are updating as these will be overwritten (here my example https://www.dropbox.com/s/jm6u0istpqxvj5b/updater-script ) I also added a line to delete a lib file, polaris*something*.so (11mb), you won't need it if you delete polaris viewer
I could not test because editing updater-script whit phone caused a different error: status 6, I'm redownloading it, having a shower and then I'll try
(I flashed your rom this afternoon, I see you've worked a lot on it to change graphic and modding apk (wait me, I'll pm you when I'll need to disable animation from toggles ))
Sent from Italy using Tapatalk
Click to expand...
Click to collapse
Thanks man! I'll look into it asap
Status 6 error
Worked with:
Code:
run_program("/sbin/busybox", "mount", "/system");
package_extract_dir("system", "/system");
run_program("/sbin/busybox", "umount", "/system");
You just need to add "delete" line
Sent from Italy using Tapatalk
I got some free time to work on my ROM"s zip file.. I solved the problems I had earlier but now new problems came up
Now when I flash my zip file, TWRP says "error executing update-binary".. I've tried replacing it with many other update-binary files BUT none of them work! I took a look at recovery.log file and it says this at the end:
Code:
Installing '/external_sd/SOS_UPDATE_1.1.zip'...
Checking for MD5 file...
I:Cannot find file /external_sd/SOS_UPDATE_1.1.zip.md5
Skipping MD5 check: no MD5 file found.
I:Zip does not contain SELinux file_contexts file in its root.
[B]line 40 col 9: syntax error, unexpected STRING, expecting $end[/B]
1 parse errors
E:Error executing updater binary in zip '/external_sd/SOS_UPDATE_1.1.zip'
Error flashing zip '/external_sd/SOS_UPDATE_1.1.zip'
Updating partition details...
I looked at line 40 in my updater-script and it looks fine to me.. line 40 is this only:
Code:
ui_print(" ");
Now I don't know what to do.. so @Toni5830 and @mr.harsh, can you guys help me solve this problem..
I've attached my new recovery.log file and my updater-script below..
Sami Kabir said:
I got some free time to work on my ROM"s zip file.. I solved the problems I had earlier but now new problems came up
Now when I flash my zip file, TWRP says "error executing update-binary".. I've tried replacing it with many other update-binary files BUT none of them work! I took a look at recovery.log file and it says this at the end:
Code:
Installing '/external_sd/SOS_UPDATE_1.1.zip'...
Checking for MD5 file...
I:Cannot find file /external_sd/SOS_UPDATE_1.1.zip.md5
Skipping MD5 check: no MD5 file found.
I:Zip does not contain SELinux file_contexts file in its root.
[B]line 40 col 9: syntax error, unexpected STRING, expecting $end[/B]
1 parse errors
E:Error executing updater binary in zip '/external_sd/SOS_UPDATE_1.1.zip'
Error flashing zip '/external_sd/SOS_UPDATE_1.1.zip'
Updating partition details...
I looked at line 40 in my updater-script and it looks fine to me.. line 40 is this only:
Code:
ui_print(" ");
Now I don't know what to do.. so @Toni5830 and @mr.harsh, can you guys help me solve this problem..
I've attached my new recovery.log file and my updater-script below..
Click to expand...
Click to collapse
add ";" at the end of 39th line.
mr.harsh said:
add ";" at the end of 39th line.
Click to expand...
Click to collapse
Thanks for your reply mate, but I have already figured it out.. I didn't have the time to reply or edit my first post earlier - sorry for that.. Anyways I think this issue was caused because TWRP starts counting lines from 0 onward whereas Notepad++ starts counting them from 1 onward...
Anyways now I have another problem.. The installation of my ROM now aborts in the middle.. While setting default permission, the installation aborts and this is what I found in recovery.log:
Code:
set_perm: chown of 0644 to 0 0 failed: No such file or directory
set_perm: chmod of 0644 to 755 failed: No such file or directory
script aborted: set_perm: some changes failed
set_perm: some changes failed
E:Error executing updater binary in zip '/external_sd/SOS_UPDATE_1.1.zip'
Error flashing zip '/external_sd/SOS_UPDATE_1.1.zip'
Updating partition details...
I honestly have no idea what the first 4 lines mean.. But as far as I know that update-binary file is totally compatible with SGSA..
Sami Kabir said:
Thanks for your reply mate, but I have already figured it out.. I didn't have the time to reply or edit my first post earlier - sorry for that.. Anyways I think this issue was caused because TWRP starts counting lines from 0 onward whereas Notepad++ starts counting them from 1 onward...
Anyways now I have another problem.. The installation of my ROM now aborts in the middle.. While setting default permission, the installation aborts and this is what I found in recovery.log:
Code:
set_perm: chown of 0644 to 0 0 failed: No such file or directory
set_perm: chmod of 0644 to 755 failed: No such file or directory
script aborted: set_perm: some changes failed
set_perm: some changes failed
E:Error executing updater binary in zip '/external_sd/SOS_UPDATE_1.1.zip'
Error flashing zip '/external_sd/SOS_UPDATE_1.1.zip'
Updating partition details...
I honestly have no idea what the first 4 lines mean.. But as far as I know that update-binary file is totally compatible with SGSA..
Click to expand...
Click to collapse
Probably you are doing chmod on a file or folder that is not in your ROM.
Hmmm, but all are there. Try to remove those chmod parts, and see if installation is ok without it.
Problem should be this line
Code:
set_perm(0, 0, 0755, 0644, "/system/etc/hosts");
I think it should be
Code:
set_perm(0, 0, 0644, "/system/etc/hosts");
(Or, as shut_down said, remove that line if it still gives errors, it's not necessary)
Sent from Italy using Tapatalk
@shut_down and @Toni5830,
As you guys said, I've corrected the Permission problems in my updater-script.. and now the finally zip flashes.. but now my phone won't boot to system.. it just boots to Recovery [TWRP]..
I wonder what went wrong this time... Should I pull a logcat or something? But I don't know if it will work or not because the phone directly boots to Recovery mode after the Samsung splash screen
EDIT: I tried wiping Cache and Dalvik, still no help...
Sami Kabir said:
@shut_down and @Toni5830,
As you guys said, I've corrected the Permission problems in my updater-script.. and now the finally zip flashes.. but now my phone won't boot to system.. it just boots to Recovery [TWRP]..
I wonder what went wrong this time... Should I pull a logcat or something? But I don't know if it will work or not because the phone directly boots to Recovery mode after the Samsung splash screen
EDIT: I tried wiping Cache and Dalvik, still no help...
Click to expand...
Click to collapse
This is what happens when you delete googleserviceframework.apk
Sent from Italy using Tapatalk
Sami Kabir said:
@shut_down and @Toni5830,
As you guys said, I've corrected the Permission problems in my updater-script.. and now the finally zip flashes.. but now my phone won't boot to system.. it just boots to Recovery [TWRP]..
I wonder what went wrong this time... Should I pull a logcat or something? But I don't know if it will work or not because the phone directly boots to Recovery mode after the Samsung splash screen
EDIT: I tried wiping Cache and Dalvik, still no help...
Click to expand...
Click to collapse
Code:
delete("/system/app/SystemUI.apk","/system/app/SecSettings.apk","/system/app/PolarisViewer.apk","/system/app/MtpApplication.apk","/system/app/Disable_service.apk","/system/app/SyncmlDM.apk");
delete("/system/framework/android.policy.jar","/system/framework/core.jar","/system/framework/framework2.jar","/system/framework/framework-res.apk","/system/framework/services.jar","/system/framework/twframework.jar");
delete("/system/etc/hosts","/system/etc/init.d/01_zipalign","/system/etc/init.d/02_sqlite_optimize","/system/etc/init.d/03_tweaks","/system/etc/init.d/06_MramLlag","/system/build.prop");
Remove the delete commands. When you flash the files will be automatically replaced. Only delete the files which are not going to be replaced
And instead of
Code:
package_extract_dir("system/app", "/system/app");
package_extract_dir("system/etc", "/system/etc");
package_extract_dir("system/framework", "/system/framework");
package_extract_dir("system/build.prop", "/system/build.prop");
Code:
package_extract_dir("system", "/system");
this will be enough
and as toni said above change the permission of /system/app and /system/framework and /system/etc to 755.
You can also use fix permission from CWM recovery to set permission right.
Dont use twrp.
anantttt said:
Code:
delete("/system/app/SystemUI.apk","/system/app/SecSettings.apk","/system/app/PolarisViewer.apk","/system/app/MtpApplication.apk","/system/app/Disable_service.apk","/system/app/SyncmlDM.apk");
delete("/system/framework/android.policy.jar","/system/framework/core.jar","/system/framework/framework2.jar","/system/framework/framework-res.apk","/system/framework/services.jar","/system/framework/twframework.jar");
delete("/system/etc/hosts","/system/etc/init.d/01_zipalign","/system/etc/init.d/02_sqlite_optimize","/system/etc/init.d/03_tweaks","/system/etc/init.d/06_MramLlag","/system/build.prop");
Remove the delete commands. When you flash the files will be automatically replaced. Only delete the files which are not going to be replaced
And instead of
Code:
package_extract_dir("system/app", "/system/app");
package_extract_dir("system/etc", "/system/etc");
package_extract_dir("system/framework", "/system/framework");
package_extract_dir("system/build.prop", "/system/build.prop");
Code:
package_extract_dir("system", "/system");
this will be enough
and as toni said above change the permission of /system/app and /system/framework and /system/etc to 644.
You can also use fix permission from CWM recovery to set permission right.
Dont use twrp.
Click to expand...
Click to collapse
Are you sure that those files will be replaced automatically?
And what code do you think I should use to set the permission to 644, should it be this one?
PHP:
set_perm_recursive(0, 0, 0755, 0644, "/system");
Sami Kabir said:
Are you sure that those files will be replaced automatically?
And what code do you think I should use to set the permission to 644, should it be this one?
PHP:
set_perm_recursive(0, 0, 0755, 0644, "/system");
Click to expand...
Click to collapse
Yup,it'll replace/append files.It'll set permission of all sub folders to 755 and all files to 644.But be careful because init.d script requires 777 permission (depends on ramdisk).And it is better to set 777 permission to /system/bin and /system/xbin.And yeah su binary wants 06755 permission else it won't work.
Sami Kabir said:
Are you sure that those files will be replaced automatically?
And what code do you think I should use to set the permission to 644, should it be this one?
PHP:
set_perm_recursive(0, 0, 0755, 0644, "/system");
Click to expand...
Click to collapse
Late to reply. Yes it would replace the files.
Edit: In detail, see the above post.
mr.harsh said:
Yup,it'll replace/append files.It'll set permission of all sub folders to 755 and all files to 644.But be careful because init.d script requires 777 permission (depends on ramdisk).And it is better to set 777 permission to /system/bin and /system/xbin.And yeah su binary wants 06755 permission else it won't work.
Click to expand...
Click to collapse
Um, I was just going through my ROM's original updater-script (the one in SOS 1.0).. in there I used 755 permission in "/system/bin" and in "/system/xbin".. It was like this:
Code:
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
And my ROM worked with no problems.. so should I use that or should I set it as 777 as you said above?
Sami Kabir said:
Um, I was just going through my ROM's original updater-script (the one in SOS 1.0).. in there I used 755 permission in "/system/bin" and in "/system/xbin".. It was like this:
Code:
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
And my ROM worked with no problems.. so should I use that or should I set it as 777 as you said above?
Click to expand...
Click to collapse
@Sami
Buddy if you need any help with testing let me know...
I have been using and doing roms for more than a year....[currently modifying Omni for myself]
Anyways thanks for the rom.....

[Help] Execute a shell script from updater-script in recovery flashable zip?

I'm trying to create a flashable zip that executes a shell script when it's flashed. I figured that the Edify Script command was this:
Code:
run_program("/path/to/shell/script/file.sh");
I've tried this in my flashable zip but it doesn't work. Am I using the wrong command? Any help would be appreciated!
Did you set permissions to 755 on the script after it was extracted? If not, that is probably why it didn't work as zip files won't preserve file permissions, so it would have been extracted at 644 most likely, making it unexecutable. What you have listed should work though. Here is a decent reference on the updater-script.
imnuts said:
Did you set permissions to 755 on the script after it was extracted? If not, that is probably why it didn't work as zip files won't preserve file permissions, so it would have been extracted at 644 most likely, making it unexecutable. What you have listed should work though. Here is a decent reference on the updater-script.
Click to expand...
Click to collapse
Yeah I set perms to 755. Here's the exact code I use:
Code:
show_progress(0.99, 30);
run_program("/sbin/busybox", "mount", "/system");
package_extract_dir("system", "/system");
set_perm(0, 0, 0755, "/system/etc/init.d/FixGSv4.sh");
run_program("/system/etc/init.d/FixGSv4.sh", "execute");
show_progress(1.0, 1);
unmount("/system");
Not sure what else to do to make it work. Do you think that it might be because the code in the shell script are commands like this?
Code:
#!/system/bin/sh
pm disable com.google.android.gms/.ads.settings.AdsSettingsActivity
pm disable com.google.android.gms/com.google.android.location.places.ui.aliaseditor.AliasEditorActivity
Can pm commands not be run from recovery?
Try running the commands via adb shell and see if it works that way. Also, why do you have "execute" in the same line as the script? That may be the issue as well, but it should just throw a warning. Also, is there anything in the recovery log?
Sent from my Nexus 6

Categories

Resources