replicant-vendor_replicant/prebuilt/common/etc/init.d/50selinuxrelabel
Ricardo Cerqueira cae5f24530 selinuxrelabel: Remove attempts to relabel /system
These are a no-op due to the additional block-device protection from
e18c0d508a
so get rid of them entirely. Any installing recovery (or equivalent
installation process) should handle the labeling of system components
on its own.

Change-Id: I14c50f08efa6f05b03fad4fbc404219cc504e1ff
TBD: Do we still want to label unlabeled files?
2013-12-31 17:59:54 +00:00

56 lines
1.2 KiB
Bash

#!/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
LABELDALVIKCACHE=0
# Test /data
ls -Zd /data/system | grep -q unlabeled
if [ $? -eq 0 ]; then
$L "userdata is unlabeled, fixing..."
LABELDATA=1
fi
# Double-check other files under /data
ls -Z /data/misc/wifi/wpa_supplicant.conf | grep -q "wifi_"
if [ $? -eq 1 ]; then
$L "data is mis-labeled, fixing..."
LABELDATA=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 [ $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
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