Introduce recovery option to pkgmgr_installer 16/45316/5
authorTomasz Iwanek <t.iwanek@samsung.com>
Tue, 4 Aug 2015 11:54:47 +0000 (13:54 +0200)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Tue, 26 Jan 2016 00:04:01 +0000 (16:04 -0800)
Pkgmgr declares enum value for recovery installaton
but there is no way for backend to run with this option
as there is missing parsing in pkgmgr_installer_receive_request
which backend is supposed to use.

Adding processing -b option as PKGMGR_REQ_RECOVER in
pkgmgr_installer API.

Note: app-installers backends will expect invocation:
  backend -b /home/guest/apps_rw/recovery-%%%%%%
where file is recovery file generated by interrupted
installation process.

Even the pkgmgr doesn't implements recovery now.
App-installer needs any command line opton to run this mode
when launched from commandline.

Optional parameter of recovery mode is recovery file but if
pkgmgr will support recovery in future, it is supposed that
this may change. This is set in this form for now.

Change-Id: I970607adcb4465e93a84eb774a0d75504cd443d2

comm/pkgmgr_installer.c
comm/pkgmgr_installer_config.h

index 17f400cf1b352e5151a6a4a021bfdfb7d461ef20..feda92c0a67eaf8e34c99b0f491282b899e5b835 100644 (file)
@@ -337,6 +337,18 @@ pkgmgr_installer_receive_request(pkgmgr_installer *pi,
                        pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
                        break;
 
+               case 'b': /* recovery */
+                       if (mode) {
+                               r = -EINVAL;
+                               goto RET;
+                       }
+                       mode = 'b';
+                       pi->request_type = PKGMGR_REQ_RECOVER;
+                       if (pi->pkgmgr_info)
+                               free(pi->pkgmgr_info);
+                       pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+                       break;
+
                        /* Otherwise */
                case '?':       /* Not an option */
                        break;
index babc36445184d05fa2caae02cf7894a9029713f8..8d61a30e9a9f319ac1dab8c0c80471699fabec97 100644 (file)
@@ -32,7 +32,7 @@ extern "C" {
 #endif
 
 /* Supported options */
-const char *short_opts = "k:l:i:d:c:m:t:o:r:p:s:e:M:y:q";
+const char *short_opts = "k:l:i:d:c:m:t:o:r:p:s:b:e:M:y:q";
 const struct option long_opts[] = {
        { "session-id", 1, NULL, 'k' },
        { "license-path", 1, NULL, 'l' },
@@ -48,6 +48,7 @@ const struct option long_opts[] = {
        { "tep-move", 1, NULL, 'M' },
        { "smack", 1, NULL, 's' },
        { "direct-manifest-install", 1, NULL, 'y' },
+       { "recovery", 1, NULL, 'b' },
        { 0, 0, 0, 0 }  /* sentinel */
 };