Support activation with label-change. 07/106207/5
authorjongmyeongko <jongmyeong.ko@samsung.com>
Wed, 21 Dec 2016 04:26:32 +0000 (13:26 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Wed, 21 Dec 2016 11:16:38 +0000 (20:16 +0900)
Now, 'L' option is only for the test purpose.

usage:
(1) at fist, disable test app.
$pkgcmd -D -t tpk -n org.example.test (--global)
(2) next, enable with lable changed;
$pkgcmd -L new_label -t tpk -n org.example.test (--global)

Change-Id: I327aca8265d04ef89a16ee0e7c086032039c8843
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/pkg_cmd.c

index fc39f85e6e9e5c0388a21861da02cd9a41dc06b0..8c74bb827d6e286e2a81687b999416fb1e07eb53 100644 (file)
@@ -858,6 +858,19 @@ static int __process_request(uid_t target_uid)
                        break;
                }
 
+               if (strlen(data.label) != 0) {
+                       printf("requested label = %s\n", data.label);
+
+                       ret = pkgmgr_client_usr_set_app_label(pc, data.pkgid,
+                               data.label, target_uid);
+                       if (ret < 0) {
+                               printf("set_app_label is failed\n");
+                               break;
+                       }
+
+                       printf("set_app_label is done\n");
+               }
+
                if (strcmp(data.pkg_type, "app") == 0) {
                        if (data.global)
                                /* enable global app for this user only */
@@ -1255,7 +1268,7 @@ int main(int argc, char *argv[])
                case 'L':  /* activate with Label */
                        data.request = ACTIVATE_REQ;
                        if (optarg)
-                               snprintf(data.pkg_path, sizeof(data.pkg_path),
+                               snprintf(data.label, sizeof(data.label),
                                                "%s", optarg);
                        break;