add selinux to init scripts; correctly set cache and dalvik with proper permissions
diff --git a/proprietary/common/etc/init.d/50selinuxrelabel b/proprietary/common/etc/init.d/50selinuxrelabel
new file mode 100755
index 0000000..bb66a4b
--- /dev/null
+++ b/proprietary/common/etc/init.d/50selinuxrelabel
@@ -0,0 +1,49 @@
+#!/system/bin/sh
+
+L="log -p i -t SELinuxLabel"
+
+# Bail out early if not on a SELinux build
+getprop ro.build.selinux | grep -q 1 || exit
+if [ ! -f /file_contexts ]; then
+ exit
+fi
+
+LABELDATA=0
+LABELSYS=0
+
+# Test /data
+ls -Zd /data/system | grep -q unlabeled
+if [ $? -eq 0 ]; then
+ $L "userdata is unlabeled, fixing..."
+ LABELDATA=1
+fi
+
+ls -Z /system/bin/surfaceflinger | grep -q unlabeled
+if [ $? -eq 0 ]; then
+ $L "system is unlabeled, fixing... (You really should update your recovery)"
+ LABELSYS=1
+fi
+
+ls -Z /system/app/GoogleServicesFramework.apk | grep -q unlabeled
+if [ $LABELSYS = "0" -a $? -eq 0 ]; then
+ $L "Found unlabeled Google framework, fixing..."
+ LABELSYS=1
+fi
+
+
+if [ $LABELSYS = "1" ]; then
+ busybox mount -o remount,rw /system
+ $L "/system relabel starting..."
+ restorecon -R /system
+ $L "/system relabel complete"
+ busybox mount -o remount,ro /system
+fi
+
+if [ $LABELDATA = "1" ]; then
+ $L "/data relabel starting..."
+ restorecon -R /data
+ $L "/data relabel complete"
+ $L "/cache relabel starting..."
+ restorecon -R /cache
+ $L "/cache relabel complete"
+fi
diff --git a/proprietary/common/etc/init.local.rc b/proprietary/common/etc/init.local.rc
old mode 100644
new mode 100755
index 32dedce..7c16dda
--- a/proprietary/common/etc/init.local.rc
+++ b/proprietary/common/etc/init.local.rc
@@ -1,12 +1,35 @@
# CyanogenMod Extras
+
import /init.superuser.rc
-# AOKP Extras
+on init
+export ANDROID_CACHE /cache
+ export TERMINFO /system/etc/terminfo
+ export TERM linux
-on boot
+on post-fs-data
+ mkdir /cache/dalvik-cache 0771 system system
+ chown system system /cache/dalvik-cache
+ chmod 0771 /cache/dalvik-cache
+ mkdir /data/.ssh 0750 root shell
+
# Run sysinit
start sysinit
+on boot
+ chown system system /sys/block/mmcblk0/queue/scheduler
+ chmod 0664 /sys/block/mmcblk0/queue/scheduler
+
+# allow system to modify ksm control files
+ chown root system /sys/kernel/mm/ksm/pages_to_scan
+ chmod 0664 /sys/kernel/mm/ksm/pages_to_scan
+ chown root system /sys/kernel/mm/ksm/sleep_millisecs
+ chmod 0664 /sys/kernel/mm/ksm/sleep_millisecs
+ chown root system /sys/kernel/mm/ksm/run
+ chmod 0664 /sys/kernel/mm/ksm/run
+ write /sys/kernel/mm/ksm/sleep_millisecs 1500
+ write /sys/kernel/mm/ksm/pages_to_scan 256
+
# adb over network
on property:service.adb.tcp.port=5555
stop adbd
@@ -14,9 +37,10 @@
on property:service.adb.tcp.port=-1
stop adbd
start adbd
-
+
# Compcache - handle at boot
service compcache /system/bin/handle_compcache
+ class main
user root
group root
oneshot
@@ -25,3 +49,6 @@
service sysinit /system/bin/sysinit
user root
oneshot
+ disabled
+
+