Block different type installation with same pkgid
[platform/core/appfw/app-installers.git] / src / common / step / configuration / step_configure.h
1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMMON_STEP_CONFIGURATION_STEP_CONFIGURE_H_
6 #define COMMON_STEP_CONFIGURATION_STEP_CONFIGURE_H_
7
8 #include <manifest_parser/utils/logging.h>
9
10 #include "common/installer_context.h"
11
12 #include "common/pkgmgr_interface.h"
13 #include "common/step/step.h"
14
15 namespace common_installer {
16 namespace configuration {
17
18 /**
19  * \brief Installation,Update, Deinstallation, RDS.
20  *        Responsible for filling InstallerContext based on the request type.
21  *
22  * Based on started request, process fills InstallerContext with proper data.
23  */
24 class StepConfigure : public Step {
25  public:
26   /**
27    * \brief Constuctor
28    *
29    * \param context pointer to InstallerContext structure
30    * \param pkgmgr pointer to Pkgmgr interface
31    */
32   StepConfigure(InstallerContext* context, PkgMgrPtr pkgmgr);
33
34   /**
35    * \brief configuration based on pacakge typ, request mode, user
36    *
37    * \return Status::OK if success, Status::ERROR otherwise
38    */
39   Status process() override;
40
41   /**
42    * \brief Recovery file reset
43    *
44    * \return Status::OK
45    */
46   Status clean() override { return Status::OK; }
47
48   Status undo() override { return Status::OK; }
49
50   /**
51    * \brief checks, if backend not launched with root uid
52    *
53    * \return Status::OK if normal user, Status::ERROR if root
54    */
55   Status precheck() override;
56
57  private:
58   bool SetupRootAppDirectory();
59   void SetupRequestMode(uid_t uid);
60   void SetupRequestType();
61   void SetupFileCreationMask();
62   void SetupIsPreloadRequest();
63   void SetupIsPreloadRWRequest();
64   void SetupIsForceRemoval();
65   void SetupIsNoRemoval();
66   void SetupIsKeepRWData();
67   void SetupIsPartialRW();
68   void SetupDebugMode();
69   void SetupSkipCheckReference();
70   void SetupSkipOptimization();
71   void SetupMoveType();
72   std::string GetPkgIdFromFile();
73   bool CheckInvalidBackendUsage();
74
75   PkgMgrPtr pkgmgr_;
76
77   STEP_NAME(Configure)
78 };
79
80 }  // namespace configuration
81 }  // namespace common_installer
82
83 #endif  // COMMON_STEP_CONFIGURATION_STEP_CONFIGURE_H_