FORUMS

XDA Recap: This Week In Android (May 17 – 23)

Another week, another recap. The Sunday tradition marches on this week with a fresh … more

Huawei To Sell Honor Smartphones Via Indian Retail Outlets

World’s fourth largest smartphone maker Huawei plans to now sell its … more

Sunday Debate: Are Smaller Bezels Better or Worth It?

Bezels have been getting smaller and smaller as the years go by, and while devices … more

LG G4 First Impressions and Unboxing – XDA TV

The latest in LG’s signature line of “G phones” has been released. … more
Post Reply Subscribe to Thread Email Thread

[SCRIPT] Permissions Init Script

7th April 2011, 02:37 AM |#1  
Romanbb's Avatar
OP Recognized Developer
Thanks Meter: 7,034
 
Donate to Me
More
Hey guys,

I had a nasty issue with Bi-Winning a couple weeks ago where I pushed custom framework and totally forgot about permissions. Apparently when you don't set the proper permissions it can really slow things down.

So I figured this could easily be avoided. So because of that and our CWM "Fix Permissions" option doesn't really do anything, I wrote this script to fix it!

Upon every boot, it will scan /system/app, /system/framework/, and /data/app and set the proper permissions for all the files in there.

Users
note if you're on Trigger 2.9.1+ or Bi-Winning V1+ you do NOT have to do this. It's built into your ROM already.

Flash the attached zip named "CWM_Flash_Permissions_Script.zip"

Ironically, it may not have the correct permissions after you flash it, so then do either of the following

1) Do these commands in ADB to set the correct permissions
Code:
adb shell
mount -o rw,remount /dev/block/stl9 /system
busybox chmod 777 /system/etc/init.d/*
or
2) Open up Root Explorer (or something similar)
navigate to /system/etc/init.d/
in there find the new file S30edt_perms
long press, and set the permissions
make it look like this
Code:
x x x
x x x
x x x
Here's the init.d script, it's really simple, but also effective

Code:
#!/system/bin/sh
# Permission script
# Written by Einherjar Dev Team
# www.edtdev.com

logFile=/data/edt/logs/S30edt_perms.log
if [ -f $logFile ]; then
        rm $logFile
fi
touch $logFile

mount -o rw,remount /dev/block/stl9 /system
echo "Setting permissions" >> $logFile
        for file in /system/app/* /system/framework/* /data/app/*; do
                echo "    setting permissions (644) for $file" >> $logFile
                chmod 644 $file
        done
        
        echo "chmodding init.d folder"
        chmod 777 /system/etc/init.d
        
        for file in /system/etc/init.d/*; do
                echo "    setting permissions (777) for $file" >> $logFile
                chmod 777 $file
        done
echo "Permissions set" >> $logFile
Attached Files
File Type: zip CWM_Flash_Permissions_Script.zip - [Click for QR Code] (2.7 KB, 645 views)
File Type: zip S30edt_perms.zip - [Click for QR Code] (350 Bytes, 448 views)
Last edited by Romanbb; 7th April 2011 at 10:10 PM.
The Following 8 Users Say Thank You to Romanbb For This Useful Post: [ View ]
 
 
7th April 2011, 02:45 AM |#2  
Poser's Avatar
Senior Member
The Nether Regions of the Tropics
Thanks Meter: 202
 
More
Very cool, thanks roman.

Very cool to post the code too... lets us linux newbs get our learn on!
7th April 2011, 02:45 AM |#3  
Romanbb's Avatar
OP Recognized Developer
Thanks Meter: 7,034
 
Donate to Me
More
Quote:
Originally Posted by Poser

Very cool, thanks roman.

Very cool to post the code too... lets us linux newbs get our learn on!

I'm a Linux noobie myself!
The Following 3 Users Say Thank You to Romanbb For This Useful Post: [ View ]
7th April 2011, 03:02 AM |#4  
Poser's Avatar
Senior Member
The Nether Regions of the Tropics
Thanks Meter: 202
 
More
Quote:
Originally Posted by birgertime

I'm a Linux noobie myself!

[slight OT] Just getting wifi working on an old ideapad y510 in slackware was an epic struggle... (wicd my arse)
[back on topic] I wish more devs would post script contents (though we can easily download and look in vi or notepad)... it helps the learning curve immensely

grateful for all the work EDT and rest of dev community does. We all are.

Question: What does the fix permissions CWM do then?
7th April 2011, 03:07 AM |#5  
Romanbb's Avatar
OP Recognized Developer
Thanks Meter: 7,034
 
Donate to Me
More
Quote:
Originally Posted by Poser

[slight OT] Just getting wifi working on an old ideapad y510 in slackware was an epic struggle... (wicd my arse)
[back on topic] I wish more devs would post script contents (though we can easily download and look in vi or notepad)... it helps the learning curve immensely

grateful for all the work EDT and rest of dev community does. We all are.

Question: What does the fix permissions CWM do then?

I have no clue, lol. Never bothered looking at it

edit: I hate vi.
Last edited by Romanbb; 7th April 2011 at 03:10 AM.
The Following 3 Users Say Thank You to Romanbb For This Useful Post: [ View ]
7th April 2011, 03:29 AM |#6  
|Melvin|'s Avatar
Senior Member
Flag Advanced Dev Team
Thanks Meter: 4,281
 
Donate to Me
More
roman im gonna add S30edt_perms.zip to my rom ..ill add you to credits
The Following User Says Thank You to |Melvin| For This Useful Post: [ View ]
7th April 2011, 08:33 PM |#7  
Poser's Avatar
Senior Member
The Nether Regions of the Tropics
Thanks Meter: 202
 
More
Quote:
Originally Posted by birgertime

I have no clue, lol. Never bothered looking at it

edit: I hate vi.

lol.

Vi is about as stripped down as you can get when it comes to text based editors... (I know its blasphemous... but I dig notepad++, shhh... dont tell)
7th April 2011, 09:26 PM |#8  
Senior Member
Thanks Meter: 34
 
More
I get "Bad Mode"
7th April 2011, 09:28 PM |#9  
Romanbb's Avatar
OP Recognized Developer
Thanks Meter: 7,034
 
Donate to Me
More
Quote:
Originally Posted by gamefreakgcb

I get "Bad Mode"

Hmm, ok you might need super user permissions do this and let me knkow if it works:

1) type in "adb shell"
2) type in su (don't press enter yet)
3) turn your screen on & unlock it
4) press enter on the su prompt, then his yes on the screen

then try that chmod command again.
The Following User Says Thank You to Romanbb For This Useful Post: [ View ]
7th April 2011, 09:36 PM |#10  
Senior Member
Thanks Meter: 34
 
More
Quote:
Originally Posted by birgertime

Hmm, ok you might need super user permissions do this and let me knkow if it works:

1) type in "adb shell"
2) type in su (don't press enter yet)
3) turn your screen on & unlock it
4) press enter on the su prompt, then his yes on the screen

then try that chmod command again.

Gave permission, still "Bad Mode"
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes