[SCRIPT][CWM] Fix Permissions Script - Samsung Galaxy S (4G Model)

I am not responsible for you bricking/damaging your phone.
I did not write the fix permissions script, simply packaged it into a CWM-flashable ZIP file.
If you're like me you like to be able to fix your app permissions without having to boot into recovery. I found a stand-alone script here, and was able to push it to /system/bin, then rename it and CHMOD to be executable, and it all worked fine. The problem is that with SGS4G development exploding I've found myself doing this quite frequently, so I decided to put it into a CWM package that you simply flash and voila!
Before someone says, I am aware that there is an app on the market to do it, but last I knew it would not do them all in a batch operation, which is just plain silly.
Also, ROOT IS REQUIRED.
Usage (from adb shell, or a terminal emulator)
Code:
su
mount -o remount,rw -t ext4 /dev/block/stl9 /system
fix_permissions
mount -o ro,remount -t ext4 /dev/block/stl9 /system
If your partitions are NOT EXT4 then change the "ext4" to "rfs" in the above commands.

So just flash this script thru cwm?
Sent from my SGH-T959V using XDA Premium App

makavelicruz said:
So just flash this script thru cwm?
Sent from my SGH-T959V using XDA Premium App
Click to expand...
Click to collapse
crackpot said:
I did not write the fix permissions script, simply packaged it into a CWM-flashable ZIP file.[/color
Click to expand...
Click to collapse
Looks that way...

makavelicruz said:
So just flash this script thru cwm?
Sent from my SGH-T959V using XDA Premium App
Click to expand...
Click to collapse
op says he doesn't like to boot recovery would be pointless to flash in cwm. Unzip the download and see what's in it.
Edit: now I'm just confused

Haha, just downloaded it. CWM package, installs fix_permissions into /system/bin
Code:
ui_print("Fix Permissions Script");
ui_print("Mounting System...");
run_program("/sbin/mount", "/dev/block/stl9", "/system");
ui_print("Installing Script...");
package_extract_dir("system", "/system");
ui_print("Setting to Executable");
set_perm(0, 0, 0755, "/system/bin/fix_permissions");
That's the updater-script.

My apologies, didn't think it was confusing. Yes it is meant to be CWM flashable. All it does is put the script in /system/bin, then CHMOD to 755, aka executable.
Sent from my SGH-T959V using XDA Premium App

FBis251 said:
Haha, just downloaded it. CWM package, installs fix_permissions into /system/bin
Code:
ui_print("Fix Permissions Script");
ui_print("Mounting System...");
run_program("/sbin/mount", "/dev/block/stl9", "/system");
ui_print("Installing Script...");
package_extract_dir("system", "/system");
ui_print("Setting to Executable");
set_perm(0, 0, 0755, "/system/bin/fix_permissions");
[COLOR="Red"]run_program("/system/bin/fix_permissions");[/COLOR]
That's the updater-script.
Click to expand...
Click to collapse
check my edit

Look here ...
Enviado desde mi GT-N7105 mediante Tapatalk

mataflakitas said:
Look here ...
Enviado desde mi GT-N7105 mediante Tapatalk
Click to expand...
Click to collapse
Where?

myaservip said:
check my edit
Click to expand...
Click to collapse
mataflakitas said:
Look here ...
Click to expand...
Click to collapse
myaservip said:
Where?
Click to expand...
Click to collapse
Ugh... 4 year old thread, 3 years since the previous post.
Might want to look elsewhere.

UGH... lol

Related

Need some scripting advice

Hoping someone with some scripting experience on the Nexus S can look at this and answer my question. Moving to the Nexus S 4G from the Epic. If I wanted to install apps to /data or copy files to /sdcard during flash the lines below would accomplish this. However, on the Nexus S, it doesn't seem to work. I HAVE searched but can't find the answer. I have noticed that no one seems to incorporate this in any of the updater-scripts I have seen here. I realize the Nexus is different than the Epic by it's very nature but I'm still wondering if this is possible and if so, how? Thanks in advance for your time.
package_extract_dir("data", "/data");
package_extract_dir("sdcard", "/sdcard");
set_perm (1000, 1000, 0771, "/data/app");
Click to expand...
Click to collapse
You need to mount those partitions first
When mounting, use:
data: /dev/block/platform/s3c-sdhci.0/by-name/userdata
Code:
mount("ext3", "EMMC", "/dev/block/platform/s3c-sdhci.0/by-name/userdata", "/data");
sdcard: /dev/block/platform/s3c-sdhci.0/by-name/media
Code:
mount("vfat", "MTD", "/dev/block/platform/s3c-sdhci.0/by-name/media", "/sdcard"); (I think)
dsixda said:
You need to mount those partitions first
When mounting, use:
data: /dev/block/platform/s3c-sdhci.0/by-name/userdata
Code:
mount("ext3", "EMMC", "/dev/block/platform/s3c-sdhci.0/by-name/userdata", "/data");
sdcard: /dev/block/platform/s3c-sdhci.0/by-name/media
Code:
mount("vfat", "MTD", "/dev/block/platform/s3c-sdhci.0/by-name/media", "/sdcard"); (I think)
Click to expand...
Click to collapse
I wanted to take a second and thank you very much. You were right on the money. This is a bit of a change from the Epic for me. I appreciate you taking the time to help me out.
Medic Great to see you over here enjoy your NS4G, your really going to dig this phone.

Init.d ?

I was wondering how to use the init.d folder to run scripts during boot.
I have
# enable init.d support
service run_parts /system/xbin/run-parts /system/etc/init.d
oneshot
In my init.rc file but I do not have the init.d folder in /system/ect/
I have been trying to figure this out for about three days now. It might not even be possible but im sure someone knows better than me. Any help would be greatly appreciated!
Sent from my SCH-I500 using Tapatalk
You have to create the folder /init.d in /system/etc/init.d if it is not present.
Then, in updater-script you have to set the correct permissions to the init.d folder,
Updater script:
Code:
set_perm_recursive(0, 2000, 0755, 0750, "/system/etc/init.d");
set_perm(0, 0, 0755, "/system/etc/init.d");
e334 said:
You have to create the folder /init.d in /system/etc/init.d if it is not present.
Then, in updater-script you have to set the correct permissions to the init.d folder,
Updater script:
Code:
set_perm_recursive(0, 2000, 0755, 0750, "/system/etc/init.d");
set_perm(0, 0, 0755, "/system/etc/init.d");
Click to expand...
Click to collapse
How do I use the updater script and will any script I put into init.d be run at boot or do the scripts have to be named a certain way?
Sent from my SCH-I500 using Tapatalk
Since you are using the busybox run-parts method in init.rc, you have to add the files 00banner 99complete (pull from another working rom). Any other script you add has to start with a number greater than 00 and smaller than 99. For example: 04modules
The scripts execute from the smallest number to the greatest.
You can find the updater-script in the unzipped rom you are modifying, under the directory META-INF/com/google/android/
Do u know of any roms that have the other two files I can grab and ounce I do will I need to modify them any?
Sent from my SCH-I500 using Tapatalk
Most roms, such as cyanogenmod 6 series, should have them.
Thank you very much! I will give it a try
Sent from my SCH-I500 using Tapatalk
Thanks e334 that worked perfectly! You don't know how much I appreciate the help. Thanks again.
Sent from my SCH-I500 using Tapatalk
csanmba said:
How do I use the updater script and will any script I put into init.d be run at boot or do the scripts have to be named a certain way?
Sent from my SCH-I500 using Tapatalk
Click to expand...
Click to collapse
For init.rc
# Execute files in /etc/init.d before booting
service userinit /system/xbin/busybox run-parts /system/etc/init.d
oneshot
class late_start
user root
group root

How to convert an rfs Rom to Ext4.

Hey guys, I am wanting to use a 2.3.6 stock rom with my Cwm but i need to first convert the filesystem from rfs to ext4. How do i do that? Thanks
Sent from my GT-S5670 using XDA App
I am actually wanting the same thing...
Same here, anyone care to share how it can be made ?
not very hard ,just extract initramfs.cpio from the zImage ,add this line
CONFIG_EXT4_FS=y in filesystems,then change Mount points in init.rc of Ramdisk
and then Format All Dev Blocks e.g. System,Data,Cache to ext4 !!
how to extract zimage..............or how to open zzimage ????? plz help
i followed this guide http://forum.xda-developers.com/showthread.php?t=777380
I did from step 4 to 11 smoothly
At step 1 i had a file called zImage( no extension but icon is CPIO)
I change zImage to initramfs.cpio and run this command
Code:
cat initramfs.cpio | cpio -i --no-absolute-filenames
Result
Code:
cpio: Removing leading `/' from member names
dev
cpio: dev/console: Cannot mknod: Operation not permitted
dev/console
root
1 block
and 2 folder
In Dev folder have a file with 0 byte
Dont bash me cause i have just started with ubuntu 2 day
And where can i find how to make pre-install rom with ext4 support?
Im on GT s5670 with stock DXKT4
Priyank Patel said:
how to extract zimage..............or how to open zzimage ????? plz help
Click to expand...
Click to collapse
can anyone tell?
Gendows said:
can anyone tell?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showpost.php?p=5447589
Download the attacked file and do step 8 whit your boot.img
@pratyush.creed
u need to do something to the zimage in boot.img ? what if i take zimage and the modules from an ext4 rom (of the same base) and put it in the rfs rom? will it work?
I really need to know how to make a pre-install rom with ext4 support.
Anyone
May I answer a question?
U can open your updater-script from META-INF with notepad++
Write like this For converting your system:
Code:
unmount("/system");
unmount("/cache");
unmount("/data");
ui_print("[ ] Formatting system with ext4");
format("ext4", "EMMC", "/dev/block/stl12");
ui_print("[ ] Formatting cache with ext4");
format("ext4", "EMMC", "/dev/block/stl14");
ui_print("[ ] Formatting data with ext4");
format("ext4", "EMMC", "/dev/block/stl13");
*(ui_print) is command for notes. So, U may not care about it
Thx. I hope it can help ya, guyz!
Delanoister said:
May I answer a question?
U can open your updater-script from META-INF with notepad++
Write like this For converting your system:
Code:
unmount("/system");
unmount("/cache");
unmount("/data");
ui_print("[ ] Formatting system with ext4");
format("ext4", "EMMC", "/dev/block/stl12");
ui_print("[ ] Formatting cache with ext4");
format("ext4", "EMMC", "/dev/block/stl14");
ui_print("[ ] Formatting data with ext4");
format("ext4", "EMMC", "/dev/block/stl13");
*(ui_print) is command for notes. So, U may not care about it
Thx. I hope it can help ya, guyz!
Click to expand...
Click to collapse
Ya u need d lines from script n boot.img of an ext4 rom for not editing zimage
Not exactly what i want. I want to learn how to build kernel support ext4 from stock rom.
When search around i see some way to:
+Unpack boot.img
+Add ext4.ko , jdb2.ko to ramdisk and edit init.rc with new mount point.
+Repack boot.img
I flash new boot.img, phone work fine but i dont know if it supports ext4 ^^
And other guide is compile kernel from source is provided by samsung. Oh god with this way i have to learn java, c @#^%!
Maybe i should go to some class
Anyway thank you very much. Have a good day.

[HOWTO] Patch Your ROM or Make A CWM-Flashable zip.

First, Make a new folder.
In that you put a META-INF copied from some Theme.
And, Make the folders where you want your apps and tweaks to be placed.
Like you may want some apps to go to /system/app...So, Create a folder called system and inside that create a folder called App and paste the application there.
Now, Changes in updater script.
On an ext4 system, I did this.
Remvoe eevrything in the updater-script. Delete eveything.
Now, add these lines
Code:
run_program("/sbin/busybox", "mount", "-t", "auto", "/dev/block/stl9", "/system");
mount("ext4", "system", "/system");
Meaning of the code:
This mounts the system, grants root permission.
Now that system is mounted, We should tell CWM to copy the folder and replace the contents. So, Add these lines:
Code:
package_extract_dir("system", "/system");
Now, Replace the name of the folder you wanna replace and make multiple lines in the same format. (replace in package_extract_dir("yourfoldername","/yourfoldername")
For prinitng the process, add
Code:
ui_print("Installing -NAMEOFYOURROM-PATCH...");
Add this above the extract COMMAND.
Now, Put this into a Zip...Using Win-zip.
When you open the zip you should see META-INF and other folders.
Zip it in that manner.
And, Download Auto-Sign from this place.
Re-name the zip to UPDATE and put it in the autozip folder.
Sign it and you are done!
PRESS THE THANKS...GIVES ME ENCOURAGEMENT. PLEASE.
Thanks a lot ..
was waitting for it ...
but what about symlinking ??
asad007 said:
Thanks a lot ..
was waitting for it ...
but what about symlinking ??
Click to expand...
Click to collapse
Just write:
symlink("<target>", "<based-dir>")
Sent from my GT-S5660 using Tapatalk
If i wanna replace some apps in /system/apps, i add the following code?
run_program("/sbin/busybox", "mount", "-t", "auto", "/dev/block/stl9", "/system");
mount("ext4", "system", "/system");
package_extract_dir("system", "/system");
Click to expand...
Click to collapse
lomash said:
If i wanna replace some apps in /system/apps, i add the following code?
Click to expand...
Click to collapse
package_extractdir - line and line with mount is enough. You donĀ“t need the line above
you mean this?
mount("ext4", "system", "/system");
package_extract_dir("system", "/system");
Click to expand...
Click to collapse
lomash said:
you mean this?
Click to expand...
Click to collapse
exactly

[Q] can we fastboot?

can we get into fast boot, im stuck at not being able to format my /data parition due to a denied permission on packages.xml. i searched everywhere and one person had this problem but it was on a different device and they fixed it by 'fastboot erase userdata'
help?
No. You cannot fastboot. That seems like a Nexus-only sorta thing. Sadly.
If you are lucky, you have SBKv1 and can use nvflash with your device in APX-mode.
Anyway. You should be able to format /data within CWM. If you get permissions issues there, something is terribly wrong.
Try hooking it up to a pc and connecting via adb.
In that case you should be able to get an adb shell and have the option to clean up manully.
josteink said:
No. You cannot fastboot. That seems like a Nexus-only sorta thing. Sadly.
If you are lucky, you have SBKv1 and can use nvflash with your device in APX-mode.
Anyway. You should be able to format /data within CWM. If you get permissions issues there, something is terribly wrong.
Try hooking it up to a pc and connecting via adb.
In that case you should be able to get an adb shell and have the option to clean up manully.
Click to expand...
Click to collapse
i have SBKv2, and i tried adb in recovery. the file gets permission denied when trying to delete it, and i cant SU in adb, which is weird.
i can get it up and running, but everything acts weird even the launcher, i tried doing a tibackup restore of system too, but everything is jacked, things just work weird, home button doesnt work. only back. quick launch widgets are gone. says apps are installed that are not installed.
i tried thinking of creating a edify script that would kill the data partition with busybox, think that might work?
Code:
assert(getprop("ro.product.device") == "tf101" || getprop("ro.build.product") == "tf101");
show_progress(0.500000, 0);
format("MTD", "userdata");
mount("MTD", "userdata", "/data");
delete_recursive("/data/system");
run_program("/sbin/busybox", "rm", "-rf", "/data/*");
run_program("/sbin/busybox", "umount", "/data");
BlueHarford said:
i have SBKv2, and i tried adb in recovery. the file gets permission denied when trying to delete it, and i cant SU in adb, which is weird.
i can get it up and running, but everything acts weird even the launcher, i tried doing a tibackup restore of system too, but everything is jacked, things just work weird, home button doesnt work. only back. quick launch widgets are gone. says apps are installed that are not installed.
i tried thinking of creating a edify script that would kill the data partition with busybox, think that might work?
Code:
assert(getprop("ro.product.device") == "tf101" || getprop("ro.build.product") == "tf101");
show_progress(0.500000, 0);
format("MTD", "userdata");
mount("MTD", "userdata", "/data");
delete_recursive("/data/system");
run_program("/sbin/busybox", "rm", "-rf", "/data/*");
run_program("/sbin/busybox", "umount", "/data");
Click to expand...
Click to collapse
Tried Adb fRom normal not our CWM? If you haven't tried the latter I would recommend trying that first.
Sent from my Galaxy Nexus using Tapatalk
josteink said:
Tried Adb fRom normal not our CWM? If you haven't tried the latter I would recommend trying that first.
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
you mean boot into the rom and use adb in there?
Tegra chipsets work a little different. I'm not the best tool in the drawer when it comes to development but NVFlash is almost just like fastboot. When in NVFlash move, you do similar commands such as "nvflash command"... syntax aside.
Check out some of the "SUPERWIPE" tools, both NVFLASH and CWM methods. You might be able to deconstruct one into formatting just the partition you need.
BlueHarford said:
you mean boot into the rom and use adb in there?
Click to expand...
Click to collapse
I mean boot into recovery and use adb there,

Categories

Resources