1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
|
//
// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
* @file InstallerDefs.h
*/
#ifndef _INSTALLER_DEFS_H_
#define _INSTALLER_DEFS_H_
#include "InstallerUtil.h"
#define OSP_INSTALLER_VERSION "version=[20131016.1]"
#define DIR_BIN L"/bin"
#define DIR_INFO L"/info"
#define DIR_RES L"/res"
#define DIR_DATA L"/data"
#define DIR_ICONS L"/icons"
#define DIR_SHARED L"/shared"
#define DIR_LIB L"/lib"
#define DIR_SETTING L"/setting"
#define DIR_CONTENTS L"/contents"
#define DIR_SHARED_RES L"/shared/res"
#define DIR_SHARED_DATA L"/shared/data"
#define DIR_SHARED_TRUSTED L"/shared/trusted"
#define SLP_DIR_BIN L"/bin"
#define SLP_DIR_RES L"/res"
#define SLP_DIR_DATA L"/data"
#define SLP_APP_PATH L"/opt/apps"
#define PATH_OPT_APPS L"/opt/apps"
#define PATH_USR_APPS L"/usr/apps"
#define PATH_OPT_USR L"/opt/usr"
#define PATH_OPT_USR_APPS L"/opt/usr/apps"
#define SLP_FONT_PATH L"/opt/share/fonts"
#define DIR_DESKTOP L"/opt/share/applications/%S.desktop"
#define PACKAGE_NAME_PREFIX_ORG L"org.tizen."
#define PACKAGE_NAME_RULE_ORG L"org.tizen.%ls#%s"
#define PACKAGE_NAME_RULE L"%ls.%s"
#define BACKUP_NAME_RULE L"_backup"
#define FILE_EXT_INFO L"info"
#define VERSION_INFO_FILE L"/info/version.info"
#define COMPAT_INFO_FILE L"/info/compat.info"
#define VIRTUAL_ROOT_INFO_FILE L"/info/virtualroot.info"
#define UISCALABILITY_INFO_FILE L"/uiscalability.info"
#define UITHEME_INFO_FILE L"/uitheme.info"
#define DISABLE_SCREEN_READER_INFO_FILE L"/disablescreenreader.info"
#define WEBSERVICE_INFO_FILE L"/info/webservice.info"
#define TYPE_INFO_FILE L"/info/type.info"
#define PACKAGE_XML_FILE L"/info/manifest.xml"
#define SIGNATURE1_XML_FILE L"/signature1.xml"
#define AUTHOR_SIGNATURE_XML_FILE L"/author-signature.xml"
#define UISCALABILITY_INFO L"1 %ls %ls %ls"
#define UITHEME_INFO L"1 %ls %ls"
#define CONFIG_PATH L"/usr/etc/installer-config.ini"
#define UIAPP_LOADER_PATH "/usr/lib/osp/osp-ui-app-loader" // UiApp
#define SERVICEAPP_LOADER_PATH "/usr/lib/osp/osp-service-app-loader" // ServiceApp
#define SYSTEMSERIVCE_LOADER_PATH "/usr/lib/osp/osp-system-service-loader" // System Service
#define IME_PATH "/opt/apps/scim/lib/scim-1.0/1.4.0/Helper"
#define SUB_MODE_APPCONTROL_NAME L"_AppControl"
#define APP_OWNER_ID 5000
#define APP_GROUP_ID 5000
#define PACKAGE_ID_LENGTH 10
#define APP_DIR_LENGTH 20
#define TEST_ARG_COUNT 1
#define COMMAND_ARG_COUNT 3
#define TERMINATE_RETRY_COUNT 300
#define DIR_OSP_APPLICATIONS_TEMP L"/opt/usr/apps/__@@osp_tmp@@__"
#define DIR_INSTALL_LOGS L"/opt/usr/apps/logs"
#define DIR_RO_PACKAGE_SYSTEM_MANIFEST L"/usr/share/packages/%ls.xml"
#define DIR_RW_PACKAGE_SYSTEM_MANIFEST L"/opt/share/packages/%ls.xml"
#define DIR_MEMORYCARD_OSP_APPLICATIONS L"/opt/storage/sdcard/apps"
#define DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP L"/opt/storage/sdcard/apps/__@@osp_tmp@@__"
#define DIR_RECOVERY_TPK L"/opt/share/packages/.recovery/tpk"
#define PERM_BASE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) // 0644
#define PERM_EXECUTE (S_IXUSR | S_IXGRP | S_IXOTH)
#define PERM_WRITE (S_IWUSR | S_IWGRP | S_IWOTH)
#define PERM_OWNER_ROOT 0
#define PERM_OWNER_APP 1
#define PERM_SMACK_0 0
#define PERM_SMACK_1 1
#define PERM_SMACK_2 2
#define PERM_SMACK_3 3
#define TIZEN_PRIVILEGE_WEB_SERVICE "http://tizen.org/privilege/web.service"
#define TIZEN_CATEGORY_IME "http://tizen.org/category/ime"
#define TIZEN_CATEGORY_HOMESCREEN "http://tizen.org/category/homescreen"
#define TIZEN_CATEGORY_LOCKSCREEN "http://tizen.org/category/lockscreen"
#define TIZEN_CATEGORY_MENUSCREEN "http://tizen.org/category/menuscreen"
#define TIZEN_CATEGORY_ANTIVIRUS "http://tizen.org/category/antivirus"
// custom metadata
#define METADATA_FONT L"http://developer.samsung.com/tizen/metadata/font"
#define METADATA_SPLASH L"http://developer.samsung.com/tizen/metadata/splash"
#define METADATA_SPLASH_INDICATOR_DISPLAY L"http://developer.samsung.com/tizen/metadata/splash/indicatordisplay"
#define METADATA_SPLASH_PORTRAIT L"http://developer.samsung.com/tizen/metadata/splash/portrait"
#define METADATA_SPLASH_LANDSCAPE L"http://developer.samsung.com/tizen/metadata/splash/landscape"
#define METADATA_DISABLE_SCREEN_READER L"http://developer.samsung.com/tizen/metadata/disablescreenreader"
#define DIR_APPLICATIONS_TMP "/opt/usr/apps/tmp"
#define INSTALLER_RDS_FILE_NAME ".rds_delta"
#define INSTALLER_RDS_DELETE_STR "delete"
#define INSTALLER_RDS_ADD_STR "add"
#define INSTALLER_RDS_MODIFY_STR "modify"
static const int INSTALLER_BLOCK_SIZE = 4096;
static const int SIGNATURE_FILE_NUMBER_DISTRIBUTOR = 1;
static const int SIGNATURE_FILE_NUMBER_DISTRIBUTOR2 = 2;
#define OSP_INSTALLER "osp-installer"
#ifdef AppLog
#undef AppLog
#define AppLog(...) AppLogTagInternal(OSP_INSTALLER, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, false, __VA_ARGS__);
#endif
#ifdef TryCatch
#undef TryCatch
#define TryCatch(condition, expr, ...) \
if (!(condition)) { \
AppLogExceptionTag(OSP_INSTALLER, __VA_ARGS__); \
expr; \
InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, true, __VA_ARGS__); \
goto CATCH; \
} \
else {;}
#endif
#ifdef TryReturn
#undef TryReturn
#define TryReturn(condition, returnValue, ...) \
if (!(condition)) { \
AppLogExceptionTag(OSP_INSTALLER, __VA_ARGS__); \
InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, true, __VA_ARGS__); \
return returnValue; \
} \
else {;}
#endif
enum InstallationSetStep
{
INSTALLER_STEP_REMOVE,
INSTALLER_STEP_SET,
};
enum InstallationState
{
INSTALLER_STATE_READY,
INSTALLER_STATE_RUNNING,
};
enum InstallationStep
{
INSTALLER_STEP_NONE = 0,
INSTALLER_STEP_INIT,
INSTALLER_STEP_CHECK_PACKAGE,
INSTALLER_STEP_DRM,
INSTALLER_STEP_PARSE_MANIFEST,
INSTALLER_STEP_CHECK_SYSTEM,
INSTALLER_STEP_UNPACK,
INSTALLER_STEP_LICENSE,
INSTALLER_STEP_PARSE_SIGNATURE,
INSTALLER_STEP_INIT_UNINSTALL,
INSTALLER_STEP_UNINSTALL,
INSTALLER_STEP_END,
INSTALLER_STEP_RDS_INIT,
INSTALLER_STEP_RDS,
INSTALLER_STEP_MAX,
};
enum InstallerType
{
INSTALLER_TYPE_INSTALLER,
INSTALLER_TYPE_PACKAGE,
INSTALLER_TYPE_DIRECTORY,
INSTALLER_TYPE_GUEST,
INSTALLER_TYPE_PRELOADED,
INSTALLER_TYPE_IDE,
INSTALLER_TYPE_RESTORATION,
};
enum InstallerOption
{
INSTALLER_OPTION_NONE = 0,
INSTALLER_OPTION_NORMAL = 1,
INSTALLER_OPTION_IDE = 2,
INSTALLER_OPTION_PRELOADED = 4,
INSTALLER_OPTION_HYBRID = 8,
INSTALLER_OPTION_NO_INPUT = 16,
INSTALLER_OPTION_FILELOG_ON = 32,
INSTALLER_OPTION_UPDATE_STDOUT = 64,
INSTALLER_OPTION_CSC = 128,
INSTALLER_OPTION_RESET_PRELOADED = 256,
};
enum InstallerError
{
INSTALLER_ERROR_NONE = 0,
INSTALLER_ERROR_PACKAGE_NOT_FOUND = 1,
INSTALLER_ERROR_PACKAGE_INVALID = 2,
INSTALLER_ERROR_PACKAGE_LOWER_VERSION = 3,
INSTALLER_ERROR_EXECUTABLE_NOT_FOUND = 4,
INSTALLER_ERROR_MANIFEST_NOT_FOUND = 11,
INSTALLER_ERROR_MANIFEST_INVALID = 12,
INSTALLER_ERROR_SIGNATURE_NOT_FOUND = 21,
INSTALLER_ERROR_SIGNATURE_INVALID = 22,
INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED = 23,
INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND = 31,
INSTALLER_ERROR_CERTIFICATE_INVALID = 32,
INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED = 33,
INSTALLER_ERROR_CERTIFICATE_EXPIRED = 34,
INSTALLER_ERROR_PRIVILEGE_INVALID = 41,
INSTALLER_ERROR_MENU_ICON_NOT_FOUND = 51,
INSTALLER_ERROR_FATAL_ERROR = 61,
INSTALLER_ERROR_OUT_OF_STORAGE = 62,
INSTALLER_ERROR_OUT_OF_MEMORY = 63,
INSTALLER_ERROR_DISABLED = 65,
INSTALLER_ERROR_PRIVILEGE_BLACKLIST = 66,
INSTALLER_ERROR_SIGNATURE_BLACKLIST = 67,
INSTALLER_ERROR_USER_CANCEL = 141,
INSTALLER_ERROR_UNMOUNT_FAILED = 142,
INSTALLER_ERROR_INTERNAL_STATE = 143,
INSTALLER_ERROR_DATABASE = 144,
INSTALLER_ERROR_DRM = 145,
INSTALLER_ERROR_BACKUP_FAILED = 146,
};
enum InstallerOperation
{
INSTALLER_OPERATION_INSTALL,
INSTALLER_OPERATION_UNINSTALL,
INSTALLER_OPERATION_REINSTALL,
};
enum RootCertificateType
{
ROOT_CERTIFICATE_NONE = 0,
ROOT_CERTIFICATE_DEVELOPER,
ROOT_CERTIFICATE_PUBLIC,
ROOT_CERTIFICATE_PARTNER,
ROOT_CERTIFICATE_PARTNER_OPERATOR,
ROOT_CERTIFICATE_PARTNER_MANUFACTURER,
ROOT_CERTIFICATE_CERT_SVC_PUBLIC = (1 << 6),
ROOT_CERTIFICATE_CERT_SVC_PARTNER = (1 << 7),
ROOT_CERTIFICATE_CERT_SVC_PARTNER_OPERATOR = (1 << 8),
ROOT_CERTIFICATE_CERT_SVC_PARTNER_MANUFACTURER = (1 << 9),
ROOT_CERTIFICATE_CERT_SVC_PLATFORM = (1 << 10),
};
enum SignatureFileType
{
SIGNATURE_FILE_TYPE_NONE,
SIGNATURE_FILE_TYPE_AUTHOR,
SIGNATURE_FILE_TYPE_DISTRIBUTOR,
SIGNATURE_FILE_TYPE_DISTRIBUTOR2,
};
enum
{
INSTALLER_MODE_INSTALL = 1,
INSTALLER_MODE_UNINSTALL = 2,
INSTALLER_MODE_RECURSIVE_DIRECTORY_INSTALL = 3,
INSTALLER_MODE_REINSTALL = 4,
INSTALLER_MODE_PARSE_CSC_STRING = 5,
INSTALLER_MODE_RECOVERY = 6,
};
enum CategoryType
{
CATEGORY_TYPE_NONE,
CATEGORY_TYPE_IME,
CATEGORY_TYPE_HOME_SCREEN,
CATEGORY_TYPE_LOCK_SCREEN,
};
enum InstallationStorage
{
INSTALLATION_STORAGE_NONE,
INSTALLATION_STORAGE_INTERNAL,
INSTALLATION_STORAGE_EXTERNAL,
};
enum InstallerRdsState
{
INSTALLER_RDS_STATE_NONE,
INSTALLER_RDS_STATE_DELETE,
INSTALLER_RDS_STATE_ADD,
INSTALLER_RDS_STATE_MODIFY,
};
typedef struct
{
const char* pDir;
int dirType;
int ownerIndex;
int modeIndex;
int smackIndex;
} RdsPermssions;
enum PermDirType
{
PERM_DIR_RES = 0,
PERM_DIR_DATA = 1,
PERM_DIR_BIN = 2,
PERM_DIR_INFO = 3,
PERM_DIR_LIB = 4,
PERM_DIR_SETTING = 5,
PERM_DIR_SHARED_RES = 6,
PERM_DIR_SHARED_DATA = 7,
PERM_DIR_SHARED_TRUSTED = 8,
PERM_DIR_SHARED = 9,
PERM_DIR_ROOT = 10,
};
enum PrivilegeLevel
{
PRIVILEGE_LEVEL_PUBLIC,
PRIVILEGE_LEVEL_PARTNER,
PRIVILEGE_LEVEL_PLATFORM,
};
#endif // _INSTALLER_DEFS_H_
|