installd: insert one backdoor to support boot via nfs

when boot via nfs, we need the install usr on nfs server to have the
chown permission as it does on android. but that's no easy to do with
setting of nfs. so we will make the install to run as root via the
property hack.installd.for.nfs set to 1 when want to boot via nfs

Change-Id: I101849f9b7f55b9e8dd657ae321cf9341ddc7d02
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index c918633..3bd5e42 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -525,6 +525,7 @@
     struct sockaddr addr;
     socklen_t alen;
     int lsocket, s, count;
+    char nfs_hack_flag[PROPERTY_VALUE_MAX];
 
     ALOGI("installd firing up\n");
 
@@ -538,7 +539,12 @@
         exit(1);
     }
 
-    drop_privileges();
+    property_get("hack.installd.for.nfs", nfs_hack_flag, "0");
+    if(!strcmp(nfs_hack_flag, "1")) {
+        ALOGI("Will not drop the privileges of installd service since hack.installd.for.nfs=%s.\n", nfs_hack_flag);
+    }else{
+        drop_privileges();
+    }
 
     lsocket = android_get_control_socket(SOCKET_PATH);
     if (lsocket < 0) {