Add SELinux support

Change-Id: I11e1a3d018d921d96ba08915925b14bf633be6ed
diff --git a/twrp.cpp b/twrp.cpp
index bc3ce7b..04851aa 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -46,6 +46,11 @@
 #include "openrecoveryscript.hpp"
 #include "variables.h"
 
+#ifdef HAVE_SELINUX
+#include "selinux/label.h"
+struct selabel_handle *selinux_handle;
+#endif
+
 TWPartitionManager PartitionManager;
 int Log_Offset;
 
@@ -90,6 +95,17 @@
 	// Load up all the resources
 	gui_loadResources();
 
+#ifdef HAVE_SELINUX
+	struct selinux_opt selinux_options[] = {
+		{ SELABEL_OPT_PATH, "/file_contexts" }
+	};
+    selinux_handle = selabel_open(SELABEL_CTX_FILE, selinux_options, 1);
+	if (!selinux_handle)
+		printf("No file contexts for SELinux\n");
+	else
+		printf("SELinux contexts loaded from /file_contexts\n");
+#endif
+
 	PartitionManager.Mount_By_Path("/cache", true);
 
 	string Zip_File, Reboot_Value;