2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file InstallerDefs.h
21 #ifndef _INSTALLER_DEFS_H_
22 #define _INSTALLER_DEFS_H_
24 #include "InstallerUtil.h"
26 #define OSP_INSTALLER_VERSION "version=[20130628.1]"
28 #define DIR_BIN L"/bin"
29 #define DIR_INFO L"/info"
30 #define DIR_RES L"/res"
31 #define DIR_DATA L"/data"
32 #define DIR_ICONS L"/icons"
33 #define DIR_SHARED L"/shared"
34 #define DIR_LIB L"/lib"
35 #define DIR_SETTING L"/setting"
36 #define DIR_CONTENTS L"/contents"
37 #define DIR_SHARED_RES L"/shared/res"
38 #define DIR_SHARED_DATA L"/shared/data"
39 #define DIR_SHARED_TRUSTED L"/shared/trusted"
40 #define DIR_VIRTUAL_ROOT L"/virtual-root"
42 #define SLP_DIR_BIN L"/bin"
43 #define SLP_DIR_RES L"/res"
44 #define SLP_DIR_DATA L"/data"
45 #define SLP_APP_PATH L"/opt/apps"
47 #define PATH_OPT_APPS L"/opt/apps"
48 #define PATH_USR_APPS L"/usr/apps"
49 #define PATH_OPT_USR L"/opt/usr"
50 #define PATH_OPT_USR_APPS L"/opt/usr/apps"
52 #define SLP_FONT_PATH L"/opt/share/fonts"
54 #define DIR_DESKTOP L"/opt/share/applications/%S.desktop"
55 #define PACKAGE_NAME_PREFIX_ORG L"org.tizen."
56 #define PACKAGE_NAME_RULE_ORG L"org.tizen.%ls#%s"
58 #define PACKAGE_NAME_RULE L"%ls.%s"
60 #define FILE_EXT_INFO L"info"
61 #define VERSION_INFO_FILE L"/info/version.info"
62 #define COMPAT_INFO_FILE L"/info/compat.info"
63 #define VIRTUAL_ROOT_INFO_FILE L"/info/virtualroot.info"
64 #define UISCALABILITY_INFO_FILE L"/info/uiscalability.info"
65 #define WEBSERVICE_INFO_FILE L"/info/webservice.info"
66 #define TYPE_INFO_FILE L"/info/type.info"
67 #define PACKAGE_XML_FILE L"/info/manifest.xml"
69 #define SIGNATURE1_XML_FILE L"/signature1.xml"
70 #define AUTHOR_SIGNATURE_XML_FILE L"/author-signature.xml"
72 #define UISCALABILITY_INFO L"1 %ls %ls %ls"
74 #define CONFIG_PATH L"/usr/etc/installer-config.ini"
76 #define UIAPP_LOADER_PATH "/usr/lib/osp/osp-ui-app-loader" // UiApp
77 #define SERVICEAPP_LOADER_PATH "/usr/lib/osp/osp-service-app-loader" // ServiceApp
78 #define SYSTEMSERIVCE_LOADER_PATH "/usr/lib/osp/osp-system-service-loader" // System Service
79 #define IME_PATH "/opt/apps/scim/lib/scim-1.0/1.4.0/Helper"
81 #define SUB_MODE_APPCONTROL_NAME L"_AppControl"
83 #define APP_OWNER_ID 5000
84 #define APP_GROUP_ID 5000
86 #define PACKAGE_ID_LENGTH 10
87 #define APP_DIR_LENGTH 20
89 #define TEST_ARG_COUNT 1
90 #define COMMAND_ARG_COUNT 3
91 #define TERMINATE_RETRY_COUNT 300
93 #define DIR_OSP_APPLICATIONS_TEMP L"/opt/usr/apps/__@@osp_tmp@@__"
94 #define DIR_INSTALL_LOGS L"/opt/usr/apps/logs"
96 #define DIR_RO_PACKAGE_SYSTEM_MANIFEST L"/usr/share/packages/%ls.xml"
97 #define DIR_RW_PACKAGE_SYSTEM_MANIFEST L"/opt/share/packages/%ls.xml"
99 #define DIR_MEMORYCARD_OSP_APPLICATIONS L"/opt/storage/sdcard/apps"
100 #define DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP L"/opt/storage/sdcard/apps/__@@osp_tmp@@__"
101 #define DIR_MEMORYCARD_INSTALLATION L"/opt/storage/sdcard/installtosdcard"
103 #define PERM_BASE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) // 0644
104 #define PERM_EXECUTE (S_IXUSR | S_IXGRP | S_IXOTH)
105 #define PERM_WRITE (S_IWUSR | S_IWGRP | S_IWOTH)
107 #define PERM_OWNER_ROOT 0
108 #define PERM_OWNER_APP 1
110 #define PERM_SMACK_0 0
111 #define PERM_SMACK_1 1
112 #define PERM_SMACK_2 2
113 #define PERM_SMACK_3 3
115 #define TIZEN_PRIVILEGE_WEB_SERVICE "http://tizen.org/privilege/web.service"
116 #define TIZEN_CATEGORY_IME "http://tizen.org/category/ime"
117 #define TIZEN_CATEGORY_HOMESCREEN "http://tizen.org/category/homescreen"
118 #define TIZEN_CATEGORY_LOCKSCREEN "http://tizen.org/category/lockscreen"
119 #define TIZEN_CATEGORY_MENUSCREEN "http://tizen.org/category/menuscreen"
120 #define TIZEN_CATEGORY_ANTIVIRUS "http://tizen.org/category/antivirus"
123 #define METADATA_FONT L"http://developer.samsung.com/tizen/metadata/font"
124 #define METADATA_SPLASH L"http://developer.samsung.com/tizen/metadata/splash"
125 #define METADATA_SPLASH_INDICATOR_DISPLAY L"http://developer.samsung.com/tizen/metadata/splash/indicatordisplay"
126 #define METADATA_SPLASH_PORTRAIT L"http://developer.samsung.com/tizen/metadata/splash/portrait"
127 #define METADATA_SPLASH_LANDSCAPE L"http://developer.samsung.com/tizen/metadata/splash/landscape"
129 #define DIR_APPLICATIONS_TMP "/opt/usr/apps/tmp"
131 #define INSTALLER_RDS_FILE_NAME ".rds_delta"
132 #define INSTALLER_RDS_DELETE_STR "delete"
133 #define INSTALLER_RDS_ADD_STR "add"
134 #define INSTALLER_RDS_MODIFY_STR "modify"
136 static const int INSTALLER_BLOCK_SIZE = 4096;
137 static const int SIGNATURE_FILE_NUMBER_DISTRIBUTOR = 1;
138 static const int SIGNATURE_FILE_NUMBER_DISTRIBUTOR2 = 2;
140 #define OSP_INSTALLER "osp-installer"
144 #define AppLog(...) AppLogTagInternal(OSP_INSTALLER, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
145 InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, false, __VA_ARGS__);
150 #define TryCatch(condition, expr, ...) \
151 if (!(condition)) { \
152 AppLogExceptionTag(OSP_INSTALLER, __VA_ARGS__); \
154 InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, true, __VA_ARGS__); \
162 #define TryReturn(condition, returnValue, ...) \
163 if (!(condition)) { \
164 AppLogExceptionTag(OSP_INSTALLER, __VA_ARGS__); \
165 InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, true, __VA_ARGS__); \
166 return returnValue; \
171 enum InstallationSetStep
173 INSTALLER_STEP_REMOVE,
178 enum InstallationState
180 INSTALLER_STATE_READY,
181 INSTALLER_STATE_RUNNING,
185 enum InstallationStep
187 INSTALLER_STEP_NONE = 0,
189 INSTALLER_STEP_CHECK_PACKAGE,
191 INSTALLER_STEP_PARSE_MANIFEST,
192 INSTALLER_STEP_CHECK_SYSTEM,
193 INSTALLER_STEP_UNPACK,
194 INSTALLER_STEP_LICENSE,
195 INSTALLER_STEP_PARSE_SIGNATURE,
197 INSTALLER_STEP_INIT_UNINSTALL,
198 INSTALLER_STEP_UNINSTALL,
201 INSTALLER_STEP_RDS_INIT,
210 INSTALLER_TYPE_INSTALLER,
211 INSTALLER_TYPE_PACKAGE,
212 INSTALLER_TYPE_DIRECTORY,
213 INSTALLER_TYPE_GUEST,
214 INSTALLER_TYPE_PRELOADED,
216 INSTALLER_TYPE_RESTORATION,
222 INSTALLER_OPTION_NONE = 0,
223 INSTALLER_OPTION_NORMAL = 1,
224 INSTALLER_OPTION_IDE = 2,
225 INSTALLER_OPTION_PRELOADED = 4,
226 INSTALLER_OPTION_HYBRID = 8,
227 INSTALLER_OPTION_NO_INPUT = 16,
228 INSTALLER_OPTION_FILELOG_ON = 32,
229 INSTALLER_OPTION_UPDATE_STDOUT = 64,
230 INSTALLER_OPTION_CSC = 128,
231 INSTALLER_OPTION_RESET_PRELOADED = 256,
237 INSTALLER_ERROR_NONE = 0,
238 INSTALLER_ERROR_PACKAGE_NOT_FOUND = 1,
239 INSTALLER_ERROR_PACKAGE_INVALID = 2,
240 INSTALLER_ERROR_PACKAGE_LOWER_VERSION = 3,
241 INSTALLER_ERROR_EXECUTABLE_NOT_FOUND = 4,
242 INSTALLER_ERROR_MANIFEST_NOT_FOUND = 11,
243 INSTALLER_ERROR_MANIFEST_INVALID = 12,
244 INSTALLER_ERROR_SIGNATURE_NOT_FOUND = 21,
245 INSTALLER_ERROR_SIGNATURE_INVALID = 22,
246 INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED = 23,
247 INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND = 31,
248 INSTALLER_ERROR_CERTIFICATE_INVALID = 32,
249 INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED = 33,
250 INSTALLER_ERROR_CERTIFICATE_EXPIRED = 34,
251 INSTALLER_ERROR_PRIVILEGE_INVALID = 41,
252 INSTALLER_ERROR_MENU_ICON_NOT_FOUND = 51,
253 INSTALLER_ERROR_FATAL_ERROR = 61,
254 INSTALLER_ERROR_OUT_OF_STORAGE = 62,
255 INSTALLER_ERROR_OUT_OF_MEMORY = 63,
257 INSTALLER_ERROR_USER_CANCEL = 141,
258 INSTALLER_ERROR_UNMOUNT_FAILED = 142,
259 INSTALLER_ERROR_INTERNAL_STATE = 143,
260 INSTALLER_ERROR_DATABASE = 144,
261 INSTALLER_ERROR_DRM = 145,
264 enum InstallerOperation
266 INSTALLER_OPERATION_INSTALL,
267 INSTALLER_OPERATION_UNINSTALL,
268 INSTALLER_OPERATION_REINSTALL,
272 enum RootCertificateType
274 ROOT_CERTIFICATE_NONE = 0,
275 ROOT_CERTIFICATE_DEVELOPER,
276 ROOT_CERTIFICATE_PUBLIC,
277 ROOT_CERTIFICATE_PARTNER,
278 ROOT_CERTIFICATE_PARTNER_OPERATOR,
279 ROOT_CERTIFICATE_PARTNER_MANUFACTURER,
281 ROOT_CERTIFICATE_CERT_SVC_PUBLIC = (1 << 6),
282 ROOT_CERTIFICATE_CERT_SVC_PARTNER = (1 << 7),
283 ROOT_CERTIFICATE_CERT_SVC_PARTNER_OPERATOR = (1 << 8),
284 ROOT_CERTIFICATE_CERT_SVC_PARTNER_MANUFACTURER = (1 << 9),
285 ROOT_CERTIFICATE_CERT_SVC_PLATFORM = (1 << 10),
289 enum SignatureFileType
291 SIGNATURE_FILE_TYPE_NONE,
292 SIGNATURE_FILE_TYPE_AUTHOR,
293 SIGNATURE_FILE_TYPE_DISTRIBUTOR,
294 SIGNATURE_FILE_TYPE_DISTRIBUTOR2,
300 INSTALLER_MODE_INSTALL = 1,
301 INSTALLER_MODE_UNINSTALL = 2,
302 INSTALLER_MODE_RECURSIVE_DIRECTORY_INSTALL = 3,
303 INSTALLER_MODE_REINSTALL = 4,
304 INSTALLER_MODE_PARSE_CSC_STRING = 5,
311 CATEGORY_TYPE_HOME_SCREEN,
312 CATEGORY_TYPE_LOCK_SCREEN,
316 enum InstallationStorage
318 INSTALLATION_STORAGE_NONE,
319 INSTALLATION_STORAGE_INTERNAL,
320 INSTALLATION_STORAGE_EXTERNAL,
324 enum InstallerRdsState
326 INSTALLER_RDS_STATE_NONE,
327 INSTALLER_RDS_STATE_DELETE,
328 INSTALLER_RDS_STATE_ADD,
329 INSTALLER_RDS_STATE_MODIFY,
350 PERM_DIR_SETTING = 5,
351 PERM_DIR_SHARED_RES = 6,
352 PERM_DIR_SHARED_DATA = 7,
353 PERM_DIR_SHARED_TRUSTED = 8,
360 PRIVILEGE_LEVEL_PUBLIC,
361 PRIVILEGE_LEVEL_PARTNER,
362 PRIVILEGE_LEVEL_PLATFORM,
366 #endif // _INSTALLER_DEFS_H_