[mobile][account][Change path for supporting global user] 14/111314/1
authormengli.zhang <mengli.zhang@samsung.com>
Fri, 20 Jan 2017 18:28:55 +0000 (13:28 -0500)
committermengli.zhang <mengli.zhang@samsung.com>
Fri, 20 Jan 2017 18:29:00 +0000 (13:29 -0500)
Change-Id: If760121ec68aed643661831d57406c81f863ad95
Signed-off-by: mengli.zhang <mengli.zhang@samsung.com>
mobile/tct-account-tizen-tests/askpolicy.sh [new file with mode: 0755]
mobile/tct-account-tizen-tests/inst.wgt.py
mobile/tct-account-tizen-tests/suite.json

diff --git a/mobile/tct-account-tizen-tests/askpolicy.sh b/mobile/tct-account-tizen-tests/askpolicy.sh
new file mode 100755 (executable)
index 0000000..1c39bdd
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+for i in `grep -r "0xA" /var/cynara/db/_ | grep $1`
+do
+    CLIENT=`echo $i | cut -d ";" -f1`
+    USER=`echo $i | cut -d ";" -f2`
+    PRIVILEGE=`echo $i | cut -d ";" -f3`
+    #echo "cyad --erase=\"\" -r=no -c $CLIENT -u $USER -p $PRIVILEGE"
+    cyad --erase="" -r=no -c $CLIENT -u $USER -p $PRIVILEGE
+done
index 5b1718da169ebc796a16962b47a209f160af24d9..2316502f49110c5656326bade9353be9d7932cdd 100644 (file)
@@ -20,8 +20,32 @@ tct_parser = ConfigParser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
+EXECUTION_MODE_30 = tct_parser.get('DEVICE', 'DEVICE_EXECUTION_MODE_30')
+ADMIN_USER_30 = tct_parser.get('DEVICE', 'DEVICE_ADMIN_USER_30')
 
+def userCheck():
+    global GLOVAL_OPT
+    if ADMIN_USER_30 == EXECUTION_MODE_30:
+        GLOVAL_OPT="--global"
+    else:
+        GLOVAL_OPT=""
 
+def askpolicyremoving():
+    for root, dirs, files in os.walk(SCRIPT_DIR):
+        for file in files:
+            if file.endswith(".wgt"):
+                pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0]))
+   
+    print pkg_id
+    print (os.getcwd())
+    print (os.path.dirname(os.path.realpath(__file__)) )
+    if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)):
+        action_status = False
+    if PARAMETERS.mode == "SDB":
+        cmd = "sdb -s %s shell .%s/askpolicy.sh %s" % (PARAMETERS.device, 
+        SRC_DIR, pkg_id)
+    return doCMD(cmd)
+       
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
     print "-->> \"%s\"" % cmd
@@ -116,7 +140,7 @@ def uninstPKGs():
                     action_status = False
                     continue
                 (return_code, output) = doRemoteCMD(
-                    "pkgcmd -u -t wgt -q -n %s" % pkg_id)
+                    "pkgcmd %s -u -t wgt -q -n %s" % (GLOVAL_OPT, pkg_id))
                 for line in output:
                     if "Failure" in line:
                         action_status = False
@@ -145,7 +169,7 @@ def instPKGs():
                 if not doRemoteCopy(os.path.join(root, file), "%s/%s" % (SRC_DIR, file)):
                     action_status = False
                 (return_code, output) = doRemoteCMD(
-                    "pkgcmd -i -t wgt -q -p %s/%s" % (SRC_DIR, file))
+                    "pkgcmd %s -i -t wgt -q -p %s/%s" % (GLOVAL_OPT, SRC_DIR, file))
                 doRemoteCMD("rm -rf %s/%s" % (SRC_DIR, file))
                 for line in output:
                     if "Failure" in line:
@@ -187,7 +211,7 @@ def main():
         sys.exit(1)
 
     if not PARAMETERS.user:
-        PARAMETERS.user = "owner"
+        PARAMETERS.user = EXECUTION_MODE_30
     if not PARAMETERS.mode:
         PARAMETERS.mode = "SDB"
 
@@ -205,6 +229,8 @@ def main():
         print "No device provided"
         sys.exit(1)
 
+    userCheck()
+
     user_info = getUSERID()
     re_code = user_info[0]
     if re_code == 0 :
@@ -223,6 +249,7 @@ def main():
             sys.exit(1)
     else:
         if not instPKGs():
+            #askpolicyremoving()
             sys.exit(1)
 
 if __name__ == "__main__":
index 1b75998f845ec3b5efea192956f4c4daf03a9da3..de5315a053cbabee9949363e18d9306f88f54471 100644 (file)
@@ -17,6 +17,7 @@
             ],
             "copylist": {
                 "inst.wgt.py": "inst.py",
+                "askpolicy.sh": "askpolicy.sh",
                 "tests.full.xml": "tests.full.xml",
                 "tests.xml": "tests.xml"
             },