Merge "selinuxrelabel: Add a check for dalvik-cache" into cm-11.0
diff --git a/prebuilt/common/etc/init.d/50selinuxrelabel b/prebuilt/common/etc/init.d/50selinuxrelabel
index 2fd4a02..9332f00 100644
--- a/prebuilt/common/etc/init.d/50selinuxrelabel
+++ b/prebuilt/common/etc/init.d/50selinuxrelabel
@@ -10,6 +10,7 @@
 
 LABELDATA=0
 LABELSYS=0
+LABELDALVIKCACHE=0
 
 # Test /data
 ls -Zd /data/system | grep -q unlabeled
@@ -30,6 +31,18 @@
   LABELSYS=1
 fi
 
+ls -Zd /data/dalvik-cache | grep -q unlabeled
+if [ $? -eq 0 ]; then
+  $L "dalvik-cache is unlabeled, fixing..."
+  LABELDALVIKCACHE=1
+fi
+
+ls -Zd /cache/dalvik-cache | grep -q unlabeled
+if [ $? -eq 0 ]; then
+  $L "dalvik-cache is unlabeled, fixing..."
+  LABELDALVIKCACHE=1
+fi
+
 
 if [ $LABELSYS = "1" ]; then
   busybox mount -o remount,rw /system
@@ -47,3 +60,10 @@
   restorecon -R /cache
   $L "/cache relabel complete"
 fi
+
+if [ $LABELDALVIKCACHE = "1" ]; then
+  $L "dalvik-cache relabel starting..."
+  restorecon -R /data/dalvik-cache
+  restorecon -R /cache/dalvik-cache
+  $L "dalvik-cache relabel complete"
+fi