Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[SCRIPT] Permissions Init Script

OP Romanbb

7th April 2011, 03:37 AM   |  #1  
Romanbb's Avatar
OP Recognized Developer
Thanks Meter: 7,033
 
3,587 posts
Join Date:Joined: Sep 2009
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, 605 views)
File Type: zip S30edt_perms.zip - [Click for QR Code] (350 Bytes, 408 views)
Last edited by Romanbb; 7th April 2011 at 11:10 PM.
The Following 8 Users Say Thank You to Romanbb For This Useful Post: [ View ]
7th April 2011, 03:45 AM   |  #2  
Poser's Avatar
Senior Member
The Nether Regions of the Tropics
Thanks Meter: 121
 
677 posts
Join Date:Joined: Mar 2008
More
Very cool, thanks roman.

Very cool to post the code too... lets us linux newbs get our learn on!
7th April 2011, 03:45 AM   |  #3  
Romanbb's Avatar
OP Recognized Developer
Thanks Meter: 7,033
 
3,587 posts
Join Date:Joined: Sep 2009
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, 04:02 AM   |  #4  
Poser's Avatar
Senior Member
The Nether Regions of the Tropics
Thanks Meter: 121
 
677 posts
Join Date:Joined: Mar 2008
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, 04:07 AM   |  #5  
Romanbb's Avatar
OP Recognized Developer
Thanks Meter: 7,033
 
3,587 posts
Join Date:Joined: Sep 2009
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 04:10 AM.
The Following 3 Users Say Thank You to Romanbb For This Useful Post: [ View ]
7th April 2011, 04:29 AM   |  #6  
|Melvin|'s Avatar
Senior Member
Flag Advanced Dev Team
Thanks Meter: 4,281
 
2,980 posts
Join Date:Joined: Dec 2010
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, 09:33 PM   |  #7  
Poser's Avatar
Senior Member
The Nether Regions of the Tropics
Thanks Meter: 121
 
677 posts
Join Date:Joined: Mar 2008
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, 10:26 PM   |  #8  
Senior Member
Thanks Meter: 35
 
354 posts
Join Date:Joined: Jan 2007
I get "Bad Mode"
7th April 2011, 10:28 PM   |  #9  
Romanbb's Avatar
OP Recognized Developer
Thanks Meter: 7,033
 
3,587 posts
Join Date:Joined: Sep 2009
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, 10:36 PM   |  #10  
Senior Member
Thanks Meter: 35
 
354 posts
Join Date:Joined: Jan 2007
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