Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,807,656 Members 52,377 Now Online
XDA Developers Android and Mobile Development Forum

[SCRIPT] Permissions Init Script

Tip us?
 
Romanbb
Old
(Last edited by Romanbb; 7th April 2011 at 10:10 PM.)
#1  
Romanbb's Avatar
Recognized Developer - OP
Thanks Meter 7,028
Posts: 3,587
Join Date: Sep 2009

 
DONATE TO ME
Default [SCRIPT] Permissions Init Script

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, 598 views)
File Type: zip S30edt_perms.zip - [Click for QR Code] (350 Bytes, 393 views)
The Following 8 Users Say Thank You to Romanbb For This Useful Post: [ Click to Expand ]
 
Poser
Old
#2  
Poser's Avatar
Senior Member
Thanks Meter 116
Posts: 665
Join Date: Mar 2008
Location: The Nether Regions of the Tropics
Very cool, thanks roman.

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

---------- NEXUS 5 32Vadar ----------
 
Dash - Decomissioned
Vibrant - indentured servitude
Galaxy S II Hercules - Now a hand me down for the peanut
GSIII SGH-T999 - Yup, sh!t is hype
GN2 SGH-T889 - WOW. (really)
GS IV SGH-M919 - deprecated...really
Nexus 5
 
Romanbb
Old
#3  
Romanbb's Avatar
Recognized Developer - OP
Thanks Meter 7,028
Posts: 3,587
Join Date: Sep 2009

 
DONATE TO ME
Quote:
Originally Posted by Poser View Post
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: [ Click to Expand ]
 
Poser
Old
#4  
Poser's Avatar
Senior Member
Thanks Meter 116
Posts: 665
Join Date: Mar 2008
Location: The Nether Regions of the Tropics
Quote:
Originally Posted by birgertime View Post
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?

---------- NEXUS 5 32Vadar ----------
 
Dash - Decomissioned
Vibrant - indentured servitude
Galaxy S II Hercules - Now a hand me down for the peanut
GSIII SGH-T999 - Yup, sh!t is hype
GN2 SGH-T889 - WOW. (really)
GS IV SGH-M919 - deprecated...really
Nexus 5
 
Romanbb
Old
(Last edited by Romanbb; 7th April 2011 at 03:10 AM.)
#5  
Romanbb's Avatar
Recognized Developer - OP
Thanks Meter 7,028
Posts: 3,587
Join Date: Sep 2009

 
DONATE TO ME
Quote:
Originally Posted by Poser View Post
[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.
The Following 3 Users Say Thank You to Romanbb For This Useful Post: [ Click to Expand ]
 
|Melvin|
Old
#6  
|Melvin|'s Avatar
Senior Member
Thanks Meter 4,280
Posts: 2,980
Join Date: Dec 2010
Location: Advanced Dev Team

 
DONATE TO ME
roman im gonna add S30edt_perms.zip to my rom ..ill add you to credits


Add Me on Google+ Here

Follow Me On Twitter For Fast News

Joing our Facebook Group

Like my work? Buy Me a Coffee!!

Join My IRC For Info.

T-Mobile SGSII, HTC Sensation 4G, Mytouch 4G,
Samsung Vibrant, Mytouch 3G Slide, Mytouch 3G,
Mytouch 3G Fender [All My Androids]
The Following User Says Thank You to |Melvin| For This Useful Post: [ Click to Expand ]
 
Poser
Old
#7  
Poser's Avatar
Senior Member
Thanks Meter 116
Posts: 665
Join Date: Mar 2008
Location: The Nether Regions of the Tropics
Quote:
Originally Posted by birgertime View Post
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)

---------- NEXUS 5 32Vadar ----------
 
Dash - Decomissioned
Vibrant - indentured servitude
Galaxy S II Hercules - Now a hand me down for the peanut
GSIII SGH-T999 - Yup, sh!t is hype
GN2 SGH-T889 - WOW. (really)
GS IV SGH-M919 - deprecated...really
Nexus 5
 
gamefreakgcb
Old
#8  
Senior Member
Thanks Meter 35
Posts: 354
Join Date: Jan 2007
I get "Bad Mode"
 
Romanbb
Old
#9  
Romanbb's Avatar
Recognized Developer - OP
Thanks Meter 7,028
Posts: 3,587
Join Date: Sep 2009

 
DONATE TO ME
Quote:
Originally Posted by gamefreakgcb View Post
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: [ Click to Expand ]
 
gamefreakgcb
Old
#10  
Senior Member
Thanks Meter 35
Posts: 354
Join Date: Jan 2007
Quote:
Originally Posted by birgertime View Post
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"

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes