malkovich wrote:It usually takes about two minutes, and I'm pretty sure they all use the same script. Which has been around for ages, so I don't think it came from kokotas. What recovery log do you mean? There is no error output. The fix_permissions script just starts normally, then a few milliseconds later exits normally.
I thought there would be many people who had tried fixing permissions on this ROM, it's a pretty regular thing for me.
Not sure why you are trying to fix permissions but if you feel adventurous try this script. Before you do,
make sure you have a current nandroid backup just in case!
The script does require a working busybox, of course!
Copy the attached code someplace on your device, save it as "permissions" or some other name of your choice and set permission for it as executable. Launch TERMINAL and you should be able to run the script.
Be patient as it will parse all your apps so the more you have the longer it will take.
- Code: Select all
#!/system/bin/sh
start=` busybox date +%s `
pkg_lines=`LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/system/lib pm list packages -f | busybox cut -d ':' -f2 `
total=` echo $pkg_lines | busybox wc -w `
current=0
echo
echo "Attempting to fix permissions... this could take a while!"
echo
busybox mount -o remount,rw /system
for pkgline in ${pkg_lines}; do
packagename=` echo $pkgline | busybox cut -d '=' -f2 `
bindir=` echo $pkgline | busybox cut -d '=' -f1 `
datadir=/data/data/$packagename
moduid=` busybox grep $bindir /data/system/packages.xml |
busybox sed 's%.*serId="\(.*\)".*%\1%' |
busybox cut -d '"' -f1 `
current=$(($current+1))
echo "(${current} of ${total}) ${packagename}..."
if busybox [ -e $bindir ]; then
appdir=` busybox dirname $bindir `
if busybox [ $appdir = /system/app ]; then
busybox chown 0 $bindir
busybox chown :0 $bindir
busybox chmod 644 $bindir
elif busybox [ $appdir = /data/app ]; then
busybox chown 1000 $bindir
busybox chown :1000 $bindir
busybox chmod 644 $bindir
elif busybox [ $appdir = /data/app-private ]; then
busybox chown 1000 $bindir
busybox chown :$moduid $bindir
busybox chmod 640 $bindir
fi
if busybox [ -d $datadir ]; then
busybox chmod 755 $datadir
busybox chown $moduid $datadir
busybox chown :$moduid $datadir
directories=` busybox find $datadir -mindepth 1 -type d `
for file in $directories; do
setperm=755
uid_1=$moduid
gid_1=$moduid
filename=` busybox basename $file `
case $filename in
lib)
busybox chmod 755 $file
uid_1=1000
gid_1=1000
setperm=755
;;
shared_prefs)
busybox chmod 771 $file
setperm=660
;;
databases)
busybox chmod 771 $file
setperm=660
;;
cache)
busybox chmod 771 $file
setperm=600
;;
*)
busybox chmod 771 $file
setperm=771
;;
esac
busybox chown $uid_1 $file
busybox chown :$gid_1 $file
busybox find $file -type f -maxdepth 1 ! -setperm $setperm -exec busybox chmod $setperm {} ';'
busybox find $file -type f -maxdepth 1 ! -user $uid_1 -exec busybox chown $uid_1 {} ';'
busybox find $file -type f -maxdepth 1 ! -group $gid_1 -exec busybox chown :$gid_1 {} ';'
done
fi
fi
done
busybox mount -o remount,ro /system
sync
stop=` busybox date +%s `
totaltime=` busybox expr $stop - $start`
hours=` busybox expr $totaltime / 3600`
remndr=` busybox expr $totaltime % 3600`
minutes=` busybox expr $remndr / 60`
seconds=` busybox expr $remndr % 60`
totaltime=`busybox printf "%02d:%02d:%02d\n" "$hours" "$minutes" "$seconds"`
echo
echo
echo "Finished settting permissions in ${totaltime}"
echo