@webos-tools/cli 3.1.3 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1396) hide show
  1. package/.eslintignore +1 -1
  2. package/.eslintrc.js +52 -52
  3. package/APIs.js +79 -79
  4. package/CHANGELOG.md +32 -4
  5. package/LICENSE +201 -201
  6. package/README.md +226 -219
  7. package/bin/ares-config.js +211 -202
  8. package/bin/ares-device-info.js +30 -30
  9. package/bin/ares-device.js +222 -219
  10. package/bin/ares-generate.js +274 -274
  11. package/bin/ares-inspect.js +179 -179
  12. package/bin/ares-install.js +223 -223
  13. package/bin/ares-launch.js +318 -318
  14. package/bin/ares-log.js +259 -259
  15. package/bin/ares-novacom.js +220 -220
  16. package/bin/ares-package.js +347 -336
  17. package/bin/ares-pull.js +156 -156
  18. package/bin/ares-push.js +155 -155
  19. package/bin/ares-server.js +174 -174
  20. package/bin/ares-setup-device.js +10 -6
  21. package/bin/ares-shell.js +132 -132
  22. package/bin/ares.js +166 -166
  23. package/files/conf/ares.json +50 -49
  24. package/files/conf/command-service.json +78 -73
  25. package/files/conf/config.json +31 -31
  26. package/files/conf/ipk.json +30 -30
  27. package/files/conf/novacom-devices.json +69 -52
  28. package/files/conf/query/query-app.json +14 -14
  29. package/files/conf/query/query-hosted.json +18 -18
  30. package/files/conf/query/query-package.json +10 -10
  31. package/files/conf/query/query-service.json +6 -6
  32. package/files/conf/sdk.json +8 -8
  33. package/files/conf/template.json +57 -57
  34. package/files/conf/webos_emul +27 -27
  35. package/files/conf-base/env/sdk-apollo.json +8 -8
  36. package/files/conf-base/env/sdk-ose.json +8 -8
  37. package/files/conf-base/env/sdk-signage.json +8 -0
  38. package/files/conf-base/env/sdk-tv.json +8 -8
  39. package/files/conf-base/key/pubkey-signage.pem +9 -0
  40. package/files/conf-base/profile/config-apollo.json +29 -29
  41. package/files/conf-base/profile/config-ose.json +29 -29
  42. package/files/conf-base/profile/config-signage.json +29 -0
  43. package/files/conf-base/profile/config-tv.json +31 -31
  44. package/files/conf-base/query/query-app.json +14 -14
  45. package/files/conf-base/query/query-hosted.json +18 -18
  46. package/files/conf-base/query/query-package.json +10 -10
  47. package/files/conf-base/query/query-service.json +6 -6
  48. package/files/conf-base/query/signage/query-app.json +14 -0
  49. package/files/conf-base/query/signage/query-service.json +6 -0
  50. package/files/conf-base/template-conf/ose-templates.json +67 -67
  51. package/files/conf-base/template-conf/signage-sdk-templates.json +239 -0
  52. package/files/conf-base/template-conf/tv-sdk-templates.json +57 -57
  53. package/files/help/ares-config.help +48 -48
  54. package/files/help/ares-device.help +109 -109
  55. package/files/help/ares-generate.help +101 -91
  56. package/files/help/ares-inspect.help +77 -76
  57. package/files/help/ares-install.help +95 -95
  58. package/files/help/ares-launch.help +111 -105
  59. package/files/help/ares-log-pmlogd.help +84 -84
  60. package/files/help/ares-log.help +101 -101
  61. package/files/help/ares-novacom.help +68 -68
  62. package/files/help/ares-package.help +103 -101
  63. package/files/help/ares-pull.help +38 -38
  64. package/files/help/ares-push.help +38 -38
  65. package/files/help/ares-server.help +44 -44
  66. package/files/help/ares-setup-device.help +196 -156
  67. package/files/help/ares-shell.help +42 -42
  68. package/files/help/ares.help +52 -52
  69. package/files/help/readme.help +23 -23
  70. package/files/schema/ApplicationDescription.schema +319 -319
  71. package/files/schema/NovacomDevices.schema +63 -62
  72. package/files/templates/apollo-sdk-templates/appinfo/appinfo.json +10 -10
  73. package/files/templates/apollo-sdk-templates/bootplate-web/index.html +88 -88
  74. package/files/templates/apollo-sdk-templates/hosted-webapp/index.html +13 -13
  75. package/files/templates/apollo-sdk-templates/js-service/helloclient.js +31 -31
  76. package/files/templates/apollo-sdk-templates/js-service/helloworld_webos_service.js +188 -188
  77. package/files/templates/apollo-sdk-templates/serviceinfo/package.json +11 -11
  78. package/files/templates/apollo-sdk-templates/serviceinfo/services.json +8 -8
  79. package/files/templates/ose-sdk-templates/appinfo/appinfo.json +10 -10
  80. package/files/templates/ose-sdk-templates/bootplate-web/index.html +88 -88
  81. package/files/templates/ose-sdk-templates/hosted-webapp/index.html +13 -13
  82. package/files/templates/ose-sdk-templates/js-service/helloclient.js +31 -31
  83. package/files/templates/ose-sdk-templates/js-service/helloworld_webos_service.js +188 -188
  84. package/files/templates/ose-sdk-templates/qml-app/main.qml +68 -68
  85. package/files/templates/ose-sdk-templates/qmlappinfo/appinfo.json +10 -10
  86. package/files/templates/ose-sdk-templates/serviceinfo/package.json +11 -11
  87. package/files/templates/ose-sdk-templates/serviceinfo/services.json +8 -8
  88. package/files/templates/signage-sdk-templates/Backlight_Scheduling/clockTable.js +29 -0
  89. package/files/templates/signage-sdk-templates/Backlight_Scheduling/index.html +53 -0
  90. package/files/templates/signage-sdk-templates/Backlight_Scheduling/js/idcap.js +21 -0
  91. package/files/templates/signage-sdk-templates/Backlight_Scheduling/remocon.js +214 -0
  92. package/files/templates/signage-sdk-templates/Backlight_Scheduling/scheduler.js +123 -0
  93. package/files/templates/signage-sdk-templates/Backlight_Scheduling/setanddelete.js +25 -0
  94. package/files/templates/signage-sdk-templates/Backlight_Scheduling/style.css +213 -0
  95. package/files/templates/signage-sdk-templates/Download_Progress/app.css +27 -0
  96. package/files/templates/signage-sdk-templates/Download_Progress/app.js +407 -0
  97. package/files/templates/signage-sdk-templates/Download_Progress/index.html +32 -0
  98. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova/2.7.0/cordova.webos.js +7038 -0
  99. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova/LICENSE +201 -0
  100. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.0/configuration.js +1 -0
  101. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.0/deviceInfo.js +1 -0
  102. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.0/inputSource.js +1 -0
  103. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.0/power.js +1 -0
  104. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.0/signage.js +1 -0
  105. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.0/sound.js +1 -0
  106. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.0/storage.js +1 -0
  107. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.0/video.js +1 -0
  108. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.1/configuration.js +1 -0
  109. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.1/deviceInfo.js +1 -0
  110. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.1/inputSource.js +1 -0
  111. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.1/power.js +1 -0
  112. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.1/signage.js +1 -0
  113. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.1/sound.js +1 -0
  114. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.1/storage.js +1 -0
  115. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.1/video.js +1 -0
  116. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.2/configuration.js +1 -0
  117. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.2/deviceInfo.js +1 -0
  118. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.2/inputSource.js +1 -0
  119. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.2/power.js +1 -0
  120. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.2/signage.js +1 -0
  121. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.2/sound.js +1 -0
  122. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.2/storage.js +23 -0
  123. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.2/video.js +1 -0
  124. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.3/configuration.js +1 -0
  125. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.3/deviceInfo.js +1 -0
  126. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.3/inputSource.js +1 -0
  127. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.3/power.js +1 -0
  128. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.3/signage.js +1 -0
  129. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.3/sound.js +1 -0
  130. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.3/storage.js +1 -0
  131. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.3/video.js +1 -0
  132. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/configuration.js +9 -0
  133. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/deviceInfo.js +9 -0
  134. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/inputSource.js +9 -0
  135. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/power.js +9 -0
  136. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/security.js +9 -0
  137. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/signage.js +9 -0
  138. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/sound.js +9 -0
  139. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/storage.js +9 -0
  140. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/time.js +9 -0
  141. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/utility.js +9 -0
  142. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.0/video.js +9 -0
  143. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/configuration.js +9 -0
  144. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/deviceInfo.js +9 -0
  145. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/inputSource.js +9 -0
  146. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/power.js +9 -0
  147. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/security.js +9 -0
  148. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/signage.js +9 -0
  149. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/sound.js +9 -0
  150. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/storage.js +9 -0
  151. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/time.js +9 -0
  152. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/utility.js +9 -0
  153. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.1/video.js +9 -0
  154. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/configuration.js +9 -0
  155. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/deviceInfo.js +9 -0
  156. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/inputSource.js +9 -0
  157. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/power.js +9 -0
  158. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/security.js +9 -0
  159. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/signage.js +8 -0
  160. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/sound.js +9 -0
  161. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/storage.js +9 -0
  162. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/time.js +9 -0
  163. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/utility.js +9 -0
  164. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.2/video.js +9 -0
  165. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/configuration.js +9 -0
  166. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/deviceInfo.js +9 -0
  167. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/inputSource.js +9 -0
  168. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/power.js +9 -0
  169. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/security.js +9 -0
  170. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/signage.js +9 -0
  171. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/sound.js +9 -0
  172. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/storage.js +9 -0
  173. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/time.js +9 -0
  174. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/utility.js +9 -0
  175. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.3/video.js +9 -0
  176. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/configuration.js +1 -0
  177. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/deviceInfo.js +1 -0
  178. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/inputSource.js +1 -0
  179. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/power.js +1 -0
  180. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/security.js +1 -0
  181. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/signage.js +1 -0
  182. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/sound.js +1 -0
  183. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/storage.js +1 -0
  184. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/time.js +1 -0
  185. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/utility.js +1 -0
  186. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.4/video.js +1 -0
  187. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/configuration.js +1 -0
  188. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/deviceInfo.js +1 -0
  189. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/inputSource.js +1 -0
  190. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/power.js +1 -0
  191. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/security.js +1 -0
  192. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/signage.js +1 -0
  193. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/sound.js +1 -0
  194. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/storage.js +1 -0
  195. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/time.js +1 -0
  196. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/utility.js +1 -0
  197. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.4.5/video.js +1 -0
  198. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/configuration.js +1 -0
  199. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/deviceInfo.js +1 -0
  200. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/inputSource.js +1 -0
  201. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/power.js +1 -0
  202. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/security.js +1 -0
  203. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/signage.js +1 -0
  204. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/sound.js +1 -0
  205. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/storage.js +1 -0
  206. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/time.js +1 -0
  207. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/utility.js +1 -0
  208. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.0/video.js +1 -0
  209. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/configuration.js +1 -0
  210. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/deviceInfo.js +1 -0
  211. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/inputSource.js +1 -0
  212. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/power.js +1 -0
  213. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/security.js +1 -0
  214. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/signage.js +1 -0
  215. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/sound.js +1 -0
  216. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/storage.js +1 -0
  217. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/time.js +1 -0
  218. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/utility.js +1 -0
  219. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.1/video.js +1 -0
  220. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/configuration.js +1 -0
  221. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/deviceInfo.js +1 -0
  222. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/inputSource.js +1 -0
  223. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/power.js +1 -0
  224. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/security.js +1 -0
  225. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/signage.js +1 -0
  226. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/sound.js +1 -0
  227. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/storage.js +1 -0
  228. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/time.js +1 -0
  229. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/utility.js +1 -0
  230. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.11/video.js +1 -0
  231. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/configuration.js +1 -0
  232. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/deviceInfo.js +1 -0
  233. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/inputSource.js +1 -0
  234. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/power.js +1 -0
  235. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/security.js +1 -0
  236. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/signage.js +1 -0
  237. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/sound.js +1 -0
  238. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/storage.js +1 -0
  239. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/time.js +1 -0
  240. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/utility.js +1 -0
  241. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.12/video.js +1 -0
  242. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/configuration.js +1 -0
  243. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/deviceInfo.js +1 -0
  244. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/inputSource.js +1 -0
  245. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/power.js +1 -0
  246. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/security.js +1 -0
  247. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/signage.js +1 -0
  248. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/sound.js +1 -0
  249. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/storage.js +1 -0
  250. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/time.js +1 -0
  251. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/utility.js +1 -0
  252. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.2/video.js +1 -0
  253. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/configuration.js +1 -0
  254. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/deviceInfo.js +1 -0
  255. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/inputSource.js +1 -0
  256. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/power.js +1 -0
  257. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/security.js +1 -0
  258. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/signage.js +1 -0
  259. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/sound.js +1 -0
  260. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/storage.js +1 -0
  261. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/time.js +1 -0
  262. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/utility.js +1 -0
  263. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.3/video.js +1 -0
  264. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/configuration.js +1 -0
  265. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/deviceInfo.js +1 -0
  266. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/inputSource.js +1 -0
  267. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/power.js +1 -0
  268. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/security.js +1 -0
  269. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/signage.js +1 -0
  270. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/sound.js +1 -0
  271. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/storage.js +1 -0
  272. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/time.js +1 -0
  273. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/utility.js +1 -0
  274. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.4/video.js +1 -0
  275. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/configuration.js +1 -0
  276. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/deviceInfo.js +1 -0
  277. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/inputSource.js +1 -0
  278. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/power.js +1 -0
  279. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/security.js +1 -0
  280. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/signage.js +1 -0
  281. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/sound.js +1 -0
  282. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/storage.js +1 -0
  283. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/time.js +1 -0
  284. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/utility.js +1 -0
  285. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.5/video.js +1 -0
  286. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/configuration.js +1 -0
  287. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/deviceInfo.js +1 -0
  288. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/inputSource.js +1 -0
  289. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/power.js +1 -0
  290. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/security.js +1 -0
  291. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/signage.js +1 -0
  292. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/sound.js +1 -0
  293. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/storage.js +1 -0
  294. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/time.js +1 -0
  295. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/utility.js +1 -0
  296. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.6/video.js +1 -0
  297. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/configuration.js +1 -0
  298. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/deviceInfo.js +1 -0
  299. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/inputSource.js +1 -0
  300. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/power.js +1 -0
  301. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/security.js +1 -0
  302. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/signage.js +1 -0
  303. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/sound.js +1 -0
  304. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/storage.js +1 -0
  305. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/time.js +1 -0
  306. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/utility.js +1 -0
  307. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.7/video.js +1 -0
  308. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/configuration.js +1 -0
  309. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/deviceInfo.js +1 -0
  310. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/inputSource.js +1 -0
  311. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/power.js +1 -0
  312. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/security.js +1 -0
  313. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/signage.js +1 -0
  314. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/sound.js +1 -0
  315. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/storage.js +1 -0
  316. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/time.js +1 -0
  317. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/utility.js +1 -0
  318. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.5.8/video.js +1 -0
  319. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/configuration.js +1 -0
  320. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/deviceInfo.js +1 -0
  321. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/inputSource.js +1 -0
  322. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/power.js +1 -0
  323. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/security.js +1 -0
  324. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/signage.js +1 -0
  325. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/sound.js +1 -0
  326. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/storage.js +1 -0
  327. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/time.js +1 -0
  328. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/utility.js +1 -0
  329. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.0/video.js +1 -0
  330. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/configuration.js +1 -0
  331. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/deviceInfo.js +1 -0
  332. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/inputSource.js +1 -0
  333. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/power.js +1 -0
  334. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/security.js +1 -0
  335. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/signage.js +1 -0
  336. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/sound.js +1 -0
  337. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/storage.js +1 -0
  338. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/time.js +1 -0
  339. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/utility.js +1 -0
  340. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.1/video.js +1 -0
  341. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/configuration.js +1 -0
  342. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/deviceInfo.js +1 -0
  343. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/inputSource.js +1 -0
  344. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/power.js +1 -0
  345. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/security.js +1 -0
  346. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/signage.js +1 -0
  347. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/sound.js +1 -0
  348. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/storage.js +1 -0
  349. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/time.js +1 -0
  350. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/utility.js +1 -0
  351. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.2/video.js +1 -0
  352. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/configuration.js +1 -0
  353. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/deviceInfo.js +1 -0
  354. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/inputSource.js +1 -0
  355. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/power.js +1 -0
  356. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/security.js +1 -0
  357. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/signage.js +1 -0
  358. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/sound.js +1 -0
  359. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/storage.js +1 -0
  360. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/time.js +1 -0
  361. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/utility.js +1 -0
  362. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.3/video.js +1 -0
  363. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/configuration.js +1 -0
  364. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/deviceInfo.js +1 -0
  365. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/inputSource.js +1 -0
  366. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/led.js +1 -0
  367. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/power.js +1 -0
  368. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/security.js +1 -0
  369. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/signage.js +1 -0
  370. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/sound.js +1 -0
  371. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/storage.js +1 -0
  372. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/time.js +1 -0
  373. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/utility.js +1 -0
  374. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.7/video.js +1 -0
  375. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/configuration.js +1 -0
  376. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/deviceInfo.js +1 -0
  377. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/inputSource.js +1 -0
  378. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/led.js +1 -0
  379. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/power.js +1 -0
  380. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/security.js +1 -0
  381. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/signage.js +1 -0
  382. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/sound.js +1 -0
  383. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/storage.js +1 -0
  384. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/time.js +1 -0
  385. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/utility.js +1 -0
  386. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.6.8/video.js +1 -0
  387. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/configuration.js +1 -0
  388. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/deviceInfo.js +1 -0
  389. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/inputSource.js +1 -0
  390. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/iot.js +1 -0
  391. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/power.js +1 -0
  392. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/security.js +1 -0
  393. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/signage.js +1 -0
  394. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/sound.js +1 -0
  395. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/storage.js +1 -0
  396. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/time.js +1 -0
  397. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/utility.js +1 -0
  398. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.0/video.js +1 -0
  399. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/configuration.js +1 -0
  400. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/deviceInfo.js +1 -0
  401. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/inputSource.js +1 -0
  402. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/iot.js +1 -0
  403. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/power.js +1 -0
  404. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/security.js +1 -0
  405. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/signage.js +1 -0
  406. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/sound.js +1 -0
  407. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/storage.js +1 -0
  408. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/time.js +1 -0
  409. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/utility.js +1 -0
  410. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.1/video.js +1 -0
  411. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/configuration.js +1 -0
  412. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/deviceInfo.js +1 -0
  413. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/inputSource.js +1 -0
  414. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/iot.js +1 -0
  415. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/led.js +1 -0
  416. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/power.js +1 -0
  417. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/security.js +1 -0
  418. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/signage.js +1 -0
  419. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/sound.js +1 -0
  420. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/storage.js +1 -0
  421. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/time.js +1 -0
  422. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/utility.js +1 -0
  423. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.5/video.js +1 -0
  424. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/configuration.js +1 -0
  425. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/deviceInfo.js +1 -0
  426. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/inputSource.js +1 -0
  427. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/iot.js +1 -0
  428. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/led.js +1 -0
  429. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/power.js +1 -0
  430. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/security.js +1 -0
  431. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/signage.js +1 -0
  432. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/sound.js +1 -0
  433. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/storage.js +1 -0
  434. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/time.js +1 -0
  435. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/utility.js +1 -0
  436. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.7.6/video.js +1 -0
  437. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/configuration.js +1 -0
  438. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/deviceInfo.js +1 -0
  439. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/inputSource.js +1 -0
  440. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/iot.js +1 -0
  441. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/power.js +1 -0
  442. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/security.js +1 -0
  443. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/signage.js +1 -0
  444. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/sound.js +1 -0
  445. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/storage.js +1 -0
  446. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/time.js +1 -0
  447. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/utility.js +1 -0
  448. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.0/video.js +1 -0
  449. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/configuration.js +1 -0
  450. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/deviceInfo.js +1 -0
  451. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/inputSource.js +1 -0
  452. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/iot.js +1 -0
  453. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/power.js +1 -0
  454. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/security.js +1 -0
  455. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/signage.js +1 -0
  456. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/sound.js +1 -0
  457. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/storage.js +1 -0
  458. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/time.js +1 -0
  459. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/utility.js +1 -0
  460. package/files/templates/signage-sdk-templates/Download_Progress/js/cordova-cd/1.8.1/video.js +1 -0
  461. package/files/templates/signage-sdk-templates/Download_Progress/js/custom/custom1.2.js +14 -0
  462. package/files/templates/signage-sdk-templates/Download_Progress/js/custom/custom1.3.1.js +1 -0
  463. package/files/templates/signage-sdk-templates/Download_Progress/js/custom/custom1.3.js +1 -0
  464. package/files/templates/signage-sdk-templates/Download_Progress/js/custom/custom1.4.js +14 -0
  465. package/files/templates/signage-sdk-templates/Download_Progress/js/harmony/README.txt +40 -0
  466. package/files/templates/signage-sdk-templates/Download_Progress/js/harmony/gpio.js +16 -0
  467. package/files/templates/signage-sdk-templates/Download_Progress/js/harmony/gps.js +16 -0
  468. package/files/templates/signage-sdk-templates/Download_Progress/js/harmony/humidity.js +16 -0
  469. package/files/templates/signage-sdk-templates/Download_Progress/js/harmony/light.js +16 -0
  470. package/files/templates/signage-sdk-templates/Download_Progress/js/harmony/nfc.js +16 -0
  471. package/files/templates/signage-sdk-templates/Download_Progress/js/harmony/rfid.js +16 -0
  472. package/files/templates/signage-sdk-templates/Download_Progress/js/harmony/temperature.js +16 -0
  473. package/files/templates/signage-sdk-templates/Download_Progress/js/harmony/thermalPrinter.js +16 -0
  474. package/files/templates/signage-sdk-templates/Download_Progress/js/idcap.js +21 -0
  475. package/files/templates/signage-sdk-templates/Download_Progress/js/webOS/LICENSE-2.0.txt +202 -0
  476. package/files/templates/signage-sdk-templates/Download_Progress/js/webOS/webOS.js +1 -0
  477. package/files/templates/signage-sdk-templates/Download_Progress/res/webossignage_logo.png +0 -0
  478. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/css/styles.css +270 -0
  479. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/data/data.json +12 -0
  480. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/fonts/MuseoSans300.otf +0 -0
  481. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/fonts/MuseoSans700Italic.otf +0 -0
  482. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/index.html +43 -0
  483. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/js/controller.js +263 -0
  484. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/js/helpers/util.js +130 -0
  485. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/readme.txt +26 -0
  486. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/res/images/tpl_01_img_sign.png +0 -0
  487. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/res/images/tpl_01_logo_nike.png +0 -0
  488. package/files/templates/signage-sdk-templates/Fashion_Multimedia_Ad/res/videos/tpl_01_video.mp4 +0 -0
  489. package/files/templates/signage-sdk-templates/File_Explorer/README.txt +16 -0
  490. package/files/templates/signage-sdk-templates/File_Explorer/index.html +44 -0
  491. package/files/templates/signage-sdk-templates/File_Explorer/js/Root.js +48 -0
  492. package/files/templates/signage-sdk-templates/File_Explorer/js/definition.js +59 -0
  493. package/files/templates/signage-sdk-templates/File_Explorer/js/explorer.js +367 -0
  494. package/files/templates/signage-sdk-templates/File_Explorer/js/explorerController.js +462 -0
  495. package/files/templates/signage-sdk-templates/File_Explorer/js/idcap.js +21 -0
  496. package/files/templates/signage-sdk-templates/File_Explorer/js/mainController.js +261 -0
  497. package/files/templates/signage-sdk-templates/File_Explorer/style.css +233 -0
  498. package/files/templates/signage-sdk-templates/Flight_Schedule/appinfo.json +11 -0
  499. package/files/templates/signage-sdk-templates/Flight_Schedule/css/styles.css +168 -0
  500. package/files/templates/signage-sdk-templates/Flight_Schedule/data/data.json +5 -0
  501. package/files/templates/signage-sdk-templates/Flight_Schedule/fonts/MuseoSans300.otf +0 -0
  502. package/files/templates/signage-sdk-templates/Flight_Schedule/fonts/MuseoSans500.otf +0 -0
  503. package/files/templates/signage-sdk-templates/Flight_Schedule/fonts/MuseoSans700.otf +0 -0
  504. package/files/templates/signage-sdk-templates/Flight_Schedule/images/AAir.png +0 -0
  505. package/files/templates/signage-sdk-templates/Flight_Schedule/images/BAirline.png +0 -0
  506. package/files/templates/signage-sdk-templates/Flight_Schedule/images/CAirline.png +0 -0
  507. package/files/templates/signage-sdk-templates/Flight_Schedule/images/DAir.png +0 -0
  508. package/files/templates/signage-sdk-templates/Flight_Schedule/images/EAirline.png +0 -0
  509. package/files/templates/signage-sdk-templates/Flight_Schedule/images/tpl_05_img_flight.png +0 -0
  510. package/files/templates/signage-sdk-templates/Flight_Schedule/index.html +32 -0
  511. package/files/templates/signage-sdk-templates/Flight_Schedule/js/controller.js +235 -0
  512. package/files/templates/signage-sdk-templates/Flight_Schedule/js/helpers/util.js +183 -0
  513. package/files/templates/signage-sdk-templates/Flight_Schedule/readme.txt +29 -0
  514. package/files/templates/signage-sdk-templates/Flight_Schedule/server/example.json +4 -0
  515. package/files/templates/signage-sdk-templates/Flight_Schedule/server/package.json +9 -0
  516. package/files/templates/signage-sdk-templates/Flight_Schedule/server/readme.txt +30 -0
  517. package/files/templates/signage-sdk-templates/Flight_Schedule/server/routes/flights.js +493 -0
  518. package/files/templates/signage-sdk-templates/Flight_Schedule/server/server.js +43 -0
  519. package/files/templates/signage-sdk-templates/Information_Board/css/styles.css +239 -0
  520. package/files/templates/signage-sdk-templates/Information_Board/data/data.json +49 -0
  521. package/files/templates/signage-sdk-templates/Information_Board/fonts/Museo Sans 300.otf +0 -0
  522. package/files/templates/signage-sdk-templates/Information_Board/fonts/Museo Sans 500.otf +0 -0
  523. package/files/templates/signage-sdk-templates/Information_Board/fonts/Museo Sans 700.otf +0 -0
  524. package/files/templates/signage-sdk-templates/Information_Board/index.html +101 -0
  525. package/files/templates/signage-sdk-templates/Information_Board/js/controller.js +111 -0
  526. package/files/templates/signage-sdk-templates/Information_Board/js/helpers/util.js +130 -0
  527. package/files/templates/signage-sdk-templates/Information_Board/readme.txt +22 -0
  528. package/files/templates/signage-sdk-templates/Information_Board/res/images/tpl_06_img_main_01.png +0 -0
  529. package/files/templates/signage-sdk-templates/Information_Board/res/images/tpl_06_img_news.png +0 -0
  530. package/files/templates/signage-sdk-templates/Information_Board/res/images/tpl_06_logo_harvard.png +0 -0
  531. package/files/templates/signage-sdk-templates/Information_Kiosk/css/styles.css +387 -0
  532. package/files/templates/signage-sdk-templates/Information_Kiosk/data/data.json +185 -0
  533. package/files/templates/signage-sdk-templates/Information_Kiosk/fonts/Museo Sans 300 Italic.otf +0 -0
  534. package/files/templates/signage-sdk-templates/Information_Kiosk/fonts/Museo Sans 300.otf +0 -0
  535. package/files/templates/signage-sdk-templates/Information_Kiosk/fonts/Museo Sans 500 Italic.otf +0 -0
  536. package/files/templates/signage-sdk-templates/Information_Kiosk/fonts/Museo Sans 500.otf +0 -0
  537. package/files/templates/signage-sdk-templates/Information_Kiosk/fonts/Museo Sans 700 Italic.otf +0 -0
  538. package/files/templates/signage-sdk-templates/Information_Kiosk/fonts/Museo Sans 700.otf +0 -0
  539. package/files/templates/signage-sdk-templates/Information_Kiosk/index.html +320 -0
  540. package/files/templates/signage-sdk-templates/Information_Kiosk/js/controller.js +373 -0
  541. package/files/templates/signage-sdk-templates/Information_Kiosk/js/helpers/util.js +130 -0
  542. package/files/templates/signage-sdk-templates/Information_Kiosk/readme.txt +26 -0
  543. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_btn_arrow_l_n.png +0 -0
  544. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_btn_arrow_l_p.png +0 -0
  545. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_btn_arrow_r_n.png +0 -0
  546. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_btn_arrow_r_p.png +0 -0
  547. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_btn_close_n.png +0 -0
  548. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_btn_close_p.png +0 -0
  549. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_btn_rotation_n.png +0 -0
  550. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_btn_rotation_p.png +0 -0
  551. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_bg_01.png +0 -0
  552. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_01.png +0 -0
  553. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_02.png +0 -0
  554. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_03.png +0 -0
  555. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_04.png +0 -0
  556. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_05.png +0 -0
  557. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_06.png +0 -0
  558. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_07.png +0 -0
  559. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_08.png +0 -0
  560. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_09.png +0 -0
  561. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_10.png +0 -0
  562. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_11.png +0 -0
  563. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_12.png +0 -0
  564. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_3_01.png +0 -0
  565. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_3_02.png +0 -0
  566. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_3_03.png +0 -0
  567. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_3_04.png +0 -0
  568. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_3_05.png +0 -0
  569. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_list_3_06.png +0 -0
  570. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_01.png +0 -0
  571. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_02.png +0 -0
  572. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_03.png +0 -0
  573. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_04.png +0 -0
  574. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_05.png +0 -0
  575. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_06.png +0 -0
  576. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_07.png +0 -0
  577. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_08.png +0 -0
  578. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_09.png +0 -0
  579. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_10.png +0 -0
  580. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_11.png +0 -0
  581. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_popup_list_12.png +0 -0
  582. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_style_01.png +0 -0
  583. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_img_style_02.png +0 -0
  584. package/files/templates/signage-sdk-templates/Information_Kiosk/res/images/tpl_10_logo.png +0 -0
  585. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/index.html +40 -0
  586. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova/2.7.0/cordova.webos.js +7038 -0
  587. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova/LICENSE +201 -0
  588. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.2/configuration.js +1 -0
  589. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.2/deviceInfo.js +1 -0
  590. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.2/inputSource.js +1 -0
  591. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.2/power.js +1 -0
  592. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.2/signage.js +1 -0
  593. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.2/sound.js +1 -0
  594. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.2/storage.js +23 -0
  595. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.2/video.js +1 -0
  596. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.3/configuration.js +1 -0
  597. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.3/deviceInfo.js +1 -0
  598. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.3/inputSource.js +1 -0
  599. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.3/power.js +1 -0
  600. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.3/signage.js +1 -0
  601. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.3/sound.js +1 -0
  602. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.3/storage.js +1 -0
  603. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.3/video.js +1 -0
  604. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/configuration.js +1 -0
  605. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/deviceInfo.js +1 -0
  606. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/inputSource.js +1 -0
  607. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/power.js +1 -0
  608. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/security.js +1 -0
  609. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/signage.js +1 -0
  610. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/sound.js +1 -0
  611. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/storage.js +1 -0
  612. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/time.js +1 -0
  613. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/utility.js +1 -0
  614. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.4.5/video.js +1 -0
  615. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/configuration.js +1 -0
  616. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/deviceInfo.js +1 -0
  617. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/inputSource.js +1 -0
  618. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/power.js +1 -0
  619. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/security.js +1 -0
  620. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/signage.js +1 -0
  621. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/sound.js +1 -0
  622. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/storage.js +1 -0
  623. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/time.js +1 -0
  624. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/utility.js +1 -0
  625. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.5.12/video.js +1 -0
  626. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/configuration.js +1 -0
  627. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/deviceInfo.js +1 -0
  628. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/inputSource.js +1 -0
  629. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/led.js +1 -0
  630. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/power.js +1 -0
  631. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/security.js +1 -0
  632. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/signage.js +1 -0
  633. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/sound.js +1 -0
  634. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/storage.js +1 -0
  635. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/time.js +1 -0
  636. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/utility.js +1 -0
  637. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.6.8/video.js +1 -0
  638. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/configuration.js +1 -0
  639. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/deviceInfo.js +1 -0
  640. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/inputSource.js +1 -0
  641. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/iot.js +1 -0
  642. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/led.js +1 -0
  643. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/power.js +1 -0
  644. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/security.js +1 -0
  645. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/signage.js +1 -0
  646. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/sound.js +1 -0
  647. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/storage.js +1 -0
  648. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/time.js +1 -0
  649. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/utility.js +1 -0
  650. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.7.6/video.js +1 -0
  651. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/configuration.js +1 -0
  652. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/deviceInfo.js +1 -0
  653. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/inputSource.js +1 -0
  654. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/iot.js +1 -0
  655. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/power.js +1 -0
  656. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/security.js +1 -0
  657. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/signage.js +1 -0
  658. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/sound.js +1 -0
  659. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/storage.js +1 -0
  660. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/time.js +1 -0
  661. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/utility.js +1 -0
  662. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/cordova-cd/1.8.1/video.js +1 -0
  663. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/custom1.4.js +14 -0
  664. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/idcap.js +21 -0
  665. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/initializer.js +234 -0
  666. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/remocon.js +73 -0
  667. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/scheduler.js +84 -0
  668. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/js/videoPlayer.js +352 -0
  669. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/remocon.png +0 -0
  670. package/files/templates/signage-sdk-templates/Local_Content_Scheduling/style.css +99 -0
  671. package/files/templates/signage-sdk-templates/Mart/css/styles.css +248 -0
  672. package/files/templates/signage-sdk-templates/Mart/data/data.json +37 -0
  673. package/files/templates/signage-sdk-templates/Mart/fonts/Museo Sans 300 Italic.otf +0 -0
  674. package/files/templates/signage-sdk-templates/Mart/fonts/Museo Sans 300.otf +0 -0
  675. package/files/templates/signage-sdk-templates/Mart/fonts/Museo Sans 500.otf +0 -0
  676. package/files/templates/signage-sdk-templates/Mart/fonts/Museo Sans 700.otf +0 -0
  677. package/files/templates/signage-sdk-templates/Mart/index.html +81 -0
  678. package/files/templates/signage-sdk-templates/Mart/js/controller.js +102 -0
  679. package/files/templates/signage-sdk-templates/Mart/js/helpers/util.js +130 -0
  680. package/files/templates/signage-sdk-templates/Mart/readme.txt +26 -0
  681. package/files/templates/signage-sdk-templates/Mart/res/images/tpl_09_img.png +0 -0
  682. package/files/templates/signage-sdk-templates/Mart/res/images/tpl_09_img_bg.png +0 -0
  683. package/files/templates/signage-sdk-templates/Mart/res/images/tpl_09_img_brand.png +0 -0
  684. package/files/templates/signage-sdk-templates/Mart/res/images/tpl_09_img_list_01.png +0 -0
  685. package/files/templates/signage-sdk-templates/Mart/res/images/tpl_09_img_list_02.png +0 -0
  686. package/files/templates/signage-sdk-templates/Mart/res/images/tpl_09_img_list_03.png +0 -0
  687. package/files/templates/signage-sdk-templates/Mart/res/images/tpl_09_img_list_04.png +0 -0
  688. package/files/templates/signage-sdk-templates/Mart/res/images/tpl_09_img_tag.png +0 -0
  689. package/files/templates/signage-sdk-templates/Mart/res/images/tpl_09_logo.png +0 -0
  690. package/files/templates/signage-sdk-templates/Multimedia_Advertisement/css/styles.css +40 -0
  691. package/files/templates/signage-sdk-templates/Multimedia_Advertisement/data/data.json +6 -0
  692. package/files/templates/signage-sdk-templates/Multimedia_Advertisement/index.html +28 -0
  693. package/files/templates/signage-sdk-templates/Multimedia_Advertisement/js/controller.js +427 -0
  694. package/files/templates/signage-sdk-templates/Multimedia_Advertisement/js/helpers/util.js +134 -0
  695. package/files/templates/signage-sdk-templates/Multimedia_Advertisement/readme.txt +26 -0
  696. package/files/templates/signage-sdk-templates/Multimedia_Advertisement/res/images/tpl_02_img_poster.jpg +0 -0
  697. package/files/templates/signage-sdk-templates/Multimedia_Advertisement/res/videos/tpl_02_video_01.mp4 +0 -0
  698. package/files/templates/signage-sdk-templates/Multimedia_Advertisement/res/videos/tpl_02_video_02.mp4 +0 -0
  699. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/css/styles.css +163 -0
  700. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/data/data.json +92 -0
  701. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/fonts/MuseoSans300.otf +0 -0
  702. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/fonts/MuseoSans500.otf +0 -0
  703. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/fonts/MuseoSans700.otf +0 -0
  704. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/fonts/MuseoSans700Italic.otf +0 -0
  705. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/index.html +197 -0
  706. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/js/controller.js +158 -0
  707. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/js/helpers/util.js +130 -0
  708. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/readme.txt +26 -0
  709. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_bg_top.png +0 -0
  710. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_img_menu_01.png +0 -0
  711. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_img_menu_02.png +0 -0
  712. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_img_menu_03.png +0 -0
  713. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_img_menu_04.png +0 -0
  714. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_img_menu_05.png +0 -0
  715. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_img_menu_06.png +0 -0
  716. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_img_menu_07.png +0 -0
  717. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_img_menu_08.png +0 -0
  718. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_img_menu_09.png +0 -0
  719. package/files/templates/signage-sdk-templates/Price_Board_for_QSR/res/images/tpl_04_logo.png +0 -0
  720. package/files/templates/signage-sdk-templates/Simple_Network_FailOver/index.html +29 -0
  721. package/files/templates/signage-sdk-templates/Simple_Network_FailOver/js/idcap.js +21 -0
  722. package/files/templates/signage-sdk-templates/Simple_Network_FailOver/networkMonitor.js +136 -0
  723. package/files/templates/signage-sdk-templates/Simple_Network_FailOver/style.css +142 -0
  724. package/files/templates/signage-sdk-templates/Special_Menu_Board/css/styles.css +281 -0
  725. package/files/templates/signage-sdk-templates/Special_Menu_Board/data/data.json +33 -0
  726. package/files/templates/signage-sdk-templates/Special_Menu_Board/fonts/Museo Sans 300 Italic.otf +0 -0
  727. package/files/templates/signage-sdk-templates/Special_Menu_Board/fonts/Museo Sans 300.otf +0 -0
  728. package/files/templates/signage-sdk-templates/Special_Menu_Board/fonts/Museo Sans 500 Italic.otf +0 -0
  729. package/files/templates/signage-sdk-templates/Special_Menu_Board/fonts/Museo Sans 500.otf +0 -0
  730. package/files/templates/signage-sdk-templates/Special_Menu_Board/fonts/Museo Sans 700 Italic.otf +0 -0
  731. package/files/templates/signage-sdk-templates/Special_Menu_Board/fonts/Museo Sans 700.otf +0 -0
  732. package/files/templates/signage-sdk-templates/Special_Menu_Board/index.html +110 -0
  733. package/files/templates/signage-sdk-templates/Special_Menu_Board/js/controller.js +171 -0
  734. package/files/templates/signage-sdk-templates/Special_Menu_Board/js/helpers/util.js +130 -0
  735. package/files/templates/signage-sdk-templates/Special_Menu_Board/readme.txt +26 -0
  736. package/files/templates/signage-sdk-templates/Special_Menu_Board/res/images/tpl_03_img_bg.png +0 -0
  737. package/files/templates/signage-sdk-templates/Special_Menu_Board/res/images/tpl_03_img_coffe_01.png +0 -0
  738. package/files/templates/signage-sdk-templates/Special_Menu_Board/res/images/tpl_03_img_coffe_01_l.png +0 -0
  739. package/files/templates/signage-sdk-templates/Special_Menu_Board/res/images/tpl_03_img_coffe_02.png +0 -0
  740. package/files/templates/signage-sdk-templates/Special_Menu_Board/res/images/tpl_03_img_coffe_03.png +0 -0
  741. package/files/templates/signage-sdk-templates/Special_Menu_Board/res/images/tpl_03_img_coffe_04.png +0 -0
  742. package/files/templates/signage-sdk-templates/Special_Menu_Board/res/images/tpl_03_img_coffe_05.png +0 -0
  743. package/files/templates/signage-sdk-templates/Special_Menu_Board/res/images/tpl_03_logo_01.png +0 -0
  744. package/files/templates/signage-sdk-templates/Special_Menu_Board/res/images/tpl_03_logo_02.png +0 -0
  745. package/files/templates/signage-sdk-templates/Wayfinder/css/styles.css +634 -0
  746. package/files/templates/signage-sdk-templates/Wayfinder/data/data.json +339 -0
  747. package/files/templates/signage-sdk-templates/Wayfinder/fonts/MuseoSans300.otf +0 -0
  748. package/files/templates/signage-sdk-templates/Wayfinder/fonts/MuseoSans500.otf +0 -0
  749. package/files/templates/signage-sdk-templates/Wayfinder/fonts/MuseoSans700.otf +0 -0
  750. package/files/templates/signage-sdk-templates/Wayfinder/fonts/MuseoSans700Italic.otf +0 -0
  751. package/files/templates/signage-sdk-templates/Wayfinder/index.html +171 -0
  752. package/files/templates/signage-sdk-templates/Wayfinder/js/controller.js +447 -0
  753. package/files/templates/signage-sdk-templates/Wayfinder/js/helpers/util.js +175 -0
  754. package/files/templates/signage-sdk-templates/Wayfinder/readme.txt +26 -0
  755. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_btn_back_n.png +0 -0
  756. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_icon_dot_n.png +0 -0
  757. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_icon_dot_s.png +0 -0
  758. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_01.png +0 -0
  759. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_02.png +0 -0
  760. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_03.png +0 -0
  761. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_all_01_d.png +0 -0
  762. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_all_01_n.png +0 -0
  763. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_all_02_d.png +0 -0
  764. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_all_02_n.png +0 -0
  765. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_all_03_d.png +0 -0
  766. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_all_03_n.png +0 -0
  767. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_all_shadow.png +0 -0
  768. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_home_01_n.png +0 -0
  769. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_home_02_n.png +0 -0
  770. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_floormap_home_03_n.png +0 -0
  771. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_point.png +0 -0
  772. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_img_point_shadow.png +0 -0
  773. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_list_icon_elevator.png +0 -0
  774. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_list_icon_escalator.png +0 -0
  775. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_list_icon_exit.png +0 -0
  776. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_list_icon_info.png +0 -0
  777. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_list_icon_parking.png +0 -0
  778. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_list_icon_toilet.png +0 -0
  779. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_logo_lg.png +0 -0
  780. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_logo_shoppingmall_name.png +0 -0
  781. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_logo_store.png +0 -0
  782. package/files/templates/signage-sdk-templates/Wayfinder/res/images/tpl_11_popup_bg.png +0 -0
  783. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/css/styles.css +136 -0
  784. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/data/data.json +33 -0
  785. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/fonts/Museo Sans 300.otf +0 -0
  786. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/fonts/Museo Sans 500.otf +0 -0
  787. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/fonts/Museo Sans 700.otf +0 -0
  788. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/index.html +51 -0
  789. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/js/controller.js +265 -0
  790. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/js/helpers/util.js +130 -0
  791. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/readme.txt +26 -0
  792. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/ajax.gif +0 -0
  793. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_icon_cloudy.png +0 -0
  794. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_icon_partlycloudy.png +0 -0
  795. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_icon_rainy.png +0 -0
  796. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_icon_snowy.png +0 -0
  797. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_icon_sunny.png +0 -0
  798. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_icon_thunder.png +0 -0
  799. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_icon_windy.png +0 -0
  800. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_img_01.png +0 -0
  801. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_img_02.png +0 -0
  802. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_img_03.png +0 -0
  803. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_img_04.png +0 -0
  804. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_img_05.png +0 -0
  805. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_img_06.png +0 -0
  806. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_img_07.png +0 -0
  807. package/files/templates/signage-sdk-templates/Weather-dependent_Ad/res/images/tpl_08_logo.png +0 -0
  808. package/files/templates/signage-sdk-templates/Widget_Overlay/css/styles.css +312 -0
  809. package/files/templates/signage-sdk-templates/Widget_Overlay/data/data.json +16 -0
  810. package/files/templates/signage-sdk-templates/Widget_Overlay/data/newsWidget.json +21 -0
  811. package/files/templates/signage-sdk-templates/Widget_Overlay/data/shareWidget.json +112 -0
  812. package/files/templates/signage-sdk-templates/Widget_Overlay/data/weatherWidget.json +45 -0
  813. package/files/templates/signage-sdk-templates/Widget_Overlay/fonts/MuseoSans300.otf +0 -0
  814. package/files/templates/signage-sdk-templates/Widget_Overlay/fonts/MuseoSans500.otf +0 -0
  815. package/files/templates/signage-sdk-templates/Widget_Overlay/fonts/MuseoSans700.otf +0 -0
  816. package/files/templates/signage-sdk-templates/Widget_Overlay/index.html +62 -0
  817. package/files/templates/signage-sdk-templates/Widget_Overlay/js/controller.js +390 -0
  818. package/files/templates/signage-sdk-templates/Widget_Overlay/js/helpers/util.js +162 -0
  819. package/files/templates/signage-sdk-templates/Widget_Overlay/readme.txt +26 -0
  820. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/Namo.jpg +0 -0
  821. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/NotAvailable.png +0 -0
  822. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/clear.png +0 -0
  823. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/clouds.png +0 -0
  824. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/default.png +0 -0
  825. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/koreanFt.jpg +0 -0
  826. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/mist.png +0 -0
  827. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/rain.png +0 -0
  828. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/snow.png +0 -0
  829. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/thunder.png +0 -0
  830. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/tpl_07_icon_down_01.png +0 -0
  831. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/tpl_07_icon_down_02.png +0 -0
  832. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/tpl_07_icon_up_01.png +0 -0
  833. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/tpl_07_icon_up_02.png +0 -0
  834. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/tpl_07_img_news.png +0 -0
  835. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/tpl_07_img_news1.png +0 -0
  836. package/files/templates/signage-sdk-templates/Widget_Overlay/res/images/tpl_07_video_dim.png +0 -0
  837. package/files/templates/signage-sdk-templates/Widget_Overlay/res/videos/tpl_07_video.mp4 +0 -0
  838. package/files/templates/signage-sdk-templates/appinfo/appinfo.json +11 -0
  839. package/files/templates/signage-sdk-templates/idcap_api/1.1.0/js/idcap.js +21 -0
  840. package/files/templates/signage-sdk-templates/idcap_api/1.1.0/js/release_notes.txt +25 -0
  841. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova/2.7.0/cordova.webos.js +7025 -0
  842. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova/LICENSE +7025 -0
  843. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova-cd/1.3/configuration.js +1 -0
  844. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova-cd/1.3/deviceInfo.js +1 -0
  845. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova-cd/1.3/inputSource.js +1 -0
  846. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova-cd/1.3/power.js +1 -0
  847. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova-cd/1.3/signage.js +1 -0
  848. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova-cd/1.3/sound.js +1 -0
  849. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova-cd/1.3/storage.js +1 -0
  850. package/files/templates/signage-sdk-templates/scap_api/1.3/js/cordova-cd/1.3/video.js +1 -0
  851. package/files/templates/signage-sdk-templates/scap_api/1.3/js/release_notes.txt +109 -0
  852. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova/2.7.0/cordova.webos.js +7038 -0
  853. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova/LICENSE +201 -0
  854. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/configuration.js +1 -0
  855. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/deviceInfo.js +1 -0
  856. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/inputSource.js +1 -0
  857. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/power.js +1 -0
  858. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/security.js +1 -0
  859. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/signage.js +1 -0
  860. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/sound.js +1 -0
  861. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/storage.js +1 -0
  862. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/time.js +1 -0
  863. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/utility.js +1 -0
  864. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/cordova-cd/video.js +1 -0
  865. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/all.css +358 -0
  866. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/fonts/mplus-1m-bold-webfont.eot +0 -0
  867. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/fonts/mplus-1m-bold-webfont.svg +134 -0
  868. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/fonts/mplus-1m-bold-webfont.ttf +0 -0
  869. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/fonts/mplus-1m-bold-webfont.woff +0 -0
  870. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/fonts/mplus-1m-regular-webfont.eot +0 -0
  871. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/fonts/mplus-1m-regular-webfont.svg +134 -0
  872. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/fonts/mplus-1m-regular-webfont.ttf +0 -0
  873. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/fonts/mplus-1m-regular-webfont.woff +0 -0
  874. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/handheld.css +217 -0
  875. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/css/screen.css +405 -0
  876. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/files.html +577 -0
  877. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/index.html +1203 -0
  878. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/intro.html +100 -0
  879. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/all.js +326 -0
  880. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/dessert.css +34 -0
  881. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-apollo.js +51 -0
  882. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-clj.js +64 -0
  883. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-css.js +78 -0
  884. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-go.js +58 -0
  885. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-hs.js +101 -0
  886. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-lisp.js +93 -0
  887. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-lua.js +59 -0
  888. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-ml.js +56 -0
  889. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-n.js +62 -0
  890. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-proto.js +35 -0
  891. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-scala.js +54 -0
  892. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-sql.js +57 -0
  893. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-tex.js +46 -0
  894. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-vb.js +61 -0
  895. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-vhdl.js +34 -0
  896. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-wiki.js +53 -0
  897. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-xq.js +67 -0
  898. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/lang-yaml.js +27 -0
  899. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/prettify.css +52 -0
  900. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/highlighter/prettify.js +1477 -0
  901. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/javascript/html5.js +6 -0
  902. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#clearCache.html +550 -0
  903. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getCurrentTime.html +560 -0
  904. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getLocaleList.html +560 -0
  905. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getOSDLanguage.html +560 -0
  906. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getOSDLock.html +560 -0
  907. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getPictureMode.html +560 -0
  908. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getPictureProperty.html +560 -0
  909. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getProperty.html +561 -0
  910. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getServerProperty.html +560 -0
  911. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getTimeZone.html +560 -0
  912. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getTimeZoneList.html +560 -0
  913. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getUSBLock.html +560 -0
  914. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#getVirtualKeyboardLanguage.html +560 -0
  915. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#restartApplication.html +550 -0
  916. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setCurrentTime.html +566 -0
  917. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setOSDLanguage.html +566 -0
  918. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setOSDLock.html +566 -0
  919. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setPictureMode.html +566 -0
  920. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setPictureProperty.html +566 -0
  921. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setProperty.html +561 -0
  922. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setServerProperty.html +610 -0
  923. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setTimeZone.html +566 -0
  924. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setUSBLock.html +566 -0
  925. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration#setVirtualKeyboardLanguage.html +566 -0
  926. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration.AppMode.html +685 -0
  927. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration.AppType.html +640 -0
  928. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Configuration.PictureMode.html +910 -0
  929. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#connectWifi.html +561 -0
  930. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getBeaconInfo.html +560 -0
  931. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getEddystoneInfo.html +560 -0
  932. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getNetworkInfo.html +560 -0
  933. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getNetworkMacInfo.html +560 -0
  934. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getPlatformInfo.html +560 -0
  935. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getProxyInfo.html +560 -0
  936. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getSoftApInfo.html +560 -0
  937. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getSystemUsageInfo.html +566 -0
  938. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getWifiList.html +560 -0
  939. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#getiBeaconInfo.html +560 -0
  940. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#setBeaconInfo.html +561 -0
  941. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#setEddystoneInfo.html +566 -0
  942. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#setNetworkInfo.html +561 -0
  943. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#setProxyInfo.html +566 -0
  944. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#setSoftApInfo.html +561 -0
  945. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#setiBeaconInfo.html +566 -0
  946. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#startWps.html +566 -0
  947. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo#stopWps.html +555 -0
  948. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/DeviceInfo.EddystoneFrame.html +640 -0
  949. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Error.ERROR_CODE.html +820 -0
  950. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Error.html +460 -0
  951. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/InputSource#changeInputSource.html +566 -0
  952. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/InputSource#getInputSourceStatus.html +560 -0
  953. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/InputSource#initialize.html +561 -0
  954. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#addOffTimer.html +566 -0
  955. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#addOnTimer.html +566 -0
  956. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#deleteOffTimer.html +566 -0
  957. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#deleteOnTimer.html +566 -0
  958. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#enableAllOffTimer.html +566 -0
  959. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#enableAllOnTimer.html +566 -0
  960. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#enableWakeOnLan.html +566 -0
  961. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#executePowerCommand.html +566 -0
  962. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#getDPMWakeup.html +560 -0
  963. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#getOffTimerList.html +560 -0
  964. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#getOnTimerList.html +560 -0
  965. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#getPMMode.html +560 -0
  966. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#getPowerOnDelay.html +560 -0
  967. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#getPowerStatus.html +560 -0
  968. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#setDPMWakeup.html +566 -0
  969. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#setDisplayMode.html +566 -0
  970. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#setPMMode.html +566 -0
  971. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power#setPowerOnDelay.html +566 -0
  972. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power.DPMSignalType.html +640 -0
  973. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power.DisplayMode.html +640 -0
  974. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power.PMMode.html +775 -0
  975. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power.PowerCommand.html +640 -0
  976. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Power.TimerWeek.html +910 -0
  977. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Security#existServerCertificate.html +561 -0
  978. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Security#registerServerCertificate.html +561 -2
  979. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Security#unregisterServerCertificate.html +561 -0
  980. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#captureScreen.html +561 -0
  981. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#enableCheckScreen.html +566 -0
  982. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getFailoverMode.html +555 -0
  983. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getIntelligentAuto.html +560 -0
  984. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getLanDaisyChain.html +560 -0
  985. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getPowerSaveMode.html +555 -0
  986. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getSignageInfo.html +555 -0
  987. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getStudioMode.html +560 -0
  988. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getSystemMonitoringInfo.html +555 -0
  989. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getTileInfo.html +555 -0
  990. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getUsageData.html +555 -0
  991. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#getUsagePermission.html +555 -0
  992. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#registerSystemMonitor.html +573 -0
  993. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setDigitalAudioInputMode.html +567 -0
  994. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setFailoverMode.html +567 -0
  995. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setIntelligentAuto.html +566 -0
  996. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setIsmMethod.html +567 -0
  997. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setLanDaisyChain.html +566 -0
  998. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setPortraitMode.html +567 -0
  999. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setPowerSaveMode.html +567 -0
  1000. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setStudioMode.html +566 -0
  1001. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setTileInfo.html +567 -0
  1002. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#setUsagePermission.html +567 -0
  1003. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage#unregisterSystemMonitor.html +555 -0
  1004. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.AutomaticStandbyMode.html +640 -0
  1005. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.DigitalAudioInput.html +640 -0
  1006. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.DpmMode.html +910 -0
  1007. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.EventType.html +775 -0
  1008. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.FailoverMode.html +685 -0
  1009. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.ImgResolution.html +640 -0
  1010. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.IsmMethod.html +910 -0
  1011. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.KeyOperationMode.html +685 -0
  1012. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.MonitoringSource.html +775 -0
  1013. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Signage.OsdPortraitMode.html +640 -0
  1014. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound#getSoundMode.html +560 -0
  1015. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound#getSoundOut.html +560 -0
  1016. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound#getSoundStatus.html +560 -0
  1017. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound#setExternalSpeaker.html +566 -0
  1018. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound#setMuted.html +566 -0
  1019. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound#setSoundMode.html +566 -0
  1020. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound#setSoundOut.html +566 -0
  1021. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound#setVolumeLevel.html +566 -0
  1022. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound.SoundMode.html +820 -0
  1023. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Sound.SpeakerType.html +640 -0
  1024. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#changeLogoImage.html +566 -0
  1025. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#copyFile.html +561 -0
  1026. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#downloadFirmware.html +566 -0
  1027. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#exists.html +561 -0
  1028. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#fsync.html +561 -0
  1029. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#getFirmwareUpgradeStatus.html +560 -0
  1030. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#getStorageInfo.html +555 -0
  1031. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#listFiles.html +561 -0
  1032. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#mkdir.html +561 -0
  1033. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#moveFile.html +561 -0
  1034. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#readFile.html +563 -0
  1035. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#removeAll.html +561 -0
  1036. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#removeApplication.html +566 -0
  1037. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#removeFile.html +561 -0
  1038. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#statFile.html +561 -0
  1039. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#unzipFile.html +561 -0
  1040. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#upgradeApplication.html +566 -0
  1041. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#upgradeFirmware.html +560 -0
  1042. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage#writeFile.html +561 -0
  1043. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage.AppMode.html +640 -0
  1044. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage.AppType.html +640 -0
  1045. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Storage.SCAP_URI.html +512 -0
  1046. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Time#addHolidaySchedule.html +566 -0
  1047. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Time#delAllHolidaySchedules.html +566 -0
  1048. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Time#delHolidaySchedule.html +566 -0
  1049. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Time#getAllHolidaySchedules.html +560 -0
  1050. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Time#getHolidayScheduleMode.html +560 -0
  1051. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Time#setHolidayScheduleMode.html +566 -0
  1052. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Utility#createToast.html +561 -0
  1053. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Video#getContentRotation.html +560 -0
  1054. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Video#getVideoStatus.html +560 -0
  1055. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Video#setContentRotation.html +566 -0
  1056. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Video#setRotatedVideoTransform.html +566 -0
  1057. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Video#setVideoSize.html +566 -0
  1058. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/Video#setVideoViewTransform.html +566 -0
  1059. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/_global_.html +453 -0
  1060. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/image/media_status.jpg +0 -0
  1061. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/image/setVideoSize.png +0 -0
  1062. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_configuration.js.html +2651 -0
  1063. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_deviceInfo.js.html +1860 -0
  1064. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_inputSource.js.html +1382 -0
  1065. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_power.js.html +2697 -0
  1066. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_security.js.html +357 -0
  1067. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_signage.js.html +3601 -0
  1068. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_sound.js.html +1123 -0
  1069. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_storage.js.html +2615 -0
  1070. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_time.js.html +720 -0
  1071. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_utility.js.html +196 -0
  1072. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/doc/symbols/src/js_video.js.html +1090 -0
  1073. package/files/templates/signage-sdk-templates/scap_api/1.4.1/js/release_notes.txt +148 -0
  1074. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova/2.7.0/cordova.webos.js +7038 -0
  1075. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova/LICENSE +201 -0
  1076. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/configuration.js +1 -0
  1077. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/deviceInfo.js +1 -0
  1078. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/inputSource.js +1 -0
  1079. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/power.js +1 -0
  1080. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/security.js +1 -0
  1081. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/signage.js +1 -0
  1082. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/sound.js +1 -0
  1083. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/storage.js +1 -0
  1084. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/time.js +1 -0
  1085. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/utility.js +1 -0
  1086. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/cordova-cd/video.js +1 -0
  1087. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/all.css +358 -0
  1088. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/fonts/mplus-1m-bold-webfont.eot +0 -0
  1089. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/fonts/mplus-1m-bold-webfont.svg +134 -0
  1090. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/fonts/mplus-1m-bold-webfont.ttf +0 -0
  1091. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/fonts/mplus-1m-bold-webfont.woff +0 -0
  1092. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/fonts/mplus-1m-regular-webfont.eot +0 -0
  1093. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/fonts/mplus-1m-regular-webfont.svg +134 -0
  1094. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/fonts/mplus-1m-regular-webfont.ttf +0 -0
  1095. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/fonts/mplus-1m-regular-webfont.woff +0 -0
  1096. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/handheld.css +217 -0
  1097. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/css/screen.css +405 -0
  1098. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/files.html +599 -0
  1099. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/index.html +1280 -0
  1100. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/intro.html +100 -0
  1101. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/all.js +326 -0
  1102. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/dessert.css +34 -0
  1103. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-apollo.js +51 -0
  1104. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-clj.js +64 -0
  1105. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-css.js +78 -0
  1106. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-go.js +58 -0
  1107. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-hs.js +101 -0
  1108. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-lisp.js +93 -0
  1109. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-lua.js +59 -0
  1110. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-ml.js +56 -0
  1111. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-n.js +62 -0
  1112. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-proto.js +35 -0
  1113. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-scala.js +54 -0
  1114. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-sql.js +57 -0
  1115. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-tex.js +46 -0
  1116. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-vb.js +61 -0
  1117. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-vhdl.js +34 -0
  1118. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-wiki.js +53 -0
  1119. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-xq.js +67 -0
  1120. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/lang-yaml.js +27 -0
  1121. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/prettify.css +52 -0
  1122. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/highlighter/prettify.js +1477 -0
  1123. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/javascript/html5.js +6 -0
  1124. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#clearCache.html +572 -0
  1125. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getCurrentTime.html +582 -0
  1126. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getLocaleList.html +582 -0
  1127. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getOSDLanguage.html +582 -0
  1128. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getOSDLock.html +582 -0
  1129. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getPictureMode.html +582 -0
  1130. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getPictureProperty.html +582 -0
  1131. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getProperty.html +583 -0
  1132. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getServerProperty.html +582 -0
  1133. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getTimeZone.html +582 -0
  1134. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getTimeZoneList.html +582 -0
  1135. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getUSBLock.html +582 -0
  1136. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#getVirtualKeyboardLanguage.html +582 -0
  1137. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#restartApplication.html +572 -0
  1138. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setCurrentTime.html +588 -0
  1139. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setOSDLanguage.html +588 -0
  1140. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setOSDLock.html +588 -0
  1141. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setPictureMode.html +588 -0
  1142. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setPictureProperty.html +588 -0
  1143. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setProperty.html +583 -0
  1144. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setServerProperty.html +632 -0
  1145. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setTimeZone.html +588 -0
  1146. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setUSBLock.html +588 -0
  1147. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration#setVirtualKeyboardLanguage.html +588 -0
  1148. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration.AppMode.html +707 -0
  1149. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration.AppType.html +662 -0
  1150. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Configuration.PictureMode.html +932 -0
  1151. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#connectWifi.html +583 -0
  1152. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getBeaconInfo.html +582 -0
  1153. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getEddystoneInfo.html +582 -0
  1154. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getExternalInputList.html +588 -0
  1155. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getNetworkInfo.html +582 -0
  1156. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getNetworkMacInfo.html +582 -0
  1157. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getPlatformInfo.html +582 -0
  1158. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getProxyInfo.html +582 -0
  1159. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getSoftApInfo.html +582 -0
  1160. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getSystemUsageInfo.html +588 -0
  1161. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getWifiList.html +582 -0
  1162. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#getiBeaconInfo.html +582 -0
  1163. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#setBeaconInfo.html +583 -0
  1164. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#setEddystoneInfo.html +588 -0
  1165. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#setNetworkInfo.html +583 -0
  1166. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#setProxyInfo.html +588 -0
  1167. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#setSoftApInfo.html +583 -0
  1168. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#setiBeaconInfo.html +588 -0
  1169. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#startWps.html +588 -0
  1170. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo#stopWps.html +577 -0
  1171. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/DeviceInfo.EddystoneFrame.html +662 -0
  1172. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Error.ERROR_CODE.html +842 -0
  1173. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Error.html +482 -0
  1174. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/InputSource#changeInputSource.html +588 -0
  1175. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/InputSource#getInputSourceStatus.html +582 -0
  1176. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/InputSource#initialize.html +583 -0
  1177. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#addOffTimer.html +588 -0
  1178. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#addOnTimer.html +588 -0
  1179. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#deleteOffTimer.html +588 -0
  1180. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#deleteOnTimer.html +588 -0
  1181. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#enableAllOffTimer.html +588 -0
  1182. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#enableAllOnTimer.html +588 -0
  1183. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#enableWakeOnLan.html +588 -0
  1184. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#executePowerCommand.html +588 -0
  1185. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#getDPMWakeup.html +582 -0
  1186. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#getOffTimerList.html +582 -0
  1187. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#getOnOffTimeSchedule.html +582 -0
  1188. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#getOnTimerList.html +582 -0
  1189. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#getPMMode.html +582 -0
  1190. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#getPowerOnDelay.html +582 -0
  1191. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#getPowerStatus.html +582 -0
  1192. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#setDPMWakeup.html +588 -0
  1193. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#setDisplayMode.html +588 -0
  1194. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#setOnOffTimeSchedule.html +583 -0
  1195. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#setPMMode.html +588 -0
  1196. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#setPowerOnDelay.html +588 -0
  1197. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power#unsetOnOffTimeSchedule.html +582 -0
  1198. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power.DPMSignalType.html +662 -0
  1199. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power.DisplayMode.html +662 -0
  1200. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power.PMMode.html +797 -0
  1201. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power.PowerCommand.html +662 -0
  1202. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Power.TimerWeek.html +932 -0
  1203. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Security#existServerCertificate.html +583 -0
  1204. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Security#registerServerCertificate.html +583 -2
  1205. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Security#unregisterServerCertificate.html +583 -0
  1206. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#captureScreen.html +583 -0
  1207. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#enableCheckScreen.html +588 -0
  1208. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getFailoverMode.html +577 -0
  1209. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getIntelligentAuto.html +582 -0
  1210. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getLanDaisyChain.html +582 -0
  1211. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getPowerSaveMode.html +577 -0
  1212. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getSignageInfo.html +577 -0
  1213. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getStudioMode.html +582 -0
  1214. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getSystemMonitoringInfo.html +577 -0
  1215. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getTileInfo.html +577 -0
  1216. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getUsageData.html +577 -0
  1217. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#getUsagePermission.html +577 -0
  1218. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#registerRS232CEventListener.html +594 -0
  1219. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#registerSystemMonitor.html +595 -0
  1220. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setDigitalAudioInputMode.html +589 -0
  1221. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setFailoverMode.html +589 -0
  1222. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setIntelligentAuto.html +588 -0
  1223. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setIsmMethod.html +589 -0
  1224. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setLanDaisyChain.html +588 -0
  1225. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setPortraitMode.html +589 -0
  1226. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setPowerSaveMode.html +589 -0
  1227. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setStudioMode.html +588 -0
  1228. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setTileInfo.html +589 -0
  1229. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#setUsagePermission.html +589 -0
  1230. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#unregisterRS232CEventListener.html +582 -0
  1231. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage#unregisterSystemMonitor.html +577 -0
  1232. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.AutomaticStandbyMode.html +662 -0
  1233. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.DigitalAudioInput.html +662 -0
  1234. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.DpmMode.html +932 -0
  1235. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.EventType.html +797 -0
  1236. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.FailoverMode.html +707 -0
  1237. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.ImgResolution.html +662 -0
  1238. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.IsmMethod.html +932 -0
  1239. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.KeyOperationMode.html +707 -0
  1240. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.MonitoringSource.html +797 -0
  1241. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Signage.OsdPortraitMode.html +662 -0
  1242. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound#getSoundMode.html +582 -0
  1243. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound#getSoundOut.html +582 -0
  1244. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound#getSoundStatus.html +582 -0
  1245. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound#setExternalSpeaker.html +588 -0
  1246. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound#setMuted.html +588 -0
  1247. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound#setSoundMode.html +588 -0
  1248. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound#setSoundOut.html +588 -0
  1249. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound#setVolumeLevel.html +588 -0
  1250. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound.SoundMode.html +842 -0
  1251. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Sound.SpeakerType.html +662 -0
  1252. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#changeLogoImage.html +588 -0
  1253. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#copyFile.html +583 -0
  1254. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#decryptFile.html +583 -0
  1255. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#downloadFirmware.html +588 -0
  1256. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#exists.html +583 -0
  1257. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#fsync.html +583 -0
  1258. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#getFirmwareUpgradeStatus.html +582 -0
  1259. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#getMD5Hash.html +583 -0
  1260. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#getStorageInfo.html +577 -0
  1261. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#listFiles.html +583 -0
  1262. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#mkdir.html +583 -0
  1263. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#moveFile.html +583 -0
  1264. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#readFile.html +585 -0
  1265. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#removeAll.html +583 -0
  1266. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#removeApplication.html +588 -0
  1267. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#removeFile.html +583 -0
  1268. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#statFile.html +583 -0
  1269. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#unzipFile.html +583 -0
  1270. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#upgradeApplication.html +588 -0
  1271. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#upgradeFirmware.html +582 -0
  1272. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage#writeFile.html +583 -0
  1273. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage.AppMode.html +662 -0
  1274. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage.AppType.html +662 -0
  1275. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Storage.SCAP_URI.html +534 -0
  1276. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Time#addHolidaySchedule.html +588 -0
  1277. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Time#delAllHolidaySchedules.html +588 -0
  1278. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Time#delHolidaySchedule.html +588 -0
  1279. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Time#getAllHolidaySchedules.html +582 -0
  1280. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Time#getHolidaySchedule.html +582 -0
  1281. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Time#getHolidayScheduleMode.html +582 -0
  1282. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Time#setHolidaySchedule.html +583 -0
  1283. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Time#setHolidayScheduleMode.html +588 -0
  1284. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Time#unsetHolidaySchedule.html +582 -0
  1285. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Utility#createToast.html +583 -0
  1286. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Video#getContentRotation.html +586 -0
  1287. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Video#getVideoStatus.html +582 -0
  1288. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Video#setContentRotation.html +592 -0
  1289. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Video#setRotatedVideoTransform.html +592 -0
  1290. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Video#setVideoSize.html +588 -0
  1291. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/Video#setVideoViewTransform.html +592 -0
  1292. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/_global_.html +475 -0
  1293. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/image/media_status.jpg +0 -0
  1294. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/image/setVideoSize.png +0 -0
  1295. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_configuration.js.html +2651 -0
  1296. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_deviceInfo.js.html +1930 -0
  1297. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_inputSource.js.html +1383 -0
  1298. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_power.js.html +2942 -0
  1299. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_security.js.html +352 -0
  1300. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_signage.js.html +3853 -0
  1301. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_sound.js.html +1123 -0
  1302. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_storage.js.html +2747 -0
  1303. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_time.js.html +976 -0
  1304. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_utility.js.html +196 -0
  1305. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/doc/symbols/src/js_video.js.html +754 -0
  1306. package/files/templates/signage-sdk-templates/scap_api/1.5.0/js/release_notes.txt +148 -0
  1307. package/files/templates/signage-sdk-templates/serviceinfo/package.json +11 -0
  1308. package/files/templates/signage-sdk-templates/serviceinfo/services.json +8 -0
  1309. package/files/templates/signage-sdk-templates/signageicon/icon.png +0 -0
  1310. package/files/templates/signage-sdk-templates/signageicon/largeIcon.png +0 -0
  1311. package/files/templates/signage-sdk-templates/webos-service/helloclient.js +23 -0
  1312. package/files/templates/signage-sdk-templates/webos-service/helloworld_webos_service.js +128 -0
  1313. package/files/templates/tv-sdk-templates/appinfo/appinfo.json +10 -10
  1314. package/files/templates/tv-sdk-templates/bootplate-web/index.html +58 -58
  1315. package/files/templates/tv-sdk-templates/bootplate-web/webOSTVjs-1.2.10/LICENSE-2.0.txt +202 -202
  1316. package/files/templates/tv-sdk-templates/hosted-webapp/index.html +14 -14
  1317. package/files/templates/tv-sdk-templates/js-service/helloworld_service.js +39 -39
  1318. package/files/templates/tv-sdk-templates/packageinfo/packageinfo.json +3 -3
  1319. package/files/templates/tv-sdk-templates/serviceinfo/package.json +11 -11
  1320. package/files/templates/tv-sdk-templates/serviceinfo/services.json +8 -8
  1321. package/lib/base/ares.html +40 -40
  1322. package/lib/base/cli-appdata.js +289 -290
  1323. package/lib/base/cli-control.js +44 -44
  1324. package/lib/base/common-tools.js +29 -29
  1325. package/lib/base/error-handler.js +265 -265
  1326. package/lib/base/file-watcher.js +155 -155
  1327. package/lib/base/help-format.js +147 -147
  1328. package/lib/base/luna.js +178 -178
  1329. package/lib/base/novacom.js +1214 -1202
  1330. package/lib/base/sdkenv.js +59 -59
  1331. package/lib/base/server.js +137 -137
  1332. package/lib/base/setup-device.js +26 -8
  1333. package/lib/base/version-tools.js +79 -79
  1334. package/lib/com.sdk.ares.signage.hostedapp.ipk +0 -0
  1335. package/lib/device.js +1419 -1419
  1336. package/lib/generator.js +1 -1
  1337. package/lib/inspect.js +493 -493
  1338. package/lib/install.js +465 -463
  1339. package/lib/launch.js +607 -605
  1340. package/lib/log.js +584 -584
  1341. package/lib/package.js +2253 -2149
  1342. package/lib/pull.js +231 -231
  1343. package/lib/pusher.js +210 -210
  1344. package/lib/session.js +74 -74
  1345. package/lib/shell.js +193 -193
  1346. package/lib/tar-filter-pack.js +62 -62
  1347. package/lib/util/copy.js +31 -31
  1348. package/lib/util/createFileName.js +40 -40
  1349. package/lib/util/eof.js +30 -30
  1350. package/lib/util/json.js +63 -63
  1351. package/lib/util/merge.js +14 -14
  1352. package/lib/util/objclone.js +40 -40
  1353. package/lib/util/spinner.js +37 -37
  1354. package/npm-shrinkwrap.json +2 -2
  1355. package/package.json +1 -1
  1356. package/scripts/postinstall.js +24 -24
  1357. package/spec/helpers/reporter.js +65 -65
  1358. package/spec/jsSpecs/apiTest/generator.spec.js +372 -372
  1359. package/spec/jsSpecs/apiTest/inspector.spec.js +89 -89
  1360. package/spec/jsSpecs/apiTest/installer.spec.js +67 -67
  1361. package/spec/jsSpecs/apiTest/launcher.spec.js +150 -150
  1362. package/spec/jsSpecs/apiTest/packager.spec.js +194 -194
  1363. package/spec/jsSpecs/apiTest/puller.spec.js +101 -101
  1364. package/spec/jsSpecs/apiTest/pusher.spec.js +103 -103
  1365. package/spec/jsSpecs/apiTest/server.spec.js +115 -115
  1366. package/spec/jsSpecs/apiTest/setupDevice.spec.js +93 -93
  1367. package/spec/jsSpecs/apiTest/shell.spec.js +49 -49
  1368. package/spec/jsSpecs/ares-config.spec.js +88 -88
  1369. package/spec/jsSpecs/ares-device.spec.js +443 -443
  1370. package/spec/jsSpecs/ares-generate.spec.js +401 -397
  1371. package/spec/jsSpecs/ares-inspect.spec.js +252 -252
  1372. package/spec/jsSpecs/ares-install.spec.js +150 -150
  1373. package/spec/jsSpecs/ares-launch.spec.js +303 -301
  1374. package/spec/jsSpecs/ares-log.spec.js +824 -824
  1375. package/spec/jsSpecs/ares-novacom.spec.js +149 -149
  1376. package/spec/jsSpecs/ares-package.spec.js +1277 -1211
  1377. package/spec/jsSpecs/ares-pull.spec.js +157 -157
  1378. package/spec/jsSpecs/ares-push.spec.js +146 -146
  1379. package/spec/jsSpecs/ares-server.spec.js +160 -160
  1380. package/spec/jsSpecs/ares-setup-device.spec.js +299 -300
  1381. package/spec/jsSpecs/ares-shell.spec.js +220 -220
  1382. package/spec/jsSpecs/ares.spec.js +83 -83
  1383. package/spec/jsSpecs/common-spec.js +177 -169
  1384. package/spec/support/jasmine.json +22 -22
  1385. package/spec/tempFiles/com.lg.app.signage.dev_0.0.1_all.ipk +0 -0
  1386. package/spec/tempFiles/nativeApp/auto/pkg_arm64/appinfo.json +9 -9
  1387. package/spec/tempFiles/nativeApp/ose/pkg_arm/appinfo.json +8 -8
  1388. package/spec/tempFiles/nativeApp/ose/pkg_arm/package.properties +2 -2
  1389. package/spec/tempFiles/nativeApp/oseEmul/pkg_x86/appinfo.json +9 -9
  1390. package/spec/tempFiles/nativeApp/rsi/pkg_x86/appinfo.json +9 -9
  1391. package/spec/tempFiles/sign/sign.crt +32 -32
  1392. package/spec/tempFiles/sign/signPriv.key +52 -52
  1393. package/spec/test_data/ares-generate.json +91 -58
  1394. package/spec/test_data/ares.json +50 -50
  1395. package/webos-tools-cli-3.2.0.tgz +0 -0
  1396. package/webos-tools-cli-3.1.3.tgz +0 -0
package/lib/package.js CHANGED
@@ -1,2149 +1,2253 @@
1
- /*
2
- * Copyright (c) 2020-2024 LG Electronics Inc.
3
- *
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- const ar = require('ar-async'),
8
- async = require('async'),
9
- chardet = require('chardet'),
10
- CombinedStream = require('combined-stream'),
11
- crypto = require('crypto'),
12
- decompress = require('decompress'),
13
- decompressTargz = require('decompress-targz'),
14
- ElfParser = require('elfy').Parser,
15
- encoding = require('encoding'),
16
- fs = require('fs'),
17
- fstream = require('fstream'),
18
- Validator = require('jsonschema').Validator,
19
- mkdirp = require('mkdirp'),
20
- log = require('npmlog'),
21
- path = require('path'),
22
- rimraf = require('rimraf'),
23
- shelljs = require('shelljs'),
24
- stripbom = require('strip-bom'),
25
- temp = require('temp'),
26
- uglify = require('terser'),
27
- util = require('util'),
28
- // zlib = require('zlib'),
29
- // tarFilterPack = require('./tar-filter-pack'),
30
- errHndl = require('./base/error-handler'),
31
- tar = require('tar');
32
-
33
- (function() {
34
- log.heading = 'packager';
35
- log.level = 'warn';
36
-
37
- const servicePkgMethod = 'id',
38
- defaultAssetsFields = {
39
- "main": true,
40
- "icon": true,
41
- "largeIcon": true,
42
- "bgImage": true,
43
- "splashBackground": true,
44
- "imageForRecents": true,
45
- "sysAssetsBasePath": true
46
- },
47
- FILE_TYPE = {
48
- file: 'file',
49
- dir: 'dir',
50
- symlink: 'symlink'
51
- },
52
- packager = {};
53
- let objectCounter = 0;
54
-
55
- if (typeof module !== 'undefined' && module.exports) {
56
- module.exports = packager;
57
- }
58
-
59
- function Packager() {
60
- this.objectId = objectCounter++;
61
- this.verbose = false;
62
- this.silent = true;
63
- this.noclean = false;
64
- this.nativecmd = false;
65
- this.minify = true;
66
- this.excludeFiles = [];
67
- this.rom = false;
68
- this.encrypt = false;
69
- this.sign = "";
70
- this.certificate = "";
71
- this.appCount = 0;
72
- this.services = [];
73
- this.pkgServiceNames = [];
74
- this.rscCount = 0;
75
- this.resources = [];
76
- this.pkgResourceNames = [];
77
- this.pkgId;
78
- this.pkginfofile;
79
- }
80
-
81
- packager.Packager = Packager;
82
-
83
- Packager.prototype = {
84
- prepareOptions: function(options, next) {
85
- if (options && options.level) {
86
- log.level = options.level;
87
- if (['warn', 'error'].indexOf(options.level) !== -1) {
88
- this.silent = false;
89
- }
90
- }
91
-
92
- if (options && options.noclean === true) {
93
- this.noclean = true;
94
- }
95
-
96
- if (options && options.nativecmd === true) {
97
- this.nativecmd = true;
98
- }
99
-
100
- if (options && Object.prototype.hasOwnProperty.call(options, 'minify')) {
101
- this.minify = options.minify;
102
- }
103
-
104
- if (options && Object.prototype.hasOwnProperty.call(options, 'excludefiles')) {
105
- if (options.excludefiles instanceof Array) {
106
- this.excludeFiles = options.excludefiles;
107
- } else {
108
- this.excludeFiles.push(options.excludefiles);
109
- }
110
-
111
- this.excludeFiles.forEach(function(excl_file) {
112
- if (excl_file === "appinfo.json") {
113
- return next(errHndl.getErrMsg("NOT_EXCLUDE_APPINFO"));
114
- }
115
- });
116
- }
117
-
118
- if (options && Object.prototype.hasOwnProperty.call(options, 'rom')) {
119
- this.rom = options.rom;
120
- }
121
-
122
- if (options && Object.prototype.hasOwnProperty.call(options, 'encrypt')) {
123
- this.encrypt = options.encrypt;
124
- }
125
-
126
- if (options && Object.prototype.hasOwnProperty.call(options, 'sign')) {
127
- if (!fs.existsSync(path.resolve(options.sign))) {
128
- return next(errHndl.getErrMsg("NOT_EXIST_PATH", options.sign));
129
- }
130
- this.sign = options.sign;
131
- }
132
-
133
- if (options && Object.prototype.hasOwnProperty.call(options, 'certificate')) {
134
- if (!fs.existsSync(path.resolve(options.certificate))) {
135
- return next(errHndl.getErrMsg("NOT_EXIST_PATH", options.certificate));
136
- }
137
- this.certificate = options.certificate;
138
- }
139
-
140
- // check sign option must be used with certificate option
141
- if ((this.sign && !this.certificate) ||
142
- (this.certificate && !this.sign)) {
143
- return next(errHndl.getErrMsg("USE_WITH_OPTIONS", "sign, certificate"));
144
- }
145
-
146
- log.verbose("package#Packager()", "Packager id:" + this.objectId);
147
-
148
- this.pkgVersion = options.pkgversion;
149
-
150
- if (options && Object.prototype.hasOwnProperty.call(options, 'pkgid')) {
151
- this.pkgId = options.pkgid;
152
- }
153
-
154
- if (options && Object.prototype.hasOwnProperty.call(options, 'pkginfofile')) {
155
- this.pkginfofile = options.pkginfofile;
156
- }
157
-
158
- if (this.pkgId && this.pkginfofile) {
159
- return next(errHndl.getErrMsg("NOT_USE_WITH_OPTIONS", "pkginfofile, pkgid"));
160
- }
161
- this.appCount = 0;
162
- },
163
- checkInputDirectories: function(inDirs, options, next) {
164
- log.verbose("package#Packager#checkInputDirectories()", "input directory:", inDirs);
165
- this.prepareOptions(options, next);
166
-
167
- async.forEachSeries(inDirs, checkDirectory.bind(this, options), function(err) {
168
- if (err) {
169
- setImmediate(next, err);
170
- return;
171
- }
172
- setImmediate(next);
173
- });
174
- return {app: this.appCount, resource: this.rscCount};
175
- },
176
- servicePackaging: function(inDirs, destination, options, middleCb, next) {
177
- log.info("package#Packager#servicePackaging()");
178
-
179
- if (!Object.hasOwnProperty.call(options, 'pkgid') && !Object.hasOwnProperty.call(options, 'pkginfofile')) {
180
- return next(errHndl.getErrMsg("USE_PKGID_PKGINFO"));
181
- }
182
-
183
- async.series([
184
- this.checkInputDirectories.bind(this, inDirs, options),
185
- setUmask.bind(this, 0),
186
- loadPkgInfo.bind(this),
187
- createTmpDir.bind(this),
188
- excludeIpkFileFromApp.bind(this),
189
- createPackageDir.bind(this),
190
- fillPackageDir.bind(this),
191
- findServiceDir.bind(this, this.services),
192
- loadServiceInfo.bind(this),
193
- checkServiceInfo.bind(this),
194
- createServiceDir.bind(this),
195
- copyService.bind(this),
196
- addServiceInPkgInfo.bind(this),
197
- copyData.bind(this, inDirs, options.force),
198
- loadPackageProperties.bind(this, inDirs),
199
- excludeFromApp.bind(this, middleCb),
200
- outputPackage.bind(this, destination),
201
- encryptPackage.bind(this),
202
- copyOutputToDst.bind(this, destination, middleCb),
203
- recoverUmask.bind(this),
204
- cleanupTmpDir.bind(this, middleCb)
205
- ], function(err) {
206
- if (err) {
207
- // TODO: call cleanupTmpDir() before returning
208
- setImmediate(next, err);
209
- return;
210
- }
211
- // TODO: probably some more checkings are needed
212
- setImmediate(next, null, {ipk: this.ipk, msg: "Success"});
213
- }.bind(this));
214
- },
215
- resourcePackaging: function(inDirs, destination, options, middleCb, next) {
216
- log.info("package#Packager#resourcePackaging()");
217
- this.dataCopyCount = 0;
218
- async.series([
219
- this.checkInputDirectories.bind(this, inDirs, options),
220
- setUmask.bind(this, 0),
221
- loadPkgInfo.bind(this),
222
- createTmpDir.bind(this),
223
- excludeIpkFileFromApp.bind(this),
224
- createPackageDir.bind(this),
225
- fillPackageDir.bind(this),
226
- loadResourceInfo.bind(this),
227
- checkResourceInfo.bind(this),
228
- createResourceDir.bind(this),
229
- copyResource.bind(this),
230
- addResourceInPkgInfo.bind(this),
231
- copyData.bind(this, inDirs, options.force),
232
- loadPackageProperties.bind(this, inDirs),
233
- excludeFromApp.bind(this, middleCb),
234
- outputPackage.bind(this, destination),
235
- encryptPackage.bind(this),
236
- copyOutputToDst.bind(this, destination, middleCb),
237
- recoverUmask.bind(this),
238
- cleanupTmpDir.bind(this, middleCb)
239
- ], function(err) {
240
- if (err) {
241
- setImmediate(next, err);
242
- return;
243
- }
244
- setImmediate(next, null, {ipk: this.ipk, msg: "Success"});
245
- }.bind(this));
246
- },
247
- generatePackage: function(inDirs, destination, options, middleCb, next) {
248
- log.info("package#Packager#generatePackage()", "from ", inDirs);
249
- // check whether app or service directories are copied or not
250
- this.dataCopyCount = 0;
251
- this.minifyDone = !this.minify;
252
-
253
- async.series([
254
- this.checkInputDirectories.bind(this, inDirs, options),
255
- setUmask.bind(this, 0),
256
- loadPkgInfo.bind(this),
257
- loadAppInfo.bind(this),
258
- checkAppInfo.bind(this),
259
- createTmpDir.bind(this),
260
- createAppDir.bind(this),
261
- checkELFHeader.bind(this),
262
- fillAssetsField.bind(this),
263
- copyAssets.bind(this),
264
- copyApp.bind(this),
265
- excludeIpkFileFromApp.bind(this),
266
- createPackageDir.bind(this),
267
- fillPackageDir.bind(this),
268
- findServiceDir.bind(this, this.services),
269
- loadServiceInfo.bind(this),
270
- checkServiceInfo.bind(this),
271
- createServiceDir.bind(this),
272
- copyService.bind(this),
273
- addServiceInPkgInfo.bind(this),
274
- removeServiceFromAppDir.bind(this, middleCb),
275
- copyData.bind(this, inDirs, options.force),
276
- loadPackageProperties.bind(this, inDirs),
277
- excludeFromApp.bind(this, middleCb),
278
- outputPackage.bind(this, destination),
279
- encryptPackage.bind(this),
280
- copyOutputToDst.bind(this, destination, middleCb),
281
- recoverUmask.bind(this),
282
- cleanupTmpDir.bind(this, middleCb)
283
- ], function(err) {
284
- if (err) {
285
- // TODO: call cleanupTmpDir() before returning
286
- setImmediate(next, err);
287
- return;
288
- }
289
- // TODO: probably some more checkings are needed
290
- setImmediate(next, null, {ipk: this.ipk, msg: "Success"});
291
- }.bind(this));
292
- },
293
- analyzeIPK: function(options, next) {
294
- log.info("package#Packager#analyzeIPK()");
295
- let ipkConfigFile, ipkFile, ipkConfig, tmpDirPath;
296
- this.prepareOptions(options);
297
-
298
- async.series([
299
- _setConfig,
300
- _unpackIpk,
301
- _unpackTar,
302
- _analyzeMetaFile,
303
- _removeTmpDir,
304
- ], function(err, results) {
305
- log.silly("package#analyzeIPK()", "err:", err, ", results:", results);
306
- if (err) {
307
- return next(err);
308
- }
309
- return next(null, {msg: results[3].trim()});
310
- });
311
-
312
- function _setConfig(next) {
313
- log.info("package#analyzeIPK()#_setConfig()");
314
- if (options.info === 'true') {
315
- return next(errHndl.getErrMsg("EMPTY_VALUE", 'info'));
316
- } else if (options.infodetail === 'true') {
317
- return next(errHndl.getErrMsg("EMPTY_VALUE", 'info-detail'));
318
- }
319
- ipkFile = options.info ? options.info : options.infodetail;
320
- ipkConfigFile = path.resolve(__dirname, "../files/conf/ipk.json");
321
-
322
- if (path.extname(ipkFile) !== ".ipk") {
323
- return next(errHndl.getErrMsg("SUPPORT_ONLY_IPK", ipkFile));
324
- }
325
- if (!fs.existsSync(ipkFile)) {
326
- return next(errHndl.getErrMsg("NOT_EXIST_PATH", ipkFile));
327
- }
328
- if (!fs.existsSync(ipkConfigFile)) {
329
- return next(errHndl.getErrMsg("NOT_EXIST_PATH", ipkConfigFile));
330
- }
331
- ipkConfig = JSON.parse(fs.readFileSync(ipkConfigFile));
332
- tmpDirPath = temp.path(ipkConfig.tmpPath);
333
-
334
- if (!fs.existsSync(tmpDirPath)) {
335
- fs.mkdirSync(tmpDirPath);
336
- }
337
- next();
338
- }
339
-
340
- function _unpackIpk(next) {
341
- log.info("package#analyzeIPK()#_unpackIpk()");
342
- const reader = new ar.ArReader(ipkFile);
343
-
344
- reader.on("entry", function(entry, next) {
345
- const name = entry.fileName();
346
- entry.fileData()
347
- .pipe(fs.createWriteStream(path.resolve(tmpDirPath, name)))
348
- .on("finish", next);
349
- });
350
- reader.on("error", function(err) {
351
- return next(err);
352
- });
353
- reader.on("close", function() {
354
- log.verbose("package#analyzeIPK()#_unpackIpk()", "unpack ipk close");
355
- next();
356
- });
357
- }
358
-
359
- function _unpackTar(next) {
360
- log.info("package#analyzeIPK()#_unpackTar()");
361
- if (fs.existsSync(path.resolve(tmpDirPath, "control.tar.gz"))) {
362
- (async function() {
363
- await decompress(path.resolve(tmpDirPath, "control.tar.gz"), tmpDirPath, {
364
- plugins: [
365
- decompressTargz()
366
- ]
367
- });
368
- log.verbose("package#analyzeIPK()#_unpackTar()", "control.tar.gz decompressed");
369
- })();
370
- } else if (fs.existsSync(path.resolve(tmpDirPath, "control.tar.xz"))) {
371
- return next(errHndl.getErrMsg("NOT_SUPPORT_XZ"));
372
- } else {
373
- return next(errHndl.getErrMsg("NO_COMPONENT_FILE", ", control tar file"));
374
- }
375
-
376
- if (fs.existsSync(path.resolve(tmpDirPath, "data.tar.gz"))) {
377
- (async function() {
378
- await decompress(path.resolve(tmpDirPath, "data.tar.gz"), tmpDirPath, {
379
- plugins: [
380
- decompressTargz()
381
- ]
382
- });
383
- log.verbose("package#analyzeIPK()#_unpackTar()", "data.tar.gz decompressed");
384
- next();
385
- })();
386
- } else if (fs.existsSync(path.resolve(tmpDirPath, "data.tar.xz"))) {
387
- return next(errHndl.getErrMsg("NOT_SUPPORT_XZ"));
388
- } else {
389
- return next(errHndl.getErrMsg("NO_COMPONENT_FILE", "data tar file"));
390
- }
391
- }
392
-
393
- function _analyzeMetaFile(next) {
394
- log.info("package#analyzeIPK()#_analyzeMetaFile()");
395
- let result = "", targetFile, tmpTxt;
396
-
397
- ipkConfig.webOSMetaFiles.forEach(function(item) {
398
- const targetPath = path.resolve(tmpDirPath, ipkConfig[item].path);
399
- // Analyze control file
400
- if (item === "control") {
401
- targetFile = path.resolve(targetPath, ipkConfig[item].fileName);
402
- if (!fs.existsSync(targetFile)) {
403
- return next(errHndl.getErrMsg("NO_COMPONENT_FILE", "control file"));
404
- }
405
-
406
- if (options.infodetail) {
407
- result = "\n\n< " + ipkConfig[item].fileName + " >\n";
408
- result += fs.readFileSync(targetFile).toString().trim();
409
- } else {
410
- result = ipkConfig[item].heading + "\n";
411
- tmpTxt = fs.readFileSync(targetFile).toString().trim();
412
- ipkConfig[item].info.forEach(function(field) {
413
- if (tmpTxt.match(new RegExp(field + ": (.*)", "gi"))) {
414
- result += tmpTxt.match(new RegExp(field + ": (.*)", "gi"))[0] + "\n";
415
- }
416
- });
417
- }
418
- // Analyze appinfo.json, packageinfo.json, services.json, package.json files
419
- } else if (fs.existsSync(targetPath)) {
420
- const dirArr = fs.readdirSync(targetPath);
421
- let beforeDir = dirArr[0];
422
-
423
- dirArr.forEach(function(dir) {
424
- if (ipkConfig[item].fileName) {
425
- ipkConfig[item].fileName.forEach(function(file) {
426
- targetFile = path.resolve(targetPath, dir, file);
427
- if (fs.existsSync(targetFile)) {
428
- if (options.infodetail) {
429
- result += "\n\n< " + file + " >\n";
430
- result += fs.readFileSync(targetFile).toString().trim();
431
- } else {
432
- if (ipkConfig[item].heading && beforeDir !== path.join(ipkConfig[item].path, dir)) {
433
- result += "\n" + ipkConfig[item].heading + "\n";
434
- }
435
- tmpTxt = fs.readFileSync(targetFile).toString().trim();
436
- const tmpJson = JSON.parse(tmpTxt);
437
- ipkConfig[item].info.forEach(function(field) {
438
- if (tmpJson[field]) {
439
- const fieldValue = tmpJson[field];
440
- if (typeof fieldValue === "object") {
441
- if (ipkConfig[item][field]) { // Case of services.json, services_name field
442
- const subField = ipkConfig[item][field],
443
- subResult = [];
444
- fieldValue.forEach(function(subItem) {
445
- subResult.push(subItem[subField]);
446
- });
447
- result += field + ": " + JSON.stringify(subResult) + "\n";
448
- } else { // Case of packageinfo.json, services field
449
- result += field + ": " + JSON.stringify(fieldValue) + "\n";
450
- }
451
- } else {
452
- result += field + ": " + fieldValue + "\n";
453
- }
454
- }
455
- });
456
- beforeDir = path.join(ipkConfig[item].path, dir);
457
- }
458
- }
459
- });
460
- }
461
- });
462
- }
463
- });
464
- next(null, result);
465
- }
466
-
467
- function _removeTmpDir(next) {
468
- log.info("package#analyzeIPK()#_removeTmpDir()");
469
- rimraf(tmpDirPath, function(err) {
470
- log.verbose("package#analyzeIPK()#_removeTmpDir()", "removed " + tmpDirPath);
471
- next(err);
472
- });
473
- }
474
- }
475
- };
476
-
477
- function Service() {
478
- this.srcDir = "";
479
- this.dstDirs = [];
480
- this.valid = false;
481
- this.serviceInfo = "";
482
- this.dirName = "";
483
- }
484
-
485
- // Private functions
486
- function loadPkgInfo(next) {
487
- log.verbose("loadPkgInfo");
488
- let data;
489
-
490
- if (this.pkginfofile) {
491
- log.silly("Use pkginfofile option");
492
- if (fs.existsSync(this.pkginfofile)) {
493
- if ("packageinfo.json" !== path.basename(this.pkginfofile)) {
494
- return setImmediate(next, errHndl.getErrMsg("INVALID_FILE", "packageinfo.json"));
495
- }
496
- data = rewriteFileWoBOMAsUtf8(this.pkginfofile, true);
497
- try {
498
- log.verbose("PKGINFO >>" + data + "<<");
499
- this.pkginfo = JSON.parse(data);
500
-
501
- if (!Object.prototype.hasOwnProperty.call(this.pkginfo, 'id')) {
502
- return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "id"));
503
- }
504
-
505
- this.pkgId = this.pkginfo.id;
506
- this.pkgVersion = this.pkgVersion || this.pkginfo.version;
507
- setImmediate(next);
508
- }
509
- catch (err) {
510
- return setImmediate(next, errHndl.getErrMsg("INVALID_JSON_FORMAT", "packageinfo.json"));
511
- }
512
- } else {
513
- return setImmediate(next, errHndl.getErrMsg("NOT_EXIST_PATH", this.pkginfofile));
514
- }
515
- } else if (this.pkgDir) {
516
- log.silly("Use packageinfo.json from PKG_DIR");
517
- data = rewriteFileWoBOMAsUtf8(path.join(this.pkgDir, "packageinfo.json"));
518
- try {
519
- log.verbose("PKGINFO >>" + data + "<<");
520
- this.pkginfo = JSON.parse(data);
521
-
522
- if (!Object.prototype.hasOwnProperty.call(this.pkginfo, 'id')) {
523
- return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "id"));
524
- }
525
- this.pkgId = this.pkginfo.id;
526
- this.pkgVersion = this.pkgVersion || this.pkginfo.version;
527
- setImmediate(next);
528
- }
529
- catch (err) {
530
- return setImmediate(next, errHndl.getErrMsg("INVALID_JSON_FORMAT", "packageinfo.json"));
531
- }
532
- } else {
533
- return setImmediate(next);
534
- }
535
- }
536
-
537
- function loadAppInfo(next) {
538
- log.verbose("loadAppInfo");
539
- if (this.appCount === 0) {
540
- return setImmediate(next);
541
- }
542
-
543
- const filepath = path.join(this.appDir, "appinfo.json"),
544
- data = rewriteFileWoBOMAsUtf8(filepath, true);
545
- try {
546
- this.appinfo = JSON.parse(data);
547
- log.silly("package#loadAppInfo()", "content of appinfo.json:", this.appinfo);
548
-
549
- if (!this.appinfo.version || this.appinfo.version === undefined) {
550
- this.appinfo.version = "1.0.0";
551
- }
552
-
553
- this.pkgVersion = this.pkgVersion || this.appinfo.version;
554
- setImmediate(next);
555
- } catch(err) {
556
- setImmediate(next, err);
557
- }
558
- }
559
-
560
- function checkAppInfo(next) {
561
- if (this.appCount === 0) {
562
- return setImmediate(next);
563
- }
564
-
565
- // check enyo app
566
- if (this.pkgJSExist && this.appinfo.main && this.appinfo.main.match(/(\.html|\.htm)$/gi)) {
567
- const mainFile = path.join(this.appDir, this.appinfo.main);
568
- if (!fs.existsSync(mainFile)) {
569
- return setImmediate(next, errHndl.getErrMsg("NOT_EXIST_PATH", this.appinfo.main));
570
- }
571
-
572
- const regex = new RegExp("(<script[^>]*src[ \t]*=[ \t]*['\"])[^'\"]*/enyo.js(['\"])"),
573
- data = fs.readFileSync(mainFile);
574
- if (data.toString().match(regex)) {
575
- // If enyo app, stop packaging.
576
- return setImmediate(next, errHndl.getErrMsg("NOT_SUPPORT_ENYO"));
577
- }
578
- }
579
-
580
- if (!this.appinfo.id || this.appinfo.id === undefined) {
581
- return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "id"));
582
- }
583
- if (this.appinfo.id.length < 1 || !(/^[a-z0-9.+-]*$/.test(this.appinfo.id))) {
584
- log.error(errHndl.getErrMsg("INVALID_VALUE", "id", this.appinfo.id));
585
- return setImmediate(next, errHndl.getErrMsg("INVALID_ID_RULE"));
586
- }
587
- if (this.pkgId && this.appinfo.id.indexOf(this.pkgId) !== 0) {
588
- log.error(errHndl.getErrMsg("INVALID_VALUE", "id", this.appinfo.id));
589
- return setImmediate(next, errHndl.getErrMsg("INVALID_APPID", this.pkgId));
590
- }
591
- if (!this.appinfo.version || this.appinfo.version === undefined) {
592
- return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "version"));
593
- }
594
- if (this.appinfo.version.length < 1 || !(/^([1-9]\d{0,8}|\d)\.([1-9]\d{0,8}|\d)\.([1-9]\d{0,8}|\d)$/.test(this.appinfo.version))) {
595
- log.error(errHndl.getErrMsg("INVALID_VALUE", "version", this.appinfo.version));
596
- return setImmediate(next, errHndl.getErrMsg("INVALID_VERSION_RULE"));
597
- }
598
- if (this.appinfo.type && this.appinfo.type.match(/clock/gi)) {
599
- return setImmediate(next);
600
- }
601
-
602
- const schemaFile = path.resolve(__dirname, "../files/schema/ApplicationDescription.schema");
603
- async.waterfall([
604
- fs.readFile.bind(this, schemaFile, "utf-8"),
605
- function getSchema(data, next) {
606
- try {
607
- const schema = JSON.parse(data);
608
- /* "required" keyword is redefined in draft 4.
609
- But current jsonschema lib support only draft 3.
610
- So this line changes "required" attribute according to the draft 3.
611
- */
612
- const reqKeys = schema.required;
613
- if (reqKeys) {
614
- for (const key in schema.properties) {
615
- if (reqKeys.indexOf(key) !== -1) {
616
- schema.properties[key].required = true;
617
- }
618
- }
619
- }
620
- next(null, schema);
621
- } catch(err) {
622
- next(errHndl.getErrMsg("INVALID_JSON_FORMAT", "AppDescription schema"));
623
- }
624
- },
625
- function checkValid(schema, next) {
626
- try {
627
- next(null, new Validator().validate(this.appinfo, schema));
628
- } catch (err) {
629
- log.error(err);
630
- next(errHndl.getErrMsg("INVALID_JSON_FORMAT"));
631
- }
632
- }.bind(this)
633
- ], function(err, result) {
634
- if (err) {
635
- setImmediate(next, err);
636
- } else {
637
- if (result && result.errors.length > 0) {
638
- const errFile = "appinfo.json";
639
- let errMsg = "";
640
- for (const idx in result.errors) {
641
- let errMsgLine = result.errors[idx].property + " " + result.errors[idx].message;
642
- if (errMsgLine.indexOf("instance.") > -1) {
643
- errMsgLine = errMsgLine.substring("instance.".length);
644
- errMsg = errMsg.concat("\n");
645
- errMsg = errMsg.concat(errMsgLine);
646
- }
647
- }
648
- errMsg = errHndl.getErrMsg("INVALID_FILE", errFile, errMsg);
649
- return setImmediate(next, errMsg);
650
- } else {
651
- log.verbose("package#checkAppInfo()", "APPINFO is valid");
652
- }
653
- setImmediate(next);
654
- }
655
- });
656
- }
657
-
658
- function fillAssetsField(next) {
659
- if (this.appCount === 0) {
660
- return setImmediate(next);
661
- }
662
- // make appinfo.assets to have default values so that they can be copied into the package
663
- this.appinfo.assets = this.appinfo.assets || [];
664
- for (const i in this.appinfo) {
665
- if (Object.prototype.hasOwnProperty.call(this.appinfo, i) && defaultAssetsFields[i]) {
666
- // no duplicated adding & value should not null string & file/dir should exist
667
- if ((this.appinfo.assets.indexOf(this.appinfo[i]) === -1) && this.appinfo[i]) {
668
- this.appinfo.assets.push(this.appinfo[i]);
669
- }
670
- }
671
- }
672
-
673
- // refer to appinfo.json files in localization directory.
674
- const appInfoPath = this.originAppDir,
675
- checkDir = path.join(this.originAppDir, "resources"),
676
- foundFilePath = [],
677
- resourcesAssets = [];
678
-
679
- try {
680
- const stat = fs.lstatSync(checkDir);
681
- if (!stat.isDirectory()) {
682
- return setImmediate(next, null);
683
- }
684
- } catch(err) {
685
- if (err.code === "ENOENT") {
686
- return setImmediate(next, null);
687
- }
688
- }
689
-
690
- async.series([
691
- walkFolder.bind(null, checkDir, "appinfo.json", foundFilePath, 1),
692
- function(next) {
693
- async.forEach(foundFilePath, function(filePath, next) {
694
- rewriteFileWoBOMAsUtf8(filePath, true, function(err, data) {
695
- try {
696
- const appInfo = JSON.parse(data),
697
- dirPath = path.dirname(filePath);
698
- for (const i in appInfo) {
699
- if (Object.prototype.hasOwnProperty.call(appInfo, i) && defaultAssetsFields[i]) {
700
- if (appInfo[i]) {
701
- const itemPath = path.join(dirPath, appInfo[i]),
702
- relPath = path.relative(appInfoPath, itemPath);
703
- // no duplicated adding & value should not null string & file/dir should exist
704
- if ((resourcesAssets.indexOf(relPath) === -1)) {
705
- resourcesAssets.push(relPath);
706
- }
707
- }
708
- }
709
- }
710
- setImmediate(next, null);
711
- } catch(error) {
712
- setImmediate(next, errHndl.getErrMsg("INVALID_JSON_FORMAT", filePath));
713
- }
714
- });
715
- }, function(err) {
716
- setImmediate(next, err);
717
- });
718
- },
719
- function(next) {
720
- this.appinfo.assets = this.appinfo.assets.concat(resourcesAssets);
721
- setImmediate(next, null);
722
- }.bind(this)
723
- ], function(err) {
724
- setImmediate(next, err);
725
- });
726
- }
727
-
728
- function createTmpDir(next) {
729
- this.tempDir = temp.path({prefix: 'com.palm.ares.hermes.bdOpenwebOS'}) + '.d';
730
- log.verbose("package#createTmpDir()", "temp dir:", this.tempDir);
731
- mkdirp(this.tempDir, next);
732
- }
733
-
734
- function createAppDir(next) {
735
- if (this.appCount === 0) {
736
- return setImmediate(next);
737
- }
738
-
739
- try {
740
- this.applicationDir = path.resolve(this.tempDir, "data/usr/palm/applications", this.appinfo.id);
741
- log.info("package#createAppDir()", "application dir:" + this.applicationDir);
742
- mkdirp(this.applicationDir, next);
743
- } catch (err) {
744
- return setImmediate(next, err);
745
- }
746
- }
747
-
748
- function copySrcToDst(src, dst, next) {
749
- const fileList = [],
750
- self = this,
751
- requireMinify = !!((!!self.minify && !self.minifyDone));
752
- src = path.normalize(path.resolve(src));
753
- dst = path.normalize(path.resolve(dst));
754
-
755
- async.series([
756
- function(next) {
757
- const stat = fs.statSync(src);
758
- if (stat.isFile()) {
759
- _pushList(fileList, 'file', path.dirname(src), path.basename(src), true, null);
760
- setImmediate(next);
761
- } else {
762
- _getFileList(src, src, fileList, next);
763
- }
764
- },
765
- _copySrcToDst.bind(null, fileList, dst, requireMinify)
766
- ], function(err) {
767
- next(err);
768
- });
769
-
770
- function _pushList(list, type, basePath, relPath, isSubPath, indRelPath) {
771
- if (!FILE_TYPE[type]) {
772
- return;
773
- }
774
- list.push({
775
- type: type,
776
- basePath: basePath,
777
- relPath: relPath,
778
- isSubPath: isSubPath,
779
- indRelPath: indRelPath
780
- });
781
- }
782
-
783
- function _getFileList(dirPath, basePath, files, next) {
784
- // TODO: the following code should be more concise.
785
- // Handling symbolic links
786
- // if the path sym-link indicates is a sub-path of source directory, treat a sym-link as it is.
787
- // otherwise the files sym-link indicates should be copied
788
- async.waterfall([
789
- fs.readdir.bind(null, dirPath),
790
- function(fileNames, next) {
791
- if (fileNames.length === 0) {
792
- _pushList(files, 'dir', basePath, path.relative(basePath, dirPath), true, null);
793
- return setImmediate(next);
794
- }
795
-
796
- async.forEachSeries(fileNames, function(fileName, next) {
797
- const filePath = path.join(dirPath, fileName),
798
- relPath = path.relative(basePath, filePath);
799
-
800
- async.waterfall([
801
- fs.lstat.bind(null, filePath),
802
- function(lstat, next) {
803
- if (lstat.isSymbolicLink()) {
804
- let indicateFullPath;
805
- try {
806
- indicateFullPath = fs.realpathSync(filePath);
807
- } catch (err) {
808
- if (err.code === 'ENOENT') {
809
- log.warn("The file for symbolic link (" + filePath + ") is missing...");
810
- return setImmediate(next);
811
- }
812
- return setImmediate(next, err);
813
- }
814
-
815
- const indicateRelPath = fs.readlinkSync(filePath);
816
- if (indicateFullPath.indexOf(basePath) !== -1) {
817
- _pushList(files, 'symlink', basePath, relPath, true, indicateRelPath);
818
- } else {
819
- const stat = fs.statSync(filePath);
820
- if (stat.isDirectory()) {
821
- return _getFileList(filePath, basePath, files, next);
822
- } else if (stat.isFile()) {
823
- _pushList(files, 'file', basePath, relPath, true, null);
824
- }
825
- }
826
- setImmediate(next);
827
- } else if (lstat.isDirectory()) {
828
- return _getFileList(filePath, basePath, files, next);
829
- } else if (lstat.isFile()) {
830
- _pushList(files, 'file', basePath, relPath, true, null);
831
- setImmediate(next);
832
- } else {
833
- setImmediate(next);
834
- }
835
- }
836
- ], next); // async.waterfall
837
- }, next); // async.forEach
838
- }
839
- ], function(err) {
840
- return setImmediate(next, err);
841
- }); // async.waterfall
842
- }
843
-
844
- function _copySrcToDst(files, dstPath, minify, next) {
845
- try {
846
- async.forEachSeries(files, function(file, next) {
847
- if (!FILE_TYPE[file.type]) {
848
- log.verbose("package#copySrcToDst()#_copySrcToDst()", "ignore 'unknown file type'("+file.type+")");
849
- return;
850
- }
851
-
852
- if (!file.relPath) {
853
- log.verbose("package#copySrcToDst()#_copySrcToDst()", "ignore 'unknown path'");
854
- return setImmediate(next);
855
- }
856
-
857
- if (file.type === FILE_TYPE.dir) {
858
- mkdirp.sync(path.join(dstPath, file.relPath));
859
- return setImmediate(next);
860
- }
861
-
862
- const dstDirPath = path.dirname(path.join(dstPath, file.relPath));
863
- if (!fs.existsSync(dstDirPath)) {
864
- mkdirp.sync(dstDirPath);
865
- }
866
-
867
- if (file.type === FILE_TYPE.symlink) {
868
- if (file.isSubPath && file.indRelPath) {
869
- const linkFile = path.join(dstPath, file.relPath);
870
- if (fs.existsSync(linkFile)) {
871
- if (fs.lstatSync(linkFile).isSymbolicLink()) {
872
- fs.unlinkSync(linkFile);
873
- }
874
- }
875
- fs.symlinkSync(file.indRelPath, linkFile, null);
876
- }
877
- } else {
878
- const sourceFile = path.join(file.basePath, file.relPath);
879
- if (fs.existsSync(sourceFile)) {
880
- if (minify && '.js' === path.extname(sourceFile) && file.relPath.indexOf('node_modules') === -1) {
881
- log.verbose("package#copySrcToDst()#_copySrcToDst()", "require minification # sourceFile:", sourceFile);
882
- try {
883
- const data = uglify.minify(fs.readFileSync(sourceFile,'utf8'));
884
- if (data.error) {
885
- throw data.error;
886
- }
887
- fs.writeFileSync(path.join(dstPath, file.relPath), data.code, 'utf8');
888
- } catch (e) {
889
- log.verbose("package#copySrcToDst()#_copySrcToDst()", util.format('Failed to uglify code %s: %s', sourceFile, e.stack));
890
- return setImmediate(next, errHndl.getErrMsg("FAILED_MINIFY", sourceFile));
891
- }
892
- } else {
893
- shelljs.cp('-Rf', sourceFile, path.join(dstPath, file.relPath, '..'));
894
- }
895
- } else {
896
- log.verbose("package#copySrcToDst()#_copySrcToDst()", "ignore '" + file.relPath + "'");
897
- }
898
- }
899
- setImmediate(next);
900
- }, function(err) {
901
- if (!err && minify) {
902
- self.minifyDone = true;
903
- }
904
- setImmediate(next, err);
905
- });
906
- } catch(err) {
907
- setImmediate(next, err);
908
- }
909
- }
910
- }
911
-
912
- function checkELFHeader(next) {
913
- const self = this,
914
- ELF_HEADER_LEN = 64,
915
- buf = Buffer.alloc(ELF_HEADER_LEN),
916
- mainFile = path.resolve(path.join(this.appDir, this.appinfo.main));
917
-
918
- if (!fs.existsSync(mainFile)) {
919
- return setImmediate(next, errHndl.getErrMsg("NOT_EXIST_PATH", mainFile));
920
- }
921
-
922
- const fd = fs.openSync(mainFile, 'r'),
923
- stats = fs.fstatSync(fd),
924
- elfParser = new ElfParser(),
925
- _isELF = function(_buf) {
926
- if (_buf.slice(0, 4).toString() !== '\x7fELF') {
927
- return false;
928
- } else {
929
- return true;
930
- }
931
- };
932
-
933
- if (stats.size < ELF_HEADER_LEN) {
934
- log.verbose("package#checkELFHeader()", "file size is smaller than ELF Header size");
935
- return setImmediate(next);
936
- }
937
-
938
- fs.read(fd, buf, 0, ELF_HEADER_LEN, 0, function(err, bytesRead, _buf) {
939
- if (bytesRead < ELF_HEADER_LEN || err) {
940
- log.silly("package#checkELFHeader()", "err:", err, ", bytesRead:", bytesRead);
941
- log.silly("package#checkELFHeader()", "readBuf to parse ELF header is small or error occurred during reading file.");
942
- return setImmediate(next);
943
- }
944
-
945
- if (!_isELF(_buf)) {
946
- log.silly("package#checkELFHeader()", mainFile + " is not ELF format");
947
- } else {
948
- log.silly("package#checkELFHeader()", mainFile + " is ELF format");
949
- try {
950
- const elfHeader = elfParser.parseHeader(_buf);
951
- log.silly("package#checkELFHeader()", "elfHeader:", elfHeader);
952
-
953
- if (elfHeader.machine && elfHeader.machine.match(/86$/)) {
954
- // current emulator opkg is allowing only all, noarch and i586.
955
- // when it is used with --offline-root.
956
- self.architecture = 'i586';
957
- } else if (elfHeader.machine && elfHeader.machine.match(/amd64$/)) {
958
- // change amd64 to x86_64
959
- self.architecture = 'x86_64';
960
- } else if (elfHeader.machine && elfHeader.machine.match(/AArch64$/)) {
961
- // change AArch64 to aarch64
962
- self.architecture = 'aarch64';
963
- } else {
964
- self.architecture = elfHeader.machine;
965
- }
966
- } catch(e) {
967
- log.verbose("package#checkELFHeader()", "exception:", e);
968
- }
969
- }
970
- log.verbose("package#checkELFHeader()", "machine:", self.architecture);
971
- fs.close(fd);
972
- setImmediate(next);
973
- });
974
- }
975
-
976
- function copyApp(next) {
977
- if (this.appCount === 0) {
978
- return setImmediate(next);
979
- }
980
-
981
- this.dataCopyCount++;
982
- log.info("package#copyApp()", "copy " + this.appDir + " ==> " + this.applicationDir);
983
- copySrcToDst.call(this, this.appDir, this.applicationDir, next);
984
- }
985
-
986
- function copyAssets(next) {
987
- if (this.appCount === 0) {
988
- return setImmediate(next);
989
- }
990
-
991
- try {
992
- async.forEachSeries(this.appinfo.assets, _handleAssets.bind(this), next);
993
- } catch (err) {
994
- return setImmediate(next, err);
995
- }
996
-
997
- function _handleAssets(file, next) {
998
- if (path.resolve(this.originAppDir) === path.resolve(this.appDir)) {
999
- _checkAppinfo.call(this, file, next);
1000
- } else {
1001
- async.series([
1002
- _checkAppinfo.bind(this, file),
1003
- _copyAssets.bind(this, file)
1004
- ], next);
1005
- }
1006
- }
1007
-
1008
- function _checkAppinfo(file, next) {
1009
- let source;
1010
- if (path.resolve(file) === path.normalize(file)) {
1011
- return next(errHndl.getErrMsg("NOT_RELATIVE_PATH_APPINFO", file));
1012
- } else {
1013
- source = path.join(this.originAppDir, file);
1014
- }
1015
-
1016
- if (path.resolve(source).indexOf(this.originAppDir) !== 0) {
1017
- return next(errHndl.getErrMsg("NOT_RELATIVE_PATH_APPINFO", file));
1018
- }
1019
-
1020
- if (!fs.existsSync(source) && !this.rom) {
1021
- const msg = errHndl.getErrMsg("NOT_EXIST_PATH", file);
1022
- if (path.basename(source).indexOf('$') === 0) {
1023
- // ignore property with starting $ prefix (dynamic property handling in the platform)
1024
- return setImmediate(next);
1025
- } else {
1026
- return setImmediate(next, msg);
1027
- }
1028
- }
1029
- setImmediate(next);
1030
- }
1031
-
1032
- function _copyAssets(file, next) {
1033
- log.verbose("package#copyAssets()#_copyAssets", "'" + file + "' will be located in app directory");
1034
- const source = path.join(this.originAppDir, file),
1035
- destination = this.appDir;
1036
-
1037
- async.series([
1038
- function(next) {
1039
- if (!fs.existsSync(destination)) {
1040
- mkdirp(destination, next);
1041
- } else {
1042
- setImmediate(next);
1043
- }
1044
- }
1045
- ], function(err) {
1046
- if (err) {
1047
- return setImmediate(next, err);
1048
- }
1049
- shelljs.cp('-Rf', source, destination);
1050
- setImmediate(next);
1051
- });
1052
- }
1053
- }
1054
-
1055
- function excludeIpkFileFromApp(next) {
1056
- // Exclude a pre-built .ipk file
1057
- this.excludeFiles = this.excludeFiles.concat([
1058
- // eslint-disable-next-line no-useless-escape
1059
- "[.]*[\\.]ipk",
1060
- ".DS_Store",
1061
- // ".vscode",
1062
- // ".reloadignore",
1063
- // ".launchparams.json"
1064
- ]);
1065
- setImmediate(next);
1066
- }
1067
-
1068
- function _retrieve(list, regExp, dirPath, depth, next) {
1069
- async.waterfall([
1070
- fs.readdir.bind(null, dirPath), function(fileNames, next) {
1071
- async.forEach(fileNames, function(fileName, next) {
1072
- const filePath = path.join(dirPath, fileName);
1073
- async.waterfall([
1074
- fs.lstat.bind(null, filePath), function(stat, next) {
1075
- let result = false;
1076
- if (depth > 1 && regExp.test(fileName)) {
1077
- result = true;
1078
- list.push(filePath);
1079
- }
1080
-
1081
- if (!result && stat.isDirectory()) {
1082
- _retrieve(list, regExp, filePath, depth + 1, next);
1083
- } else {
1084
- setImmediate(next);
1085
- }
1086
- }
1087
- ], next);
1088
- }, next);
1089
- }
1090
- ], function(err) {
1091
- setImmediate(next, err);
1092
- });
1093
- }
1094
-
1095
- function excludeFromApp(middleCb, next) {
1096
- let excludes;
1097
- if (this.appCount === 0) {
1098
- excludes = this.excludeFiles;
1099
- } else {
1100
- excludes = this.excludeFiles.concat(this.appinfo.exclude || []);
1101
- }
1102
-
1103
- const regExpQueries = excludes.map(function(exclude) {
1104
- return exclude.replace(/^\./g,"^\\.").replace(/^\*/g,"").replace(/$/g,"$");
1105
- }, this),
1106
- strRegExp = regExpQueries.join("|"),
1107
- regExp = new RegExp(strRegExp, "i"),
1108
- excludeList = [],
1109
- tempDirPrefix = path.resolve(this.tempDir, "data/usr/palm");
1110
-
1111
- async.series([
1112
- _retrieve.bind(this, excludeList, regExp, tempDirPrefix, 0), function(next) {
1113
- const meta_files = ["appinfo.json", "services.json", "packageinfo.json", "resourceinfo.json"],
1114
- unexcludable = [],
1115
- excluded = [];
1116
- try {
1117
- excludeList.forEach(function(file) {
1118
- if (meta_files.includes(path.basename(file))) {
1119
- unexcludable.push(path.basename(file));
1120
- } else {
1121
- const sliced = file.slice(tempDirPrefix.length + 1);
1122
- excluded.push(sliced.slice(sliced.indexOf(path.sep) + 1));
1123
- shelljs.rm('-rf', file);
1124
- }
1125
- });
1126
- if (unexcludable.length > 0) {
1127
- middleCb("Cannot exclude: " + unexcludable); // FIXME
1128
- }
1129
- if (excluded.length > 0) {
1130
- middleCb("Excluded: " + excluded); // FIXME
1131
- }
1132
- setImmediate(next);
1133
- } catch(err) {
1134
- setImmediate(next, err);
1135
- }
1136
- }
1137
- ], function(err) {
1138
- if (err) {
1139
- return setImmediate(next, err);
1140
- }
1141
- setImmediate(next);
1142
- });
1143
- }
1144
-
1145
- function createPackageDir(next) {
1146
- if (!this.rom) {
1147
- const pkgDirName = this.pkgId || this.appinfo.id;
1148
- this.packageDir = path.join(this.tempDir, "data/usr/palm/packages", pkgDirName);
1149
- log.verbose("package#createPackageDir", "directory:", this.packageDir);
1150
- mkdirp(this.packageDir, next);
1151
- } else {
1152
- setImmediate(next);
1153
- }
1154
- }
1155
-
1156
- function fillPackageDir(next) {
1157
- log.verbose("fillPackageDir");
1158
-
1159
- if (!this.rom) {
1160
- let data = "";
1161
- if (this.pkginfo) {
1162
- // Use pkginfofile option or PKG_DIR
1163
- if (!this.pkginfo.version) {
1164
- this.pkginfo.version = this.pkgVersion || "1.0.0";
1165
- }
1166
- if (this.appinfo) {
1167
- this.pkginfo.app = this.appinfo.id;
1168
- }
1169
- _checkPkgInfo(this.pkginfo.id, this.pkginfo.version, next);
1170
- data = JSON.stringify(this.pkginfo, null, 2) + "\n";
1171
- } else {
1172
- // Use pkgid option or no option
1173
- const pkginfo = {
1174
- "id": this.pkgId || this.appinfo.id,
1175
- "version": this.pkgVersion || "1.0.0"
1176
- };
1177
- if (this.appinfo) {
1178
- pkginfo.app = this.appinfo.id;
1179
- }
1180
- _checkPkgInfo(pkginfo.id, pkginfo.version, next);
1181
- data = JSON.stringify(pkginfo, null, 2) + "\n";
1182
- }
1183
- log.verbose("Generating packageinfo.json: " + data);
1184
- fs.writeFile(path.join(this.packageDir, "packageinfo.json"), data, next);
1185
- } else {
1186
- setImmediate(next);
1187
- }
1188
-
1189
- function _checkPkgInfo(id, version, next) {
1190
- if (!(/^[a-z0-9.+-]*$/.test(id))) {
1191
- log.error(errHndl.getErrMsg("INVALID_VALUE", "pkg id", id));
1192
- return setImmediate(next, errHndl.getErrMsg("INVALID_ID_RULE"));
1193
- }
1194
-
1195
- if (!(/^([1-9]\d{0,8}|\d)\.([1-9]\d{0,8}|\d)\.([1-9]\d{0,8}|\d)$/.test(version))) {
1196
- log.error(errHndl.getErrMsg("INVALID_VALUE", "pkg version", version));
1197
- return setImmediate(next, errHndl.getErrMsg("INVALID_VERSION_RULE"));
1198
- }
1199
- }
1200
- }
1201
-
1202
-
1203
- function loadPackageProperties(inDirs, next) {
1204
- const self = this;
1205
- self.packageProperties = {};
1206
-
1207
- async.forEach(inDirs, function(inDir, next) {
1208
- const filename = path.join(inDir, "package.properties");
1209
-
1210
- function _checkFileMode(file) {
1211
- file = file.replace(/\\/g, "/").trim();
1212
- const idx = file.lastIndexOf("/");
1213
- file = (idx !== -1) ? file.slice(idx + 1) : file;
1214
- self.packageProperties[file] = this.fileMode;
1215
- }
1216
-
1217
- if (fs.existsSync(filename)) {
1218
- const data = fs.readFileSync(filename);
1219
- try {
1220
- const lines = data.toString().split("\n");
1221
- let seperatorIndex;
1222
-
1223
- for (const i in lines) {
1224
- if (lines[i].indexOf("filemode.") === 0) {
1225
- seperatorIndex = lines[i].indexOf("=");
1226
- const fileList = lines[i].slice(seperatorIndex + 1).trim(),
1227
- fileArray = fileList.split(",");
1228
- this.fileMode = lines[i].slice(9, seperatorIndex).trim();
1229
-
1230
- fileArray.forEach(_checkFileMode);
1231
- }
1232
- }
1233
- setImmediate(next);
1234
- } catch (error) {
1235
- setImmediate(next, error);
1236
- }
1237
- } else {
1238
- setImmediate(next);
1239
- }
1240
- }, function(err) {
1241
- // Exclude package.propeties from ipk file
1242
- self.excludeFiles = self.excludeFiles.concat([
1243
- "package.properties"
1244
- ]);
1245
- setImmediate(next, err);
1246
- });
1247
- }
1248
-
1249
- function outputPackage(destination, next) {
1250
- log.info("package#outputPackage()");
1251
-
1252
- // Check that the directories exist
1253
- if (fs.existsSync(destination)) {
1254
- const stats = fs.statSync(destination);
1255
- if (!stats.isDirectory()) {
1256
- return next(errHndl.getErrMsg("NOT_DIRTYPE_PATH", destination));
1257
- }
1258
- } else {
1259
- log.verbose("setOutputDir()", "creating directory '" + destination + "' ...");
1260
- mkdirp.sync(destination);
1261
- }
1262
- destination = fs.realpathSync(destination);
1263
-
1264
- if (this.rom) {
1265
- copySrcToDst.call(this, path.join(this.tempDir, 'data'), destination, next);
1266
- } else {
1267
- const tempDir = this.tempDir,
1268
- tempCtrlDir = path.join(tempDir, 'ctrl'),
1269
- ctrlTgzFile = path.join(tempDir, 'control.tar.gz'),
1270
- tempDataDir = path.join(tempDir, 'data'),
1271
- dataTgzFile = path.join(tempDir, 'data.tar.gz');
1272
-
1273
- async.series([
1274
- decidePkgName.bind(this, this.pkgId, this.pkgVersion),
1275
- getFileSize.bind(this, tempDataDir),
1276
- makeTgz.bind(this, tempDataDir, dataTgzFile),
1277
- createDir.bind(this, tempCtrlDir),
1278
- createControlFile.bind(this, tempCtrlDir, false),
1279
- createSign.bind(this, tempCtrlDir, dataTgzFile),
1280
- makeTgz.bind(this, tempCtrlDir, ctrlTgzFile),
1281
- createDebianBinary.bind(this, tempDir),
1282
- setIpkFileName.bind(this),
1283
- removeExistingIpk.bind(this, destination),
1284
- makeIpk.bind(this, tempDir)
1285
- ], function(err) {
1286
- if (err) {
1287
- setImmediate(next, err);
1288
- return;
1289
- }
1290
- setImmediate(next);
1291
- });
1292
- }
1293
- }
1294
-
1295
- function decidePkgName(pkgName, pkgVersion, next) {
1296
- if (this.appCount !== 0) {
1297
- this.pkg = {
1298
- name: pkgName || this.appinfo.id,
1299
- version: pkgVersion || this.appinfo.version
1300
- };
1301
- } else if (this.services.length > 0) {
1302
- this.pkg = {
1303
- name: pkgName || this.services[0].serviceInfo.id || this.services[0].serviceInfo.services[0].name,
1304
- version: pkgVersion || "1.0.0"
1305
- };
1306
- } else {
1307
- this.pkg = {
1308
- name: pkgName || "unknown",
1309
- version: pkgVersion || "1.0.0"
1310
- };
1311
- }
1312
- setImmediate(next);
1313
- }
1314
-
1315
- function getFileSize(srcDir, next) {
1316
- const self = this;
1317
-
1318
- async.waterfall([
1319
- _readSizeRecursive.bind(this, srcDir)
1320
- ], function(err, size) {
1321
- if (!err && size) {
1322
- log.verbose("package#getFileSize()", "Installed-Size:", size);
1323
- self.size = size;
1324
- }
1325
- setImmediate(next, err);
1326
- });
1327
-
1328
- function _readSizeRecursive(item, next) {
1329
- fs.lstat(item, function(err, stats) {
1330
- let total = stats.size;
1331
-
1332
- if (!err && stats.isDirectory()) {
1333
- fs.readdir(item, function(error, list) {
1334
- if (error) {
1335
- return next(error);
1336
- }
1337
-
1338
- async.forEach(list, function(diritem, callback) {
1339
- _readSizeRecursive(path.join(item, diritem), function(_err, size) {
1340
- total += size;
1341
- callback(_err);
1342
- });
1343
- }, function(e) {
1344
- next(e, total);
1345
- }
1346
- );
1347
- });
1348
- } else {
1349
- next(err, total);
1350
- }
1351
- });
1352
- }
1353
- }
1354
-
1355
- function createDir(dstPath, next) {
1356
- log.verbose("package#createDir()", "createDir:" + dstPath);
1357
- mkdirp(dstPath, next);
1358
- }
1359
-
1360
- function createControlFile(dstDir, encInfo, next) {
1361
- const dstFilePath = path.join(dstDir, 'control');
1362
- log.verbose("package#createControlFile()", "createControlFile:" + dstFilePath);
1363
-
1364
- const lines = [
1365
- "Package: " + this.pkg.name,
1366
- "Version: " + this.pkg.version,
1367
- "Section: misc",
1368
- "Priority: optional",
1369
- "Architecture: " + (this.architecture || "all"),
1370
- "Installed-Size: " + (this.size || 1234), // TODO: TBC
1371
- "Maintainer: N/A <nobody@example.com>", // TODO: TBC
1372
- "Description: This is a webOS application.",
1373
- "webOS-Package-Format-Version: 2", // TODO: TBC
1374
- "webOS-Packager-Version: x.y.x" // TODO: TBC
1375
- ];
1376
-
1377
- if (encInfo) {
1378
- lines.push("Encrypt-Algorithm: AES-256-CBC");
1379
- }
1380
- lines.push(''); // for the trailing \n
1381
- fs.writeFile(dstFilePath, lines.join("\n"), next);
1382
- }
1383
-
1384
- function createSign(dstDir, dataTgzPath, next) {
1385
- if ((!this.sign) || (!this.certificate)) {
1386
- log.verbose("package#createSign()", "App signing is skipped");
1387
- return setImmediate(next);
1388
- }
1389
-
1390
- const sigFilePath = path.join(dstDir, 'data.tar.gz.sha256.txt'),
1391
- keyPath = path.resolve(this.sign),
1392
- crtPath = path.resolve(this.certificate);
1393
-
1394
- log.verbose("package#createSign()", "dataTgzPath:" + dataTgzPath + ", sigfile:" + sigFilePath);
1395
- log.verbose("package#createSign()", "keyPath:" + keyPath + ", crtPath:" + crtPath);
1396
-
1397
- try {
1398
- // Create certificate to tmp/ctrl directory
1399
- shelljs.cp('-f', crtPath, dstDir);
1400
-
1401
- // Create signature and write data.tar.gz.sha256.txt
1402
- const privateKey = fs.readFileSync(keyPath, 'utf-8'),
1403
- dataFile = fs.readFileSync(dataTgzPath), // data.tar.gz
1404
- signer = crypto.createSign('sha256');
1405
-
1406
- signer.update(dataFile);
1407
- signer.end();
1408
-
1409
- const signature = signer.sign(privateKey),
1410
- buff = Buffer.from(signature),
1411
- base64data = buff.toString('base64');
1412
-
1413
- fs.writeFile(sigFilePath, base64data, next);
1414
- } catch (err) {
1415
- setImmediate(next, err);
1416
- }
1417
- }
1418
-
1419
- function createDebianBinary(dstDir, next) {
1420
- const dstFilePath = path.join(dstDir, "debian-binary");
1421
- log.verbose("package#createDebianBinary()", dstFilePath);
1422
- fs.writeFile(dstFilePath, "2.0\n", next);
1423
- }
1424
-
1425
- function makeTgz(srcDir, dstDir, next) {
1426
- log.verbose("package#makeTgz()", "makeTgz " + dstDir + " from " + srcDir);
1427
- const pkgServiceNames = this.pkgServiceNames;
1428
- // @see https://github.com/isaacs/node-tar/issues/7
1429
- // it is a workaround for packaged ipk on windows can set +x into directory
1430
- const fixupDirs = function (filePath, entry) {
1431
- const fileOrFolderName = filePath.split("/").pop();
1432
- // opkg does not support Posix Tar fully
1433
- if (fileOrFolderName.length !== Buffer.byteLength(fileOrFolderName)) {
1434
- const errMsg = "Please use the file name in english letters. \n\t\t (" + filePath + ")",
1435
- em = new (require('events').EventEmitter)();
1436
- em.emit('error', new Error(errMsg));
1437
- }
1438
- // Make sure readable directories have execute permission
1439
- if (entry.isDirectory()) {
1440
- let maskingBits = 201; // 0311
1441
- // special case for service directory should have writable permission.
1442
- if (pkgServiceNames.indexOf(fileOrFolderName) !== -1) {
1443
- maskingBits = 219; // 0333
1444
- }
1445
- entry.mode |= (entry.mode >>> 2) & maskingBits;
1446
- } else if (entry.isFile()) {
1447
- // Add other user's readable permission to all files
1448
- entry.mode |= 4; // 04
1449
- }
1450
- if (entry.uid > 0o7777777) {
1451
- entry.uid = 0;
1452
- }
1453
-
1454
- if (entry.gid > 0o7777777) {
1455
- entry.gid = 0;
1456
- }
1457
-
1458
- return true;
1459
- };
1460
-
1461
- fs.readdir(srcDir, function (err, fileList) {
1462
- if (err) setImmediate(next, err);
1463
- else {
1464
- tar.c({
1465
- file: dstDir,
1466
- gzip: true,
1467
- cwd: srcDir,
1468
- filter: fixupDirs
1469
- }, fileList)
1470
- .then(() => setImmediate(next))
1471
- .catch(error => setImmediate(next, error));
1472
- }
1473
- });
1474
- }
1475
-
1476
- function setIpkFileName(next) {
1477
- let filename = this.pkg.name;
1478
- if (this.pkg.version) {
1479
- // This is asked to replace 'x86' from 'i586' as a file suffix (From NDK)
1480
- const archSuffix = ('i586' === this.architecture) ? 'x86' : (this.architecture || 'all');
1481
- filename = filename.concat("_" + this.pkg.version + "_" + archSuffix + ".ipk");
1482
- } else {
1483
- filename = filename.concat(".ipk");
1484
- }
1485
- this.ipkFileName = filename;
1486
- setImmediate(next);
1487
- }
1488
-
1489
- function removeExistingIpk(destination, next) {
1490
- if (this.appCount === 0) {
1491
- return setImmediate(next);
1492
- }
1493
-
1494
- const filename = path.join(destination, this.ipkFileName);
1495
- fs.exists(filename, function(exists) {
1496
- if (exists) {
1497
- fs.unlink(filename, next);
1498
- } else {
1499
- setImmediate(next); // Nothing to do
1500
- }
1501
- });
1502
- }
1503
-
1504
- function padSpace(input, length) {
1505
- // max field length in ar is 16
1506
- const ret = String(input + ' ');
1507
- return ret.slice(0, length);
1508
- }
1509
-
1510
- function arFileHeader(name, size) {
1511
- const epoch = Math.floor(Date.now() / 1000) ;
1512
- return padSpace(name, 16) +
1513
- padSpace(epoch, 12) +
1514
- "0 " + // UID, 6 bytes
1515
- "0 " + // GID, 6 bytes
1516
- "100644 " + // file mode, 8 bytes
1517
- padSpace(size, 10) +
1518
- "\x60\x0A"; // don't ask
1519
- }
1520
-
1521
- function makeIpk(srcDir, next) {
1522
- this.IpkDir = srcDir;
1523
- this.ipk = path.join(srcDir, this.ipkFileName);
1524
- log.info("package#makeIpk()", "makeIpk in dir " + this.IpkDir + " file " + this.ipkFileName);
1525
-
1526
- if (this.nativecmd) { // TODO: TBR
1527
- shelljs.cd(this.IpkDir);
1528
- shelljs.exec("ar -q " + this.ipk + " debian-binary control.tar.gz data.tar.gz", {silent: this.silent});
1529
-
1530
- setImmediate(next);
1531
- return;
1532
- }
1533
-
1534
- // global header, see http://en.wikipedia.org/wiki/Ar_%28Unix%29
1535
- const header = "!<arch>\n",
1536
- debBinary = arFileHeader("debian-binary",4) + "2.0\n",
1537
- that = this,
1538
- arStream = CombinedStream.create(),
1539
- pkgFiles = [ 'control.tar.gz', 'data.tar.gz' ],
1540
- ipkStream = fstream.Writer(this.ipk);
1541
-
1542
- arStream.append(header + debBinary);
1543
- pkgFiles.forEach(function(f) {
1544
- const fpath = path.join(that.IpkDir, f),
1545
- s = fstream.Reader({ path: fpath, type: 'File'}),
1546
- stat = fs.statSync(fpath); // TODO: move to asynchronous processing
1547
-
1548
- arStream.append(arFileHeader(f, stat.size));
1549
- arStream.append(s);
1550
- if ((stat.size % 2) !== 0) {
1551
- log.verbose("package#makeIpk()", 'adding a filler for file ' + f);
1552
- arStream.append('\n');
1553
- }
1554
- }, this);
1555
-
1556
- arStream.pipe(ipkStream);
1557
- ipkStream.on('close', function() {
1558
- setImmediate(next);
1559
- });
1560
- ipkStream.on('error', next);
1561
- }
1562
-
1563
- function cleanupTmpDir(middleCb, next) {
1564
- if (this.noclean) {
1565
- middleCb("Skipping removal of " + this.tempDir);
1566
- setImmediate(next);
1567
- } else {
1568
- rimraf(this.tempDir, function(err) {
1569
- log.verbose("package#cleanupTmpDir()", "removed " + this.tempDir);
1570
- setImmediate(next, err);
1571
- }.bind(this));
1572
- }
1573
- }
1574
-
1575
- function checkDirectory(options, directory, callback) {
1576
- log.verbose("package#checkDirectory()", directory);
1577
- if (fs.existsSync(directory)) { // TODO: move to asynchronous processing
1578
- const stat = fs.statSync(directory);
1579
- if (!stat.isDirectory()) {
1580
- callback(errHndl.getErrMsg("NOT_DIRTYPE_PATH", directory));
1581
- return;
1582
- }
1583
- directory = fs.realpathSync(directory);
1584
- } else {
1585
- callback(errHndl.getErrMsg("NOT_EXIST_PATH", directory));
1586
- return;
1587
- }
1588
-
1589
- if (options.force) {
1590
- return callback();
1591
- }
1592
-
1593
- if (fs.existsSync(path.join(directory, "packageinfo.json"))) {
1594
- return callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_PKGDIR"));
1595
- }
1596
-
1597
- if (fs.existsSync(path.join(directory, "appinfo.json"))) {// TODO: move to asynchronous processing
1598
- this.appCount++;
1599
- log.verbose("package#checkDirectory()", "FOUND appinfo.json, appCount " + this.appCount);
1600
-
1601
- if (this.appCount > 1) {
1602
- callback(errHndl.getErrMsg("OVER_APPCOUNT"));
1603
- } else if (this.rscCount > 0) {
1604
- callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_RESOURCE"));
1605
- } else {
1606
- this.appDir = directory;
1607
- this.originAppDir = directory;
1608
- if (fs.existsSync(path.join(directory, "package.js"))) {
1609
- this.pkgJSExist = true;
1610
- }
1611
- callback();
1612
- }
1613
- } else if (fs.existsSync(path.join(directory, "services.json"))) {
1614
- if (this.rscCount > 0) {
1615
- callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_RESOURCE"));
1616
- }
1617
- this.svcDir = this.svcDir || [];
1618
- this.svcDir = this.svcDir.concat(directory);
1619
- callback();
1620
- } else if (fs.existsSync(path.join(directory, "resourceinfo.json"))) {
1621
- this.rscCount++;
1622
- log.verbose("FOUND resourceinfo.json, rscCount " + this.rscCount);
1623
- if (this.appCount > 0 || this.svcDir && this.svcDir.length > 0) {
1624
- return callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_RESOURCE"));
1625
- }
1626
- this.resources = this.resources || [];
1627
- const rsc = {};
1628
- rsc.dir = directory;
1629
- this.resources = this.resources.concat(rsc);
1630
- callback();
1631
- } else if (fs.existsSync(path.join(directory, "account-templates.json"))) {
1632
- callback(errHndl.getErrMsg("NO_ACCOUNT"));
1633
- } else {
1634
- // find service directory recursively
1635
- const foundSvcDirs = [];
1636
- this.svcDir = this.svcDir || [];
1637
- this.svcDir = this.svcDir.concat(directory);
1638
-
1639
- findServiceDir.call(this, foundSvcDirs, function() {
1640
- if (foundSvcDirs.length > 0) {
1641
- if (this.rscCount > 0) {
1642
- callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_RESOURCE"));
1643
- }
1644
- callback();
1645
- } else {
1646
- callback(errHndl.getErrMsg("NO_METAFILE", "APP_DIR/SVC_DIR", directory));
1647
- }
1648
- });
1649
- }
1650
- }
1651
-
1652
- // find service directories checking if directory has services.json file
1653
- function findServiceDir(services, next) {
1654
- const checkDirs = [].concat(this.svcDir || this.originAppDir || []),
1655
- foundFilePath = [];
1656
- if (checkDirs.length === 0) {
1657
- return setImmediate(next);
1658
- }
1659
-
1660
- async.forEach(checkDirs, function(checkDir, next) {
1661
- walkFolder(checkDir, "services.json", foundFilePath, 3, function(err) {
1662
- if (err) {
1663
- return setImmediate(next, err);
1664
- }
1665
-
1666
- foundFilePath.forEach(function(filePath) {
1667
- const svc = new Service();
1668
- svc.srcDir = path.dirname(filePath);
1669
- svc.dirName = path.basename(svc.srcDir);
1670
- services.push(svc);
1671
- });
1672
- foundFilePath.pop();
1673
- setImmediate(next, err);
1674
- });
1675
- }, function(err) {
1676
- setImmediate(next, err);
1677
- });
1678
- }
1679
-
1680
- function walkFolder(dirPath, findFileName, foundFilePath, depth, next) {
1681
- if (depth <= 0) {
1682
- return next();
1683
- }
1684
- async.waterfall([
1685
- fs.readdir.bind(null, dirPath),
1686
- function(fileNames, next) {
1687
- async.forEach(fileNames, function(fileName, next) {
1688
- const filePath = path.join(dirPath, fileName);
1689
- async.waterfall([
1690
- fs.lstat.bind(null, filePath),
1691
- function(stat, next) {
1692
- if (stat.isFile()) {
1693
- if (fileName === findFileName) {
1694
- foundFilePath.push(filePath);
1695
- }
1696
- next();
1697
- } else if (stat.isDirectory()) {
1698
- walkFolder(filePath, findFileName, foundFilePath, (depth-1), next);
1699
- } else {
1700
- next();
1701
- }
1702
- }
1703
- ], next); // async.waterfall
1704
- }, next); // async.forEach
1705
- }
1706
- ], function(err) {
1707
- next(err);
1708
- }); // async.waterfall
1709
- }
1710
-
1711
- // read services.json recursivly
1712
- function loadServiceInfo(next) {
1713
- for (const idx in this.services) {
1714
- const filename = path.join(this.services[idx].srcDir, "services.json");
1715
- try {
1716
- const data = fs.readFileSync(filename),
1717
- info = JSON.parse(data);
1718
- if (!(Object.prototype.hasOwnProperty.call(info, 'id') &&
1719
- Object.prototype.hasOwnProperty.call(info, 'services'))) {
1720
- continue;
1721
- }
1722
- this.services[idx].serviceInfo = info;
1723
- this.services[idx].valid = true;
1724
- } catch (err) {
1725
- return setImmediate(next, err);
1726
- }
1727
- }
1728
- log.info("package#loadServiceInfo()", "num of serviceInfo: " + this.services.length);
1729
- setImmediate(next);
1730
- }
1731
-
1732
- // check services.json recursivly
1733
- function checkServiceInfo(next) {
1734
- const pkgId = this.pkgId || this.appinfo.id,
1735
- svcIds = [];
1736
- let errFlag = false;
1737
-
1738
- this.services.forEach(function(service) {
1739
- if (service.valid === false) {
1740
- return;
1741
- }
1742
-
1743
- svcIds.push(getPkgServiceNames(service.serviceInfo)[0]);
1744
- });
1745
-
1746
- svcIds.forEach(function(svcId) {
1747
- if (svcId.indexOf(pkgId + ".") !== 0) {
1748
- errFlag = true;
1749
- }
1750
- });
1751
-
1752
- if (errFlag) {
1753
- return setImmediate(next, errHndl.getErrMsg("INVALID_SERVICEID", pkgId));
1754
- }
1755
- setImmediate(next);
1756
- }
1757
-
1758
- // create dir with each service's name under (tmp) + data/usr/palm/services/
1759
- function createServiceDir(next) {
1760
- this.services.forEach(function(service) {
1761
- if (service.valid === false) {
1762
- return;
1763
- }
1764
-
1765
- getPkgServiceNames(service.serviceInfo).forEach(function(serviceName) {
1766
- const serviceDir = path.join(this.tempDir, "data/usr/palm/services", serviceName);
1767
- service.dstDirs.push(serviceDir);
1768
- try {
1769
- log.info("package#createServiceDir()", "service dir:" + serviceDir);
1770
- mkdirp.sync(serviceDir);
1771
- } catch (err) {
1772
- return setImmediate(next, err);
1773
- }
1774
- }.bind(this));
1775
- }.bind(this));
1776
- setImmediate(next);
1777
- }
1778
-
1779
- // copy service files into each serviceInfos[x].id directory.
1780
- function copyService(next) {
1781
- log.info("package#copyService()");
1782
- const self = this,
1783
- validServices = this.services.filter(function(service) {
1784
- return service.valid;
1785
- });
1786
- try {
1787
- async.forEachSeries(validServices, function(service, next) {
1788
- async.forEach(service.dstDirs, function(dstDir, next) {
1789
- self.dataCopyCount++;
1790
- self.minifyDone = !self.minify;
1791
- copySrcToDst.call(self, service.srcDir, dstDir, next);
1792
- }, next);
1793
- }, next);
1794
- } catch (err) {
1795
- setImmediate(next, err);
1796
- }
1797
- }
1798
-
1799
- // add service info into packageinfo.json.
1800
- function addServiceInPkgInfo(next) {
1801
- if (!this.rom) {
1802
- const filename = path.join(this.packageDir, "packageinfo.json");
1803
- let pkginfo, validServiceCount;
1804
- try {
1805
- const data = fs.readFileSync(filename);
1806
- validServiceCount = 0;
1807
- pkginfo = JSON.parse(data);
1808
- log.silly("package#addServiceInPkgInfo()", "PACKAGEINFO:", pkginfo);
1809
- } catch (err) {
1810
- console.error(err);
1811
- setImmediate(next, err);
1812
- }
1813
- this.services.filter(function(s) {
1814
- return s.valid;
1815
- }).forEach(function(service) {
1816
- getPkgServiceNames(service.serviceInfo).forEach(function(serviceName) {
1817
- this.pkgServiceNames.push(serviceName);
1818
- validServiceCount++;
1819
- }.bind(this));
1820
- }.bind(this));
1821
-
1822
- if (validServiceCount > 0) {
1823
- pkginfo.services = this.pkgServiceNames;
1824
- const data = JSON.stringify(pkginfo, null, 2) + "\n";
1825
- log.silly("package#addServiceInPkgInfo()", "Modified package.json:" + data);
1826
- fs.writeFile(path.join(this.packageDir, "packageinfo.json"), data, next);
1827
- } else {
1828
- setImmediate(next);
1829
- }
1830
- } else {
1831
- setImmediate(next);
1832
- }
1833
- }
1834
-
1835
- // remove service dir from tmp source dir before packaging
1836
- function removeServiceFromAppDir(middleCb, next) {
1837
- if (this.appCount === 0) {
1838
- return setImmediate(next);
1839
- }
1840
-
1841
- let checkDir = this.applicationDir,
1842
- needRmCheckDir = false;
1843
- const fileList = fs.readdirSync(checkDir);
1844
-
1845
- function _checkDir(dir) {
1846
- if (this.dirName === dir) {
1847
- try {
1848
- const rmDir = path.join(this.applicationDir, this.dirName);
1849
- shelljs.rm('-rf', rmDir);
1850
- } catch (err) {
1851
- next(Error("ERROR" + err), null);
1852
- }
1853
- }
1854
- }
1855
-
1856
- if (fileList.indexOf('services') !== -1) {
1857
- checkDir = path.join(this.applicationDir, 'services');
1858
- const stats = fs.statSync(checkDir);
1859
- if (stats.isDirectory()) {
1860
- needRmCheckDir = true;
1861
- }
1862
- }
1863
- if (needRmCheckDir === true) {
1864
- try {
1865
- shelljs.rm('-rf', checkDir);
1866
- } catch (err) {
1867
- middleCb("ERROR:" + err);
1868
- }
1869
- } else {
1870
- for (const idx in this.services) {
1871
- this.dirName = this.services[idx].dirName;
1872
- fileList.forEach(_checkDir, this);
1873
- }
1874
- }
1875
- setImmediate(next);
1876
- }
1877
-
1878
- function loadResourceInfo(next) {
1879
- log.verbose("loadResourceInfo");
1880
- if (this.rscCount === 0) {
1881
- return setImmediate(next);
1882
- }
1883
-
1884
- this.resources.forEach(function(resource) {
1885
- const filePath = path.join(resource.dir, "resourceinfo.json");
1886
- try {
1887
- const data = fs.readFileSync(filePath),
1888
- info = JSON.parse(data);
1889
- resource.info = info;
1890
- } catch (err) {
1891
- return setImmediate(next, errHndl.getErrMsg("INVALID_JSON_FORMAT", "resourceinfo.json"));
1892
- }
1893
- });
1894
- log.verbose("num of resourceInfo: " + this.resources.length);
1895
- setImmediate(next);
1896
- }
1897
-
1898
- function checkResourceInfo(next) {
1899
- log.verbose("checkResourceInfo");
1900
- const pkgId = this.pkgId;
1901
-
1902
- this.resources.forEach(function(resource) {
1903
- if (!resource.info.id) {
1904
- return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "id"));
1905
- } else if (resource.info.id.indexOf(pkgId) !== 0) {
1906
- return setImmediate(next, errHndl.getErrMsg("INVALID_RESOURCEID", pkgId));
1907
- } else if (resource.info.id.length < 1 || !(/^[a-z0-9.+-]*$/.test(resource.info.id))) {
1908
- log.error(errHndl.getErrMsg("INVALID_VALUE", "id", resource.info.id));
1909
- return setImmediate(next, errHndl.getErrMsg("INVALID_ID_RULE"));
1910
- }
1911
- });
1912
- setImmediate(next);
1913
- }
1914
-
1915
- function createResourceDir(next) {
1916
- log.verbose("createResourceDir");
1917
- this.resources.forEach(function(resource) {
1918
- try {
1919
- const resourceDir = path.join(this.tempDir, "data/usr/palm/resources", resource.info.id);
1920
- log.verbose("resource dir = " + resourceDir);
1921
- resource.dstDir = resourceDir;
1922
- mkdirp.sync(resourceDir);
1923
- } catch (err) {
1924
- return setImmediate(next, err);
1925
- }
1926
- }.bind(this));
1927
- log.silly("this.resources:", this.resources);
1928
- setImmediate(next);
1929
- }
1930
-
1931
- function copyResource(next) {
1932
- log.verbose("copyResource()");
1933
- if (this.rscCount === 0) {
1934
- return setImmediate(next);
1935
- }
1936
-
1937
- const self = this;
1938
- try {
1939
- async.forEachSeries(this.resources, function(resource, next) {
1940
- self.dataCopyCount++;
1941
- log.verbose("copyResource(), copy " + resource.dir + " ==> " + resource.dstDir);
1942
- copySrcToDst.call(self, resource.dir, resource.dstDir, next);
1943
- }, next);
1944
- } catch (err) {
1945
- setImmediate(next, err);
1946
- }
1947
- }
1948
-
1949
- function addResourceInPkgInfo(next) {
1950
- log.verbose("addResourceInPkgInfo");
1951
- if (!this.rom && this.rscCount > 0) {
1952
- const filename = path.join(this.packageDir, "packageinfo.json");
1953
- let pkginfo, data;
1954
- try {
1955
- data = fs.readFileSync(filename);
1956
- log.verbose("PACKAGEINFO: " + data);
1957
- pkginfo = JSON.parse(data);
1958
- } catch (err) {
1959
- console.error(err);
1960
- setImmediate(next, err);
1961
- }
1962
-
1963
- this.resources.forEach(function(resource) {
1964
- this.pkgResourceNames.push(resource.info.id);
1965
- }.bind(this));
1966
-
1967
- pkginfo.resources = this.pkgResourceNames;
1968
- data = JSON.stringify(pkginfo, null, 2) + "\n";
1969
- log.verbose("Modified package.json: " + data);
1970
- fs.writeFile(path.join(this.packageDir, "packageinfo.json"), data, next);
1971
- } else {
1972
- setImmediate(next);
1973
- }
1974
- }
1975
-
1976
- function copyData(inDirs, forceCopy, next) {
1977
- log.verbose("package#copyData()", "only run when force packaging");
1978
- if (forceCopy && this.dataCopyCount === 0) {
1979
- const dst = path.join(this.tempDir, "data");
1980
- async.forEachSeries(inDirs, function(src, next) {
1981
- copySrcToDst.call(this, src, dst, next);
1982
- }, function(err) {
1983
- setImmediate(next, err);
1984
- });
1985
- } else {
1986
- return setImmediate(next);
1987
- }
1988
- }
1989
-
1990
- function getPkgServiceNames(serviceInfo) {
1991
- let serviceNames = [];
1992
- if (servicePkgMethod === "id") {
1993
- serviceNames = [serviceInfo.id];
1994
- } else if (serviceInfo.services) {
1995
- const serviceProps = (serviceInfo.services instanceof Array)
1996
- ? serviceInfo.services : [serviceInfo.services];
1997
- serviceNames = serviceProps.map(function(serviceProp) {
1998
- return serviceProp.name;
1999
- });
2000
- }
2001
- return serviceNames;
2002
- }
2003
-
2004
- function setUmask(mask, next) {
2005
- this.oldmask = process.umask(mask);
2006
- setImmediate(next);
2007
- }
2008
-
2009
- function recoverUmask(next) {
2010
- if (this.oldmask) {
2011
- process.umask(this.oldmask);
2012
- }
2013
- setImmediate(next);
2014
- }
2015
-
2016
- function rewriteFileWoBOMAsUtf8(filePath, rewriteFlag, next) {
2017
- let data = fs.readFileSync(filePath);
2018
- const encodingFormat = chardet.detect(Buffer.from(data));
2019
-
2020
- if (['UTF-8', 'ISO-8895-1'].indexOf(encodingFormat) === -1) {
2021
- log.silly("package#rewriteFileWoBOMAsUtf8()", "current encoding type:" + encodingFormat);
2022
- data = encoding.convert(data, "UTF-8", encodingFormat);
2023
- }
2024
- data = stripbom(data);
2025
-
2026
- if (rewriteFlag) {
2027
- fs.writeFileSync(filePath,
2028
- data, { encoding: "utf8" }
2029
- );
2030
- }
2031
-
2032
- if (next !== 'undefined' && typeof next === 'function') {
2033
- setImmediate(next, null, data);
2034
- }
2035
- return data;
2036
- }
2037
-
2038
- function encryptPackage(next) {
2039
- if (this.rom || !this.encrypt) { // Do not encrypt when -rom option is given
2040
- setImmediate(next);
2041
- return;
2042
- } else {
2043
- this.encryptDir = path.join(this.tempDir, "encrypt");
2044
- const encryptDir = this.encryptDir,
2045
- encryptCtrlDir = path.join(encryptDir, 'ctrl'),
2046
- ctrlTgzFile = path.join(encryptDir, 'control.tar.gz'),
2047
- encryptDataDir = path.join(encryptDir, 'data'),
2048
- dataTgzFile = path.join(encryptDir, 'data.tar.gz');
2049
-
2050
- async.series([
2051
- createDir.bind(this, encryptDir),
2052
- createDir.bind(this, encryptCtrlDir),
2053
- createDir.bind(this, encryptDataDir),
2054
- createkeyIVfile.bind(this, encryptCtrlDir),
2055
- encryptIpk.bind(this, encryptDataDir),
2056
- makeTgz.bind(this, encryptDataDir, dataTgzFile),
2057
- createControlFile.bind(this, encryptCtrlDir, true),
2058
- makeTgz.bind(this, encryptCtrlDir, ctrlTgzFile),
2059
- createDebianBinary.bind(this, encryptDir),
2060
- makeIpk.bind(this, encryptDir)
2061
- ], function(err) {
2062
- if (err) {
2063
- setImmediate(next, err);
2064
- return;
2065
- }
2066
- log.verbose("package#encryptPackage()", "success to encrypt pacakge");
2067
- setImmediate(next);
2068
- });
2069
- }
2070
- }
2071
-
2072
- function createkeyIVfile(dstPath, next) {
2073
- // generate random key& IV
2074
- this.key = Buffer.from(crypto.randomBytes(32), 'base64');
2075
- this.iv = Buffer.from(crypto.randomBytes(16), 'base64');
2076
-
2077
- try {
2078
- // Read public key
2079
- const publickeyPath = path.join(__dirname, '../', 'files', 'conf', 'pubkey.pem'),
2080
- publickey = fs.readFileSync(publickeyPath, 'utf8');
2081
-
2082
- // Encrypt key, iv by publickey
2083
- const encryptedKey= crypto.publicEncrypt({
2084
- key: publickey,
2085
- padding: 4 /* crypto.constants.RSA_PKCS1_OAEP_PADDING */
2086
- }, Buffer.from(this.key.toString('base64')));
2087
-
2088
- const encryptedIV= crypto.publicEncrypt({
2089
- key: publickey,
2090
- padding: 4 /* crypto.constants.RSA_PKCS1_OAEP_PADDING */
2091
- }, Buffer.from(this.iv.toString('base64')));
2092
-
2093
- const keyFilePath = path.join(dstPath, "key");
2094
- fs.writeFileSync(keyFilePath, encryptedKey, 'binary');
2095
-
2096
- // write iv file on encrypt/control
2097
- const ivFilePath = path.join(dstPath , "iv");
2098
- fs.writeFileSync(ivFilePath, encryptedIV, 'binary');
2099
-
2100
- } catch (err) {
2101
- return setImmediate(next, errHndl.getErrMsg(err));
2102
- }
2103
- setImmediate(next);
2104
- }
2105
-
2106
- function copyOutputToDst(destination, middleCb, next) {
2107
- // copy data directory to destination
2108
- if (this.rom) {
2109
- middleCb("Create output directory to " + destination);
2110
- copySrcToDst.call(this, path.join(this.tempDir, 'data'), destination, next);
2111
- } else if (this.encrypt) {
2112
- // copy encrypted ipk to destination
2113
- middleCb("Create encrypted " + this.ipkFileName + " to " + destination);
2114
- copySrcToDst.call(this, path.join(this.encryptDir, this.ipkFileName), destination, next);
2115
- } else {
2116
- // copy plain ipk to destination
2117
- let outmsg = "Create ";
2118
- if (this.sign && this.certificate) {
2119
- outmsg = outmsg.concat("signed ");
2120
- }
2121
- middleCb(outmsg + this.ipkFileName + " to " + destination);
2122
- copySrcToDst.call(this, path.join(this.tempDir, this.ipkFileName), destination, next);
2123
- }
2124
- }
2125
-
2126
- function encryptIpk(dstPath, next) {
2127
- log.verbose("package#encryptPackage()#encrypIpk()", "encrypt plain ipk to /encrypt/data");
2128
- const plainIpkPath = path.join(this.tempDir, this.ipkFileName),
2129
- encrypedIpkPath = path.join(dstPath, this.ipkFileName);
2130
-
2131
- try {
2132
- const input = fs.createReadStream(plainIpkPath),
2133
- output = fs.createWriteStream(encrypedIpkPath),
2134
- cipher = crypto.createCipheriv('aes-256-cbc', this.key, this.iv);
2135
-
2136
- output.on('close', function() {
2137
- log.verbose("package#encryptPackage()#encrypIpk()", "encrypted Ipk to " + encrypedIpkPath);
2138
- setImmediate(next);
2139
- }).
2140
- on('error', function(err) {
2141
- setImmediate(next, err);
2142
- });
2143
-
2144
- input.pipe(cipher).pipe(output);
2145
- } catch (err) {
2146
- setImmediate(next, err);
2147
- }
2148
- }
2149
- }());
1
+ /*
2
+ * Copyright (c) 2020-2024 LG Electronics Inc.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ const ar = require('ar-async'),
8
+ async = require('async'),
9
+ chardet = require('chardet'),
10
+ CombinedStream = require('combined-stream'),
11
+ crypto = require('crypto'),
12
+ decompress = require('decompress'),
13
+ decompressTargz = require('decompress-targz'),
14
+ ElfParser = require('elfy').Parser,
15
+ encoding = require('encoding'),
16
+ fs = require('fs'),
17
+ fstream = require('fstream'),
18
+ Validator = require('jsonschema').Validator,
19
+ mkdirp = require('mkdirp'),
20
+ log = require('npmlog'),
21
+ path = require('path'),
22
+ rimraf = require('rimraf'),
23
+ shelljs = require('shelljs'),
24
+ stripbom = require('strip-bom'),
25
+ temp = require('temp'),
26
+ uglify = require('terser'),
27
+ util = require('util'),
28
+ errHndl = require('./base/error-handler'),
29
+ tar = require('tar');
30
+
31
+ (function() {
32
+ log.heading = 'packager';
33
+ log.level = 'warn';
34
+
35
+ const servicePkgMethod = 'id',
36
+ defaultAssetsFields = {
37
+ "main": true,
38
+ "icon": true,
39
+ "largeIcon": true,
40
+ "bgImage": true,
41
+ "splashBackground": true,
42
+ "imageForRecents": true,
43
+ "sysAssetsBasePath": true
44
+ },
45
+ FILE_TYPE = {
46
+ file: 'file',
47
+ dir: 'dir',
48
+ symlink: 'symlink'
49
+ },
50
+ packager = {};
51
+ let objectCounter = 0;
52
+
53
+ if (typeof module !== 'undefined' && module.exports) {
54
+ module.exports = packager;
55
+ }
56
+
57
+ function Packager() {
58
+ this.objectId = objectCounter++;
59
+ this.verbose = false;
60
+ this.silent = true;
61
+ this.noclean = false;
62
+ this.nativecmd = false;
63
+ this.minify = true;
64
+ this.excludeFiles = [];
65
+ this.rom = false;
66
+ this.encrypt = false;
67
+ this.sign = null;
68
+ this.certificate = null;
69
+ this.appCount = 0;
70
+ this.services = [];
71
+ this.pkgServiceNames = [];
72
+ this.rscCount = 0;
73
+ this.resources = [];
74
+ this.pkgResourceNames = [];
75
+ this.pkgId;
76
+ this.pkginfofile;
77
+ this.remainPlainIPK = false;
78
+ // To check app signing
79
+ this.dataHash = '';
80
+ this.certificateHash = '';
81
+ this.controlSign = '';
82
+ }
83
+
84
+ packager.Packager = Packager;
85
+
86
+ Packager.prototype = {
87
+ prepareOptions: function(options, next) {
88
+ if (options && options.level) {
89
+ log.level = options.level;
90
+ if (['warn', 'error'].indexOf(options.level) !== -1) {
91
+ this.silent = false;
92
+ }
93
+ }
94
+
95
+ if (options && options.noclean === true) {
96
+ this.noclean = true;
97
+ }
98
+
99
+ if (options && options.nativecmd === true) {
100
+ this.nativecmd = true;
101
+ }
102
+
103
+ if (options && Object.prototype.hasOwnProperty.call(options, 'minify')) {
104
+ this.minify = options.minify;
105
+ }
106
+
107
+ if (options && Object.prototype.hasOwnProperty.call(options, 'excludefiles')) {
108
+ if (options.excludefiles instanceof Array) {
109
+ this.excludeFiles = options.excludefiles.map(filePath => {
110
+ if (filePath && filePath.length)
111
+ filePath = filePath.replace(/(^\\|^)/i, "\\").replaceAll(/\\/gi, "\\\\");
112
+ return filePath;
113
+ });
114
+ } else {
115
+ this.excludeFiles.push(options.excludefiles);
116
+ }
117
+
118
+ this.excludeFiles.forEach(function(excl_file) {
119
+ if (excl_file === "appinfo.json") {
120
+ return next(errHndl.getErrMsg("NOT_EXCLUDE_APPINFO"));
121
+ }
122
+ });
123
+ }
124
+
125
+ if (options && Object.prototype.hasOwnProperty.call(options, 'rom')) {
126
+ this.rom = options.rom;
127
+ }
128
+
129
+ if (options && Object.prototype.hasOwnProperty.call(options, 'encrypt')) {
130
+ this.encrypt = options.encrypt;
131
+ }
132
+
133
+ if (options && Object.prototype.hasOwnProperty.call(options, 'remainPlainIPK')) {
134
+ this.remainPlainIPK = options.remainPlainIPK;
135
+ }
136
+
137
+ if (options && Object.prototype.hasOwnProperty.call(options, 'sign')) {
138
+ if (!fs.existsSync(path.resolve(options.sign))) {
139
+ return next(errHndl.getErrMsg("NOT_EXIST_PATH", options.sign));
140
+ }
141
+ this.sign = options.sign;
142
+ }
143
+
144
+ if (options && Object.prototype.hasOwnProperty.call(options, 'certificate')) {
145
+ if (!fs.existsSync(path.resolve(options.certificate))) {
146
+ return next(errHndl.getErrMsg("NOT_EXIST_PATH", options.certificate));
147
+ }
148
+ this.certificate = options.certificate;
149
+ }
150
+
151
+ log.verbose("package#Packager()", "Packager id:" + this.objectId);
152
+
153
+ this.pkgVersion = options.pkgversion;
154
+
155
+ if (options && Object.prototype.hasOwnProperty.call(options, 'pkgid')) {
156
+ this.pkgId = options.pkgid;
157
+ }
158
+
159
+ if (options && Object.prototype.hasOwnProperty.call(options, 'pkginfofile')) {
160
+ this.pkginfofile = options.pkginfofile;
161
+ }
162
+
163
+ if (this.pkgId && this.pkginfofile) {
164
+ return next(errHndl.getErrMsg("NOT_USE_WITH_OPTIONS", "pkginfofile, pkgid"));
165
+ }
166
+ this.appCount = 0;
167
+ },
168
+ checkInputDirectories: function(inDirs, options, next) {
169
+ log.verbose("package#Packager#checkInputDirectories()", "input directory:", inDirs);
170
+ this.prepareOptions(options, next);
171
+
172
+ async.forEachSeries(inDirs, checkDirectory.bind(this, options), function(err) {
173
+ if (err) {
174
+ setImmediate(next, err);
175
+ return;
176
+ }
177
+ setImmediate(next);
178
+ });
179
+ return {app: this.appCount, resource: this.rscCount};
180
+ },
181
+ servicePackaging: function(inDirs, destination, options, middleCb, next) {
182
+ log.info("package#Packager#servicePackaging()");
183
+
184
+ if (!Object.hasOwnProperty.call(options, 'pkgid') && !Object.hasOwnProperty.call(options, 'pkginfofile')) {
185
+ return next(errHndl.getErrMsg("USE_PKGID_PKGINFO"));
186
+ }
187
+
188
+ async.series([
189
+ this.checkInputDirectories.bind(this, inDirs, options),
190
+ setUmask.bind(this, 0),
191
+ loadPkgInfo.bind(this),
192
+ createTmpDir.bind(this),
193
+ excludeIpkFileFromApp.bind(this),
194
+ createPackageDir.bind(this),
195
+ fillPackageDir.bind(this),
196
+ findServiceDir.bind(this, this.services),
197
+ loadServiceInfo.bind(this),
198
+ checkServiceInfo.bind(this),
199
+ createServiceDir.bind(this),
200
+ copyService.bind(this),
201
+ addServiceInPkgInfo.bind(this),
202
+ copyData.bind(this, inDirs, options.force),
203
+ loadPackageProperties.bind(this, inDirs),
204
+ excludeFromApp.bind(this, middleCb),
205
+ outputPackage.bind(this, destination),
206
+ encryptPackage.bind(this),
207
+ copyOutputToDst.bind(this, destination, middleCb),
208
+ recoverUmask.bind(this),
209
+ cleanupTmpDir.bind(this, middleCb)
210
+ ], function(err) {
211
+ if (err) {
212
+ // TODO: call cleanupTmpDir() before returning
213
+ setImmediate(next, err);
214
+ return;
215
+ }
216
+ // TODO: probably some more checkings are needed
217
+ setImmediate(next, null, {ipk: this.ipk, msg: "Success"});
218
+ }.bind(this));
219
+ },
220
+ resourcePackaging: function(inDirs, destination, options, middleCb, next) {
221
+ log.info("package#Packager#resourcePackaging()");
222
+ this.dataCopyCount = 0;
223
+ async.series([
224
+ this.checkInputDirectories.bind(this, inDirs, options),
225
+ setUmask.bind(this, 0),
226
+ loadPkgInfo.bind(this),
227
+ createTmpDir.bind(this),
228
+ excludeIpkFileFromApp.bind(this),
229
+ createPackageDir.bind(this),
230
+ fillPackageDir.bind(this),
231
+ loadResourceInfo.bind(this),
232
+ checkResourceInfo.bind(this),
233
+ createResourceDir.bind(this),
234
+ copyResource.bind(this),
235
+ addResourceInPkgInfo.bind(this),
236
+ copyData.bind(this, inDirs, options.force),
237
+ loadPackageProperties.bind(this, inDirs),
238
+ excludeFromApp.bind(this, middleCb),
239
+ outputPackage.bind(this, destination),
240
+ encryptPackage.bind(this),
241
+ copyOutputToDst.bind(this, destination, middleCb),
242
+ recoverUmask.bind(this),
243
+ cleanupTmpDir.bind(this, middleCb)
244
+ ], function(err) {
245
+ if (err) {
246
+ setImmediate(next, err);
247
+ return;
248
+ }
249
+ setImmediate(next, null, {ipk: this.ipk, msg: "Success"});
250
+ }.bind(this));
251
+ },
252
+ generatePackage: function(inDirs, destination, options, middleCb, next) {
253
+ log.info("package#Packager#generatePackage()", "from ", inDirs);
254
+ // check whether app or service directories are copied or not
255
+ this.dataCopyCount = 0;
256
+ this.minifyDone = !this.minify;
257
+
258
+ async.series([
259
+ this.checkInputDirectories.bind(this, inDirs, options),
260
+ setUmask.bind(this, 0),
261
+ loadPkgInfo.bind(this),
262
+ loadAppInfo.bind(this),
263
+ checkAppInfo.bind(this),
264
+ createTmpDir.bind(this),
265
+ createAppDir.bind(this),
266
+ checkELFHeader.bind(this),
267
+ fillAssetsField.bind(this),
268
+ copyAssets.bind(this),
269
+ copyApp.bind(this),
270
+ excludeIpkFileFromApp.bind(this),
271
+ createPackageDir.bind(this),
272
+ fillPackageDir.bind(this),
273
+ findServiceDir.bind(this, this.services),
274
+ loadServiceInfo.bind(this),
275
+ checkServiceInfo.bind(this),
276
+ createServiceDir.bind(this),
277
+ copyService.bind(this),
278
+ addServiceInPkgInfo.bind(this),
279
+ removeServiceFromAppDir.bind(this, middleCb),
280
+ copyData.bind(this, inDirs, options.force),
281
+ loadPackageProperties.bind(this, inDirs),
282
+ excludeFromApp.bind(this, middleCb),
283
+ outputPackage.bind(this, destination),
284
+ encryptPackage.bind(this),
285
+ copyOutputToDst.bind(this, destination, middleCb),
286
+ recoverUmask.bind(this),
287
+ cleanupTmpDir.bind(this, middleCb)
288
+ ], function(err) {
289
+ if (err) {
290
+ // TODO: call cleanupTmpDir() before returning
291
+ setImmediate(next, err);
292
+ return;
293
+ }
294
+ // TODO: probably some more checkings are needed
295
+ setImmediate(next, null, {ipk: this.ipk, msg: "Success"});
296
+ }.bind(this));
297
+ },
298
+ analyzeIPK: function(options, next) {
299
+ log.info("package#Packager#analyzeIPK()");
300
+ let ipkConfigFile, ipkFile, ipkConfig, tmpDirPath;
301
+ this.prepareOptions(options);
302
+
303
+ async.series([
304
+ _setConfig,
305
+ _unpackIpk,
306
+ _unpackTar,
307
+ _analyzeMetaFile,
308
+ _removeTmpDir,
309
+ ], function(err, results) {
310
+ log.silly("package#analyzeIPK()", "err:", err, ", results:", results);
311
+ if (err) {
312
+ return next(err);
313
+ }
314
+ return next(null, {msg: results[3].trim()});
315
+ });
316
+
317
+ function _setConfig(next) {
318
+ log.info("package#analyzeIPK()#_setConfig()");
319
+ if (options.info === 'true') {
320
+ return next(errHndl.getErrMsg("EMPTY_VALUE", 'info'));
321
+ } else if (options.infodetail === 'true') {
322
+ return next(errHndl.getErrMsg("EMPTY_VALUE", 'info-detail'));
323
+ }
324
+ ipkFile = options.info ? options.info : options.infodetail;
325
+ ipkConfigFile = path.resolve(__dirname, "../files/conf/ipk.json");
326
+
327
+ if (path.extname(ipkFile) !== ".ipk") {
328
+ return next(errHndl.getErrMsg("SUPPORT_ONLY_IPK", ipkFile));
329
+ }
330
+ if (!fs.existsSync(ipkFile)) {
331
+ return next(errHndl.getErrMsg("NOT_EXIST_PATH", ipkFile));
332
+ }
333
+ if (!fs.existsSync(ipkConfigFile)) {
334
+ return next(errHndl.getErrMsg("NOT_EXIST_PATH", ipkConfigFile));
335
+ }
336
+ ipkConfig = JSON.parse(fs.readFileSync(ipkConfigFile));
337
+ tmpDirPath = temp.path(ipkConfig.tmpPath);
338
+
339
+ if (!fs.existsSync(tmpDirPath)) {
340
+ fs.mkdirSync(tmpDirPath);
341
+ }
342
+ next();
343
+ }
344
+
345
+ function _unpackIpk(next) {
346
+ log.info("package#analyzeIPK()#_unpackIpk()");
347
+ const reader = new ar.ArReader(ipkFile);
348
+
349
+ reader.on("entry", function(entry, next) {
350
+ const name = entry.fileName();
351
+ entry.fileData()
352
+ .pipe(fs.createWriteStream(path.resolve(tmpDirPath, name)))
353
+ .on("finish", next);
354
+ });
355
+ reader.on("error", function(err) {
356
+ return next(err);
357
+ });
358
+ reader.on("close", function() {
359
+ log.verbose("package#analyzeIPK()#_unpackIpk()", "unpack ipk close");
360
+ next();
361
+ });
362
+ }
363
+
364
+ function _unpackTar(next) {
365
+ log.info("package#analyzeIPK()#_unpackTar()");
366
+ if (fs.existsSync(path.resolve(tmpDirPath, "control.tar.gz"))) {
367
+ (async function() {
368
+ await decompress(path.resolve(tmpDirPath, "control.tar.gz"), tmpDirPath, {
369
+ plugins: [
370
+ decompressTargz()
371
+ ]
372
+ });
373
+ log.verbose("package#analyzeIPK()#_unpackTar()", "control.tar.gz decompressed");
374
+ })();
375
+ } else if (fs.existsSync(path.resolve(tmpDirPath, "control.tar.xz"))) {
376
+ return next(errHndl.getErrMsg("NOT_SUPPORT_XZ"));
377
+ } else {
378
+ return next(errHndl.getErrMsg("NO_COMPONENT_FILE", ", control tar file"));
379
+ }
380
+
381
+ if (fs.existsSync(path.resolve(tmpDirPath, "data.tar.gz"))) {
382
+ (async function() {
383
+ await decompress(path.resolve(tmpDirPath, "data.tar.gz"), tmpDirPath, {
384
+ plugins: [
385
+ decompressTargz()
386
+ ]
387
+ });
388
+ log.verbose("package#analyzeIPK()#_unpackTar()", "data.tar.gz decompressed");
389
+ next();
390
+ })();
391
+ } else if (fs.existsSync(path.resolve(tmpDirPath, "data.tar.xz"))) {
392
+ return next(errHndl.getErrMsg("NOT_SUPPORT_XZ"));
393
+ } else {
394
+ return next(errHndl.getErrMsg("NO_COMPONENT_FILE", "data tar file"));
395
+ }
396
+ }
397
+
398
+ function _analyzeMetaFile(next) {
399
+ log.info("package#analyzeIPK()#_analyzeMetaFile()");
400
+ let result = "", targetFile, tmpTxt;
401
+
402
+ ipkConfig.webOSMetaFiles.forEach(function(item) {
403
+ const targetPath = path.resolve(tmpDirPath, ipkConfig[item].path);
404
+ // Analyze control file
405
+ if (item === "control") {
406
+ targetFile = path.resolve(targetPath, ipkConfig[item].fileName);
407
+ if (!fs.existsSync(targetFile)) {
408
+ return next(errHndl.getErrMsg("NO_COMPONENT_FILE", "control file"));
409
+ }
410
+
411
+ if (options.infodetail) {
412
+ result = "\n\n< " + ipkConfig[item].fileName + " >\n";
413
+ result += fs.readFileSync(targetFile).toString().trim();
414
+ } else {
415
+ result = ipkConfig[item].heading + "\n";
416
+ tmpTxt = fs.readFileSync(targetFile).toString().trim();
417
+ ipkConfig[item].info.forEach(function(field) {
418
+ if (tmpTxt.match(new RegExp(field + ": (.*)", "gi"))) {
419
+ result += tmpTxt.match(new RegExp(field + ": (.*)", "gi"))[0] + "\n";
420
+ }
421
+ });
422
+ }
423
+ // Analyze appinfo.json, packageinfo.json, services.json, package.json files
424
+ } else if (fs.existsSync(targetPath)) {
425
+ const dirArr = fs.readdirSync(targetPath);
426
+ let beforeDir = dirArr[0];
427
+
428
+ dirArr.forEach(function(dir) {
429
+ if (ipkConfig[item].fileName) {
430
+ ipkConfig[item].fileName.forEach(function(file) {
431
+ targetFile = path.resolve(targetPath, dir, file);
432
+ if (fs.existsSync(targetFile)) {
433
+ if (options.infodetail) {
434
+ result += "\n\n< " + file + " >\n";
435
+ result += fs.readFileSync(targetFile).toString().trim();
436
+ } else {
437
+ if (ipkConfig[item].heading && beforeDir !== path.join(ipkConfig[item].path, dir)) {
438
+ result += "\n" + ipkConfig[item].heading + "\n";
439
+ }
440
+ tmpTxt = fs.readFileSync(targetFile).toString().trim();
441
+ const tmpJson = JSON.parse(tmpTxt);
442
+ ipkConfig[item].info.forEach(function(field) {
443
+ if (tmpJson[field]) {
444
+ const fieldValue = tmpJson[field];
445
+ if (typeof fieldValue === "object") {
446
+ if (ipkConfig[item][field]) { // Case of services.json, services_name field
447
+ const subField = ipkConfig[item][field],
448
+ subResult = [];
449
+ fieldValue.forEach(function(subItem) {
450
+ subResult.push(subItem[subField]);
451
+ });
452
+ result += field + ": " + JSON.stringify(subResult) + "\n";
453
+ } else { // Case of packageinfo.json, services field
454
+ result += field + ": " + JSON.stringify(fieldValue) + "\n";
455
+ }
456
+ } else {
457
+ result += field + ": " + fieldValue + "\n";
458
+ }
459
+ }
460
+ });
461
+ beforeDir = path.join(ipkConfig[item].path, dir);
462
+ }
463
+ }
464
+ });
465
+ }
466
+ });
467
+ }
468
+ });
469
+ next(null, result);
470
+ }
471
+
472
+ function _removeTmpDir(next) {
473
+ log.info("package#analyzeIPK()#_removeTmpDir()");
474
+ rimraf(tmpDirPath, function(err) {
475
+ log.verbose("package#analyzeIPK()#_removeTmpDir()", "removed " + tmpDirPath);
476
+ next(err);
477
+ });
478
+ }
479
+ }
480
+ };
481
+
482
+ function Service() {
483
+ this.srcDir = "";
484
+ this.dstDirs = [];
485
+ this.valid = false;
486
+ this.serviceInfo = "";
487
+ this.dirName = "";
488
+ }
489
+
490
+ // Private functions
491
+ function loadPkgInfo(next) {
492
+ log.verbose("loadPkgInfo");
493
+ let data;
494
+
495
+ if (this.pkginfofile) {
496
+ log.silly("Use pkginfofile option");
497
+ if (fs.existsSync(this.pkginfofile)) {
498
+ if ("packageinfo.json" !== path.basename(this.pkginfofile)) {
499
+ return setImmediate(next, errHndl.getErrMsg("INVALID_FILE", "packageinfo.json"));
500
+ }
501
+ data = rewriteFileWoBOMAsUtf8(this.pkginfofile, true);
502
+ try {
503
+ log.verbose("PKGINFO >>" + data + "<<");
504
+ this.pkginfo = JSON.parse(data);
505
+
506
+ if (!Object.prototype.hasOwnProperty.call(this.pkginfo, 'id')) {
507
+ return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "id"));
508
+ }
509
+
510
+ this.pkgId = this.pkginfo.id;
511
+ this.pkgVersion = this.pkgVersion || this.pkginfo.version;
512
+ setImmediate(next);
513
+ }
514
+ catch (err) {
515
+ return setImmediate(next, errHndl.getErrMsg("INVALID_JSON_FORMAT", "packageinfo.json"));
516
+ }
517
+ } else {
518
+ return setImmediate(next, errHndl.getErrMsg("NOT_EXIST_PATH", this.pkginfofile));
519
+ }
520
+ } else if (this.pkgDir) {
521
+ log.silly("Use packageinfo.json from PKG_DIR");
522
+ data = rewriteFileWoBOMAsUtf8(path.join(this.pkgDir, "packageinfo.json"));
523
+ try {
524
+ log.verbose("PKGINFO >>" + data + "<<");
525
+ this.pkginfo = JSON.parse(data);
526
+
527
+ if (!Object.prototype.hasOwnProperty.call(this.pkginfo, 'id')) {
528
+ return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "id"));
529
+ }
530
+ this.pkgId = this.pkginfo.id;
531
+ this.pkgVersion = this.pkgVersion || this.pkginfo.version;
532
+ setImmediate(next);
533
+ }
534
+ catch (err) {
535
+ return setImmediate(next, errHndl.getErrMsg("INVALID_JSON_FORMAT", "packageinfo.json"));
536
+ }
537
+ } else {
538
+ return setImmediate(next);
539
+ }
540
+ }
541
+
542
+ function loadAppInfo(next) {
543
+ log.verbose("loadAppInfo");
544
+ if (this.appCount === 0) {
545
+ return setImmediate(next);
546
+ }
547
+
548
+ const filepath = path.join(this.appDir, "appinfo.json"),
549
+ data = rewriteFileWoBOMAsUtf8(filepath, true);
550
+ try {
551
+ this.appinfo = JSON.parse(data);
552
+ log.silly("package#loadAppInfo()", "content of appinfo.json:", this.appinfo);
553
+
554
+ if (!this.appinfo.version || this.appinfo.version === undefined) {
555
+ this.appinfo.version = "1.0.0";
556
+ }
557
+
558
+ this.pkgVersion = this.pkgVersion || this.appinfo.version;
559
+ setImmediate(next);
560
+ } catch(err) {
561
+ setImmediate(next, err);
562
+ }
563
+ }
564
+
565
+ function checkAppInfo(next) {
566
+ if (this.appCount === 0) {
567
+ return setImmediate(next);
568
+ }
569
+
570
+ // check enyo app
571
+ if (this.pkgJSExist && this.appinfo.main && this.appinfo.main.match(/(\.html|\.htm)$/gi)) {
572
+ const mainFile = path.join(this.appDir, this.appinfo.main);
573
+ if (!fs.existsSync(mainFile)) {
574
+ return setImmediate(next, errHndl.getErrMsg("NOT_EXIST_PATH", this.appinfo.main));
575
+ }
576
+
577
+ const regex = new RegExp("(<script[^>]*src[ \t]*=[ \t]*['\"])[^'\"]*/enyo.js(['\"])"),
578
+ data = fs.readFileSync(mainFile);
579
+ if (data.toString().match(regex)) {
580
+ // If enyo app, stop packaging.
581
+ return setImmediate(next, errHndl.getErrMsg("NOT_SUPPORT_ENYO"));
582
+ }
583
+ }
584
+
585
+ if (!this.appinfo.id || this.appinfo.id === undefined) {
586
+ return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "id"));
587
+ }
588
+ if (this.appinfo.id.length < 1 || !(/^[a-z0-9.+-]*$/.test(this.appinfo.id))) {
589
+ log.error(errHndl.getErrMsg("INVALID_VALUE", "id", this.appinfo.id));
590
+ return setImmediate(next, errHndl.getErrMsg("INVALID_ID_RULE"));
591
+ }
592
+ if (this.pkgId && this.appinfo.id.indexOf(this.pkgId) !== 0) {
593
+ log.error(errHndl.getErrMsg("INVALID_VALUE", "id", this.appinfo.id));
594
+ return setImmediate(next, errHndl.getErrMsg("INVALID_APPID", this.pkgId));
595
+ }
596
+ if (!this.appinfo.version || this.appinfo.version === undefined) {
597
+ return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "version"));
598
+ }
599
+ if (this.appinfo.version.length < 1 || !(/^([1-9]\d{0,8}|\d)\.([1-9]\d{0,8}|\d)\.([1-9]\d{0,8}|\d)$/.test(this.appinfo.version))) {
600
+ log.error(errHndl.getErrMsg("INVALID_VALUE", "version", this.appinfo.version));
601
+ return setImmediate(next, errHndl.getErrMsg("INVALID_VERSION_RULE"));
602
+ }
603
+ if (this.appinfo.type && this.appinfo.type.match(/clock/gi)) {
604
+ return setImmediate(next);
605
+ }
606
+
607
+ const schemaFile = path.resolve(__dirname, "../files/schema/ApplicationDescription.schema");
608
+ async.waterfall([
609
+ fs.readFile.bind(this, schemaFile, "utf-8"),
610
+ function getSchema(data, next) {
611
+ try {
612
+ const schema = JSON.parse(data);
613
+ /* "required" keyword is redefined in draft 4.
614
+ But current jsonschema lib support only draft 3.
615
+ So this line changes "required" attribute according to the draft 3.
616
+ */
617
+ const reqKeys = schema.required;
618
+ if (reqKeys) {
619
+ for (const key in schema.properties) {
620
+ if (reqKeys.indexOf(key) !== -1) {
621
+ schema.properties[key].required = true;
622
+ }
623
+ }
624
+ }
625
+ next(null, schema);
626
+ } catch(err) {
627
+ next(errHndl.getErrMsg("INVALID_JSON_FORMAT", "AppDescription schema"));
628
+ }
629
+ },
630
+ function checkValid(schema, next) {
631
+ try {
632
+ next(null, new Validator().validate(this.appinfo, schema));
633
+ } catch (err) {
634
+ log.error(err);
635
+ next(errHndl.getErrMsg("INVALID_JSON_FORMAT"));
636
+ }
637
+ }.bind(this)
638
+ ], function(err, result) {
639
+ if (err) {
640
+ setImmediate(next, err);
641
+ } else {
642
+ if (result && result.errors.length > 0) {
643
+ const errFile = "appinfo.json";
644
+ let errMsg = "";
645
+ for (const idx in result.errors) {
646
+ let errMsgLine = result.errors[idx].property + " " + result.errors[idx].message;
647
+ if (errMsgLine.indexOf("instance.") > -1) {
648
+ errMsgLine = errMsgLine.substring("instance.".length);
649
+ errMsg = errMsg.concat("\n");
650
+ errMsg = errMsg.concat(errMsgLine);
651
+ }
652
+ }
653
+ errMsg = errHndl.getErrMsg("INVALID_FILE", errFile, errMsg);
654
+ return setImmediate(next, errMsg);
655
+ } else {
656
+ log.verbose("package#checkAppInfo()", "APPINFO is valid");
657
+ }
658
+ setImmediate(next);
659
+ }
660
+ });
661
+ }
662
+
663
+ function fillAssetsField(next) {
664
+ if (this.appCount === 0) {
665
+ return setImmediate(next);
666
+ }
667
+ // make appinfo.assets to have default values so that they can be copied into the package
668
+ this.appinfo.assets = this.appinfo.assets || [];
669
+ for (const i in this.appinfo) {
670
+ if (Object.prototype.hasOwnProperty.call(this.appinfo, i) && defaultAssetsFields[i]) {
671
+ // no duplicated adding & value should not null string & file/dir should exist
672
+ if ((this.appinfo.assets.indexOf(this.appinfo[i]) === -1) && this.appinfo[i]) {
673
+ this.appinfo.assets.push(this.appinfo[i]);
674
+ }
675
+ }
676
+ }
677
+
678
+ // refer to appinfo.json files in localization directory.
679
+ const appInfoPath = this.originAppDir,
680
+ checkDir = path.join(this.originAppDir, "resources"),
681
+ foundFilePath = [],
682
+ resourcesAssets = [];
683
+
684
+ try {
685
+ const stat = fs.lstatSync(checkDir);
686
+ if (!stat.isDirectory()) {
687
+ return setImmediate(next, null);
688
+ }
689
+ } catch(err) {
690
+ if (err.code === "ENOENT") {
691
+ return setImmediate(next, null);
692
+ }
693
+ }
694
+
695
+ async.series([
696
+ walkFolder.bind(null, checkDir, "appinfo.json", foundFilePath, 1),
697
+ function(next) {
698
+ async.forEach(foundFilePath, function(filePath, next) {
699
+ rewriteFileWoBOMAsUtf8(filePath, true, function(err, data) {
700
+ try {
701
+ const appInfo = JSON.parse(data),
702
+ dirPath = path.dirname(filePath);
703
+ for (const i in appInfo) {
704
+ if (Object.prototype.hasOwnProperty.call(appInfo, i) && defaultAssetsFields[i]) {
705
+ if (appInfo[i]) {
706
+ const itemPath = path.join(dirPath, appInfo[i]),
707
+ relPath = path.relative(appInfoPath, itemPath);
708
+ // no duplicated adding & value should not null string & file/dir should exist
709
+ if ((resourcesAssets.indexOf(relPath) === -1)) {
710
+ resourcesAssets.push(relPath);
711
+ }
712
+ }
713
+ }
714
+ }
715
+ setImmediate(next, null);
716
+ } catch(error) {
717
+ setImmediate(next, errHndl.getErrMsg("INVALID_JSON_FORMAT", filePath));
718
+ }
719
+ });
720
+ }, function(err) {
721
+ setImmediate(next, err);
722
+ });
723
+ },
724
+ function(next) {
725
+ this.appinfo.assets = this.appinfo.assets.concat(resourcesAssets);
726
+ setImmediate(next, null);
727
+ }.bind(this)
728
+ ], function(err) {
729
+ setImmediate(next, err);
730
+ });
731
+ }
732
+
733
+ function createTmpDir(next) {
734
+ this.tempDir = temp.path({prefix: 'com.palm.ares.hermes.bdOpenwebOS'}) + '.d';
735
+ log.verbose("package#createTmpDir()", "temp dir:", this.tempDir);
736
+ mkdirp(this.tempDir, next);
737
+ }
738
+
739
+ function createAppDir(next) {
740
+ if (this.appCount === 0) {
741
+ return setImmediate(next);
742
+ }
743
+
744
+ try {
745
+ this.applicationDir = path.resolve(this.tempDir, "data/usr/palm/applications", this.appinfo.id);
746
+ log.info("package#createAppDir()", "application dir:" + this.applicationDir);
747
+ mkdirp(this.applicationDir, next);
748
+ } catch (err) {
749
+ return setImmediate(next, err);
750
+ }
751
+ }
752
+
753
+ function copySrcToDst(src, dst, next) {
754
+ const fileList = [],
755
+ self = this,
756
+ requireMinify = !!((!!self.minify && !self.minifyDone));
757
+ src = path.normalize(path.resolve(src));
758
+ dst = path.normalize(path.resolve(dst));
759
+
760
+ async.series([
761
+ function(next) {
762
+ const stat = fs.statSync(src);
763
+ if (stat.isFile()) {
764
+ _pushList(fileList, 'file', path.dirname(src), path.basename(src), true, null);
765
+ setImmediate(next);
766
+ } else {
767
+ _getFileList(src, src, fileList, next);
768
+ }
769
+ },
770
+ _copySrcToDst.bind(null, fileList, dst, requireMinify)
771
+ ], function(err) {
772
+ next(err);
773
+ });
774
+
775
+ function _pushList(list, type, basePath, relPath, isSubPath, indRelPath) {
776
+ if (!FILE_TYPE[type]) {
777
+ return;
778
+ }
779
+ list.push({
780
+ type: type,
781
+ basePath: basePath,
782
+ relPath: relPath,
783
+ isSubPath: isSubPath,
784
+ indRelPath: indRelPath
785
+ });
786
+ }
787
+
788
+ function _getFileList(dirPath, basePath, files, next) {
789
+ // TODO: the following code should be more concise.
790
+ // Handling symbolic links
791
+ // if the path sym-link indicates is a sub-path of source directory, treat a sym-link as it is.
792
+ // otherwise the files sym-link indicates should be copied
793
+ async.waterfall([
794
+ fs.readdir.bind(null, dirPath),
795
+ function(fileNames, next) {
796
+ if (fileNames.length === 0) {
797
+ _pushList(files, 'dir', basePath, path.relative(basePath, dirPath), true, null);
798
+ return setImmediate(next);
799
+ }
800
+
801
+ async.forEachSeries(fileNames, function(fileName, next) {
802
+ const filePath = path.join(dirPath, fileName),
803
+ relPath = path.relative(basePath, filePath);
804
+
805
+ async.waterfall([
806
+ fs.lstat.bind(null, filePath),
807
+ function(lstat, next) {
808
+ if (lstat.isSymbolicLink()) {
809
+ let indicateFullPath;
810
+ try {
811
+ indicateFullPath = fs.realpathSync(filePath);
812
+ } catch (err) {
813
+ if (err.code === 'ENOENT') {
814
+ log.warn("The file for symbolic link (" + filePath + ") is missing...");
815
+ return setImmediate(next);
816
+ }
817
+ return setImmediate(next, err);
818
+ }
819
+
820
+ const indicateRelPath = fs.readlinkSync(filePath);
821
+ if (indicateFullPath.indexOf(basePath) !== -1) {
822
+ _pushList(files, 'symlink', basePath, relPath, true, indicateRelPath);
823
+ } else {
824
+ const stat = fs.statSync(filePath);
825
+ if (stat.isDirectory()) {
826
+ return _getFileList(filePath, basePath, files, next);
827
+ } else if (stat.isFile()) {
828
+ _pushList(files, 'file', basePath, relPath, true, null);
829
+ }
830
+ }
831
+ setImmediate(next);
832
+ } else if (lstat.isDirectory()) {
833
+ return _getFileList(filePath, basePath, files, next);
834
+ } else if (lstat.isFile()) {
835
+ _pushList(files, 'file', basePath, relPath, true, null);
836
+ setImmediate(next);
837
+ } else {
838
+ setImmediate(next);
839
+ }
840
+ }
841
+ ], next); // async.waterfall
842
+ }, next); // async.forEach
843
+ }
844
+ ], function(err) {
845
+ return setImmediate(next, err);
846
+ }); // async.waterfall
847
+ }
848
+
849
+ function _copySrcToDst(files, dstPath, minify, next) {
850
+ try {
851
+ async.forEachSeries(files, function(file, next) {
852
+ if (!FILE_TYPE[file.type]) {
853
+ log.verbose("package#copySrcToDst()#_copySrcToDst()", "ignore 'unknown file type'("+file.type+")");
854
+ return;
855
+ }
856
+
857
+ if (!file.relPath) {
858
+ log.verbose("package#copySrcToDst()#_copySrcToDst()", "ignore 'unknown path'");
859
+ return setImmediate(next);
860
+ }
861
+
862
+ if (file.type === FILE_TYPE.dir) {
863
+ mkdirp.sync(path.join(dstPath, file.relPath));
864
+ return setImmediate(next);
865
+ }
866
+
867
+ const dstDirPath = path.dirname(path.join(dstPath, file.relPath));
868
+ if (!fs.existsSync(dstDirPath)) {
869
+ mkdirp.sync(dstDirPath);
870
+ }
871
+
872
+ if (file.type === FILE_TYPE.symlink) {
873
+ if (file.isSubPath && file.indRelPath) {
874
+ const linkFile = path.join(dstPath, file.relPath);
875
+ if (fs.existsSync(linkFile)) {
876
+ if (fs.lstatSync(linkFile).isSymbolicLink()) {
877
+ fs.unlinkSync(linkFile);
878
+ }
879
+ }
880
+ fs.symlinkSync(file.indRelPath, linkFile, null);
881
+ }
882
+ } else {
883
+ const sourceFile = path.join(file.basePath, file.relPath);
884
+ if (fs.existsSync(sourceFile)) {
885
+ if (minify && '.js' === path.extname(sourceFile) && file.relPath.indexOf('node_modules') === -1) {
886
+ log.verbose("package#copySrcToDst()#_copySrcToDst()", "require minification # sourceFile:", sourceFile);
887
+ try {
888
+ const data = uglify.minify(fs.readFileSync(sourceFile,'utf8'));
889
+ if (data.error) {
890
+ throw data.error;
891
+ }
892
+ fs.writeFileSync(path.join(dstPath, file.relPath), data.code, 'utf8');
893
+ } catch (e) {
894
+ log.verbose("package#copySrcToDst()#_copySrcToDst()", util.format('Failed to uglify code %s: %s', sourceFile, e.stack));
895
+ return setImmediate(next, errHndl.getErrMsg("FAILED_MINIFY", sourceFile));
896
+ }
897
+ } else {
898
+ shelljs.cp('-Rf', sourceFile, path.join(dstPath, file.relPath, '..'));
899
+ }
900
+ } else {
901
+ log.verbose("package#copySrcToDst()#_copySrcToDst()", "ignore '" + file.relPath + "'");
902
+ }
903
+ }
904
+ setImmediate(next);
905
+ }, function(err) {
906
+ if (!err && minify) {
907
+ self.minifyDone = true;
908
+ }
909
+ setImmediate(next, err);
910
+ });
911
+ } catch(err) {
912
+ setImmediate(next, err);
913
+ }
914
+ }
915
+ }
916
+
917
+ function checkELFHeader(next) {
918
+ const self = this,
919
+ ELF_HEADER_LEN = 64,
920
+ buf = Buffer.alloc(ELF_HEADER_LEN),
921
+ mainFile = path.resolve(path.join(this.appDir, this.appinfo.main));
922
+
923
+ if (!fs.existsSync(mainFile)) {
924
+ return setImmediate(next, errHndl.getErrMsg("NOT_EXIST_PATH", mainFile));
925
+ }
926
+
927
+ const fd = fs.openSync(mainFile, 'r'),
928
+ stats = fs.fstatSync(fd),
929
+ elfParser = new ElfParser(),
930
+ _isELF = function(_buf) {
931
+ if (_buf.slice(0, 4).toString() !== '\x7fELF') {
932
+ return false;
933
+ } else {
934
+ return true;
935
+ }
936
+ };
937
+
938
+ if (stats.size < ELF_HEADER_LEN) {
939
+ log.verbose("package#checkELFHeader()", "file size is smaller than ELF Header size");
940
+ return setImmediate(next);
941
+ }
942
+
943
+ fs.read(fd, buf, 0, ELF_HEADER_LEN, 0, function(err, bytesRead, _buf) {
944
+ if (bytesRead < ELF_HEADER_LEN || err) {
945
+ log.silly("package#checkELFHeader()", "err:", err, ", bytesRead:", bytesRead);
946
+ log.silly("package#checkELFHeader()", "readBuf to parse ELF header is small or error occurred during reading file.");
947
+ return setImmediate(next);
948
+ }
949
+
950
+ if (!_isELF(_buf)) {
951
+ log.silly("package#checkELFHeader()", mainFile + " is not ELF format");
952
+ } else {
953
+ log.silly("package#checkELFHeader()", mainFile + " is ELF format");
954
+ try {
955
+ const elfHeader = elfParser.parseHeader(_buf);
956
+ log.silly("package#checkELFHeader()", "elfHeader:", elfHeader);
957
+
958
+ if (elfHeader.machine && elfHeader.machine.match(/86$/)) {
959
+ // current emulator opkg is allowing only all, noarch and i586.
960
+ // when it is used with --offline-root.
961
+ self.architecture = 'i586';
962
+ } else if (elfHeader.machine && elfHeader.machine.match(/amd64$/)) {
963
+ // change amd64 to x86_64
964
+ self.architecture = 'x86_64';
965
+ } else if (elfHeader.machine && elfHeader.machine.match(/AArch64$/)) {
966
+ // change AArch64 to aarch64
967
+ self.architecture = 'aarch64';
968
+ } else {
969
+ self.architecture = elfHeader.machine;
970
+ }
971
+ } catch(e) {
972
+ log.verbose("package#checkELFHeader()", "exception:", e);
973
+ }
974
+ }
975
+ log.verbose("package#checkELFHeader()", "machine:", self.architecture);
976
+ fs.close(fd);
977
+ setImmediate(next);
978
+ });
979
+ }
980
+
981
+ function copyApp(next) {
982
+ if (this.appCount === 0) {
983
+ return setImmediate(next);
984
+ }
985
+
986
+ this.dataCopyCount++;
987
+ log.info("package#copyApp()", "copy " + this.appDir + " ==> " + this.applicationDir);
988
+ copySrcToDst.call(this, this.appDir, this.applicationDir, next);
989
+ }
990
+
991
+ function copyAssets(next) {
992
+ if (this.appCount === 0) {
993
+ return setImmediate(next);
994
+ }
995
+
996
+ try {
997
+ async.forEachSeries(this.appinfo.assets, _handleAssets.bind(this), next);
998
+ } catch (err) {
999
+ return setImmediate(next, err);
1000
+ }
1001
+
1002
+ function _handleAssets(file, next) {
1003
+ if (path.resolve(this.originAppDir) === path.resolve(this.appDir)) {
1004
+ _checkAppinfo.call(this, file, next);
1005
+ } else {
1006
+ async.series([
1007
+ _checkAppinfo.bind(this, file),
1008
+ _copyAssets.bind(this, file)
1009
+ ], next);
1010
+ }
1011
+ }
1012
+
1013
+ function _checkAppinfo(file, next) {
1014
+ let source;
1015
+ if (path.resolve(file) === path.normalize(file)) {
1016
+ return next(errHndl.getErrMsg("NOT_RELATIVE_PATH_APPINFO", file));
1017
+ } else {
1018
+ source = path.join(this.originAppDir, file);
1019
+ }
1020
+
1021
+ if (path.resolve(source).indexOf(this.originAppDir) !== 0) {
1022
+ return next(errHndl.getErrMsg("NOT_RELATIVE_PATH_APPINFO", file));
1023
+ }
1024
+
1025
+ if (!fs.existsSync(source) && !this.rom) {
1026
+ const msg = errHndl.getErrMsg("NOT_EXIST_PATH", file);
1027
+ if (path.basename(source).indexOf('$') === 0) {
1028
+ // ignore property with starting $ prefix (dynamic property handling in the platform)
1029
+ return setImmediate(next);
1030
+ } else {
1031
+ return setImmediate(next, msg);
1032
+ }
1033
+ }
1034
+ setImmediate(next);
1035
+ }
1036
+
1037
+ function _copyAssets(file, next) {
1038
+ log.verbose("package#copyAssets()#_copyAssets", "'" + file + "' will be located in app directory");
1039
+ const source = path.join(this.originAppDir, file),
1040
+ destination = this.appDir;
1041
+
1042
+ async.series([
1043
+ function(next) {
1044
+ if (!fs.existsSync(destination)) {
1045
+ mkdirp(destination, next);
1046
+ } else {
1047
+ setImmediate(next);
1048
+ }
1049
+ }
1050
+ ], function(err) {
1051
+ if (err) {
1052
+ return setImmediate(next, err);
1053
+ }
1054
+ shelljs.cp('-Rf', source, destination);
1055
+ setImmediate(next);
1056
+ });
1057
+ }
1058
+ }
1059
+
1060
+ function excludeIpkFileFromApp(next) {
1061
+ // Exclude a pre-built .ipk file
1062
+ this.excludeFiles = this.excludeFiles.concat([
1063
+ // eslint-disable-next-line no-useless-escape
1064
+ "[.]*[\\.]ipk",
1065
+ ".DS_Store",
1066
+ // ".vscode",
1067
+ // ".reloadignore",
1068
+ // ".launchparams.json"
1069
+ ]);
1070
+ setImmediate(next);
1071
+ }
1072
+
1073
+ function _retrieve(list, regExp, dirPath, depth, next) {
1074
+ async.waterfall([
1075
+ fs.readdir.bind(null, dirPath), function(fileNames, next) {
1076
+ async.forEach(fileNames, function(fileName, next) {
1077
+ const filePath = path.join(dirPath, fileName);
1078
+ async.waterfall([
1079
+ fs.lstat.bind(null, filePath), function(stat, next) {
1080
+ let result = false;
1081
+ if (depth > 1 && regExp.test(filePath)) {
1082
+ result = true;
1083
+ list.push(filePath);
1084
+ }
1085
+
1086
+ if (!result && stat.isDirectory()) {
1087
+ _retrieve(list, regExp, filePath, depth + 1, next);
1088
+ } else {
1089
+ setImmediate(next);
1090
+ }
1091
+ }
1092
+ ], next);
1093
+ }, next);
1094
+ }
1095
+ ], function(err) {
1096
+ setImmediate(next, err);
1097
+ });
1098
+ }
1099
+
1100
+ function excludeFromApp(middleCb, next) {
1101
+ let excludes;
1102
+ if (this.appCount === 0) {
1103
+ excludes = this.excludeFiles;
1104
+ } else {
1105
+ excludes = this.excludeFiles.concat(this.appinfo.exclude || []);
1106
+ }
1107
+
1108
+ const regExpQueries = excludes.map(function(exclude) {
1109
+ return exclude.replace(/^\./g,"^\\.").replace(/^\*/g,"").replace(/$/g,"$");
1110
+ }, this),
1111
+ strRegExp = regExpQueries.join("|"),
1112
+ regExp = new RegExp(strRegExp, "i"),
1113
+ excludeList = [],
1114
+ tempDirPrefix = path.resolve(this.tempDir, "data/usr/palm");
1115
+
1116
+ async.series([
1117
+ _retrieve.bind(this, excludeList, regExp, tempDirPrefix, 0), function(next) {
1118
+ const meta_files = ["appinfo.json", "services.json", "packageinfo.json", "resourceinfo.json"],
1119
+ unexcludable = [],
1120
+ excluded = [];
1121
+ try {
1122
+ excludeList.forEach(function(file) {
1123
+ if (meta_files.includes(path.basename(file))) {
1124
+ unexcludable.push(path.basename(file));
1125
+ } else {
1126
+ const sliced = file.slice(tempDirPrefix.length + 1);
1127
+ excluded.push(sliced.slice(sliced.indexOf(path.sep) + 1));
1128
+ shelljs.rm('-rf', file);
1129
+ }
1130
+ });
1131
+ if (unexcludable.length > 0) {
1132
+ middleCb("Cannot exclude: " + unexcludable); // FIXME
1133
+ }
1134
+ if (excluded.length > 0) {
1135
+ middleCb("Excluded: " + excluded); // FIXME
1136
+ }
1137
+ setImmediate(next);
1138
+ } catch(err) {
1139
+ setImmediate(next, err);
1140
+ }
1141
+ }
1142
+ ], function(err) {
1143
+ if (err) {
1144
+ return setImmediate(next, err);
1145
+ }
1146
+ setImmediate(next);
1147
+ });
1148
+ }
1149
+
1150
+ function createPackageDir(next) {
1151
+ if (!this.rom) {
1152
+ const pkgDirName = this.pkgId || this.appinfo.id;
1153
+ this.packageDir = path.join(this.tempDir, "data/usr/palm/packages", pkgDirName);
1154
+ log.verbose("package#createPackageDir", "directory:", this.packageDir);
1155
+ mkdirp(this.packageDir, next);
1156
+ } else {
1157
+ setImmediate(next);
1158
+ }
1159
+ }
1160
+
1161
+ function fillPackageDir(next) {
1162
+ log.verbose("fillPackageDir");
1163
+
1164
+ if (!this.rom) {
1165
+ let data = "";
1166
+ if (this.pkginfo) {
1167
+ // Use pkginfofile option or PKG_DIR
1168
+ if (!this.pkginfo.version) {
1169
+ this.pkginfo.version = this.pkgVersion || "1.0.0";
1170
+ }
1171
+ if (this.appinfo) {
1172
+ this.pkginfo.app = this.appinfo.id;
1173
+ }
1174
+ _checkPkgInfo(this.pkginfo.id, this.pkginfo.version, next);
1175
+ data = JSON.stringify(this.pkginfo, null, 2) + "\n";
1176
+ } else {
1177
+ // Use pkgid option or no option
1178
+ const pkginfo = {
1179
+ "id": this.pkgId || this.appinfo.id,
1180
+ "version": this.pkgVersion || "1.0.0"
1181
+ };
1182
+ if (this.appinfo) {
1183
+ pkginfo.app = this.appinfo.id;
1184
+ }
1185
+ _checkPkgInfo(pkginfo.id, pkginfo.version, next);
1186
+ data = JSON.stringify(pkginfo, null, 2) + "\n";
1187
+ }
1188
+ log.verbose("Generating packageinfo.json: " + data);
1189
+ fs.writeFile(path.join(this.packageDir, "packageinfo.json"), data, next);
1190
+ } else {
1191
+ setImmediate(next);
1192
+ }
1193
+
1194
+ function _checkPkgInfo(id, version, next) {
1195
+ if (!(/^[a-z0-9.+-]*$/.test(id))) {
1196
+ log.error(errHndl.getErrMsg("INVALID_VALUE", "pkg id", id));
1197
+ return setImmediate(next, errHndl.getErrMsg("INVALID_ID_RULE"));
1198
+ }
1199
+
1200
+ if (!(/^([1-9]\d{0,8}|\d)\.([1-9]\d{0,8}|\d)\.([1-9]\d{0,8}|\d)$/.test(version))) {
1201
+ log.error(errHndl.getErrMsg("INVALID_VALUE", "pkg version", version));
1202
+ return setImmediate(next, errHndl.getErrMsg("INVALID_VERSION_RULE"));
1203
+ }
1204
+ }
1205
+ }
1206
+
1207
+
1208
+ function loadPackageProperties(inDirs, next) {
1209
+ const self = this;
1210
+ self.packageProperties = {};
1211
+
1212
+ async.forEach(inDirs, function(inDir, next) {
1213
+ const filename = path.join(inDir, "package.properties");
1214
+
1215
+ function _checkFileMode(file) {
1216
+ file = file.replace(/\\/g, "/").trim();
1217
+ const idx = file.lastIndexOf("/");
1218
+ file = (idx !== -1) ? file.slice(idx + 1) : file;
1219
+ self.packageProperties[file] = this.fileMode;
1220
+ }
1221
+
1222
+ if (fs.existsSync(filename)) {
1223
+ const data = fs.readFileSync(filename);
1224
+ try {
1225
+ const lines = data.toString().split("\n");
1226
+ let seperatorIndex;
1227
+
1228
+ for (const i in lines) {
1229
+ if (lines[i].indexOf("filemode.") === 0) {
1230
+ seperatorIndex = lines[i].indexOf("=");
1231
+ const fileList = lines[i].slice(seperatorIndex + 1).trim(),
1232
+ fileArray = fileList.split(",");
1233
+ this.fileMode = lines[i].slice(9, seperatorIndex).trim();
1234
+
1235
+ fileArray.forEach(_checkFileMode);
1236
+ }
1237
+ }
1238
+ setImmediate(next);
1239
+ } catch (error) {
1240
+ setImmediate(next, error);
1241
+ }
1242
+ } else {
1243
+ setImmediate(next);
1244
+ }
1245
+ }, function(err) {
1246
+ // Exclude package.propeties from ipk file
1247
+ self.excludeFiles = self.excludeFiles.concat([
1248
+ "package.properties"
1249
+ ]);
1250
+ setImmediate(next, err);
1251
+ });
1252
+ }
1253
+
1254
+ function outputPackage(destination, next) {
1255
+ log.info("package#outputPackage()");
1256
+
1257
+ // Check that the directories exist
1258
+ if (fs.existsSync(destination)) {
1259
+ const stats = fs.statSync(destination);
1260
+ if (!stats.isDirectory()) {
1261
+ return next(errHndl.getErrMsg("NOT_DIRTYPE_PATH", destination));
1262
+ }
1263
+ } else {
1264
+ log.verbose("setOutputDir()", "creating directory '" + destination + "' ...");
1265
+ mkdirp.sync(destination);
1266
+ }
1267
+ destination = fs.realpathSync(destination);
1268
+
1269
+ if (this.rom) {
1270
+ copySrcToDst.call(this, path.join(this.tempDir, 'data'), destination, next);
1271
+ } else {
1272
+ const tempDir = this.tempDir,
1273
+ tempCtrlDir = path.join(tempDir, 'ctrl'),
1274
+ ctrlTgzFile = path.join(tempDir, 'control.tar.gz'),
1275
+ tempDataDir = path.join(tempDir, 'data'),
1276
+ dataTgzFile = path.join(tempDir, 'data.tar.gz');
1277
+
1278
+ async.series([
1279
+ decidePkgName.bind(this, this.pkgId, this.pkgVersion),
1280
+ getFileSize.bind(this, tempDataDir),
1281
+ makeTgz.bind(this, tempDataDir, dataTgzFile),
1282
+ createDir.bind(this, tempCtrlDir),
1283
+ createDataHash.bind(this, tempCtrlDir, dataTgzFile),
1284
+ createCertificateHash.bind(this, tempCtrlDir),
1285
+ createControlFile.bind(this, tempCtrlDir, false),
1286
+ createControlSignFile.bind(this, tempCtrlDir),
1287
+ makeTgz.bind(this, tempCtrlDir, ctrlTgzFile),
1288
+ createDebianBinary.bind(this, tempDir),
1289
+ setIpkFileName.bind(this),
1290
+ removeExistingIpk.bind(this, destination),
1291
+ makeIpk.bind(this, tempDir)
1292
+ ], function(err) {
1293
+ if (err) {
1294
+ setImmediate(next, err);
1295
+ return;
1296
+ }
1297
+ setImmediate(next);
1298
+ });
1299
+ }
1300
+ }
1301
+
1302
+ function decidePkgName(pkgName, pkgVersion, next) {
1303
+ if (this.appCount !== 0) {
1304
+ this.pkg = {
1305
+ name: pkgName || this.appinfo.id,
1306
+ version: pkgVersion || this.appinfo.version
1307
+ };
1308
+ } else if (this.services.length > 0) {
1309
+ this.pkg = {
1310
+ name: pkgName || this.services[0].serviceInfo.id || this.services[0].serviceInfo.services[0].name,
1311
+ version: pkgVersion || "1.0.0"
1312
+ };
1313
+ } else {
1314
+ this.pkg = {
1315
+ name: pkgName || "unknown",
1316
+ version: pkgVersion || "1.0.0"
1317
+ };
1318
+ }
1319
+ setImmediate(next);
1320
+ }
1321
+
1322
+ function getFileSize(srcDir, next) {
1323
+ const self = this;
1324
+
1325
+ async.waterfall([
1326
+ _readSizeRecursive.bind(this, srcDir)
1327
+ ], function(err, size) {
1328
+ if (!err && size) {
1329
+ log.verbose("package#getFileSize()", "Installed-Size:", size);
1330
+ self.size = size;
1331
+ }
1332
+ setImmediate(next, err);
1333
+ });
1334
+
1335
+ function _readSizeRecursive(item, next) {
1336
+ fs.lstat(item, function(err, stats) {
1337
+ let total = stats.size;
1338
+
1339
+ if (!err && stats.isDirectory()) {
1340
+ fs.readdir(item, function(error, list) {
1341
+ if (error) {
1342
+ return next(error);
1343
+ }
1344
+
1345
+ async.forEach(list, function(diritem, callback) {
1346
+ _readSizeRecursive(path.join(item, diritem), function(_err, size) {
1347
+ total += size;
1348
+ callback(_err);
1349
+ });
1350
+ }, function(e) {
1351
+ next(e, total);
1352
+ }
1353
+ );
1354
+ });
1355
+ } else {
1356
+ next(err, total);
1357
+ }
1358
+ });
1359
+ }
1360
+ }
1361
+
1362
+ function createDir(dstPath, next) {
1363
+ log.verbose("package#createDir()", "createDir:" + dstPath);
1364
+ mkdirp(dstPath, next);
1365
+ }
1366
+
1367
+ function createDataHash(dstDir, dataTgzPath, next) {
1368
+ const self = this;
1369
+ log.verbose("package#createDataHash()", "Create data hash");
1370
+
1371
+ if (!this.sign) {
1372
+ log.verbose("package#createDataHash()", "App signing skipped");
1373
+ return setImmediate(next);
1374
+ }
1375
+ let signFilePath = path.join(dstDir, "data.tar.gz.sha256.txt");
1376
+ log.verbose("package#createDataHash()", "dataTgzPath : " + dataTgzPath + ", signfile : " + signFilePath);
1377
+
1378
+ let keyPath = path.resolve(this.sign);
1379
+ log.verbose("package#createDataHash()", "keyPath : " + keyPath);
1380
+
1381
+ try {
1382
+ // data.tar.gz can be big size, so it need to use filestream
1383
+ let readStream = fs.createReadStream(dataTgzPath);
1384
+
1385
+ let hasher = crypto.createHash("sha256");
1386
+
1387
+ readStream.on("readable", function() {
1388
+ const data = readStream.read();
1389
+ if (data) {
1390
+ hasher.update(data);
1391
+ }
1392
+ else {
1393
+ self.dataHash = hasher.digest("hex");
1394
+ log.verbose("package#createDataHash()", "Data.tar.gz Hash : " + self.dataHash)
1395
+ setImmediate(next);
1396
+ }
1397
+ });
1398
+ } catch (err) {
1399
+ setImmediate(next, err);
1400
+ }
1401
+ }
1402
+
1403
+ function createCertificateHash(dstDir, next) {
1404
+ const self = this;
1405
+ try {
1406
+ if (!self.certificate) {
1407
+ log.verbose("package#createCertificateHash()", "Including certificate skipped");
1408
+ return setImmediate(next);
1409
+ }
1410
+
1411
+ let crtPath = path.join(dstDir, "certifiate.crt");
1412
+ shelljs.cp("-f", path.resolve(self.certificate), crtPath );
1413
+
1414
+ fs.readFile(crtPath, function (err, certData) {
1415
+ if (err) {
1416
+ setImmediate(next, err);
1417
+ return;
1418
+ }
1419
+
1420
+ // Gets hash from certificate
1421
+ self.certificateHash = crypto.createHash("sha256").update(certData);
1422
+ self.certificateHash = self.certificateHash.digest("hex");
1423
+
1424
+ log.verbose("package#createCertificateHash()", "Certificate Hash : " + self.certificateHash);
1425
+
1426
+ setImmediate(next);
1427
+ });
1428
+ } catch (err) {
1429
+ setImmediate(next, err);
1430
+ }
1431
+ }
1432
+
1433
+ function createControlFile(dstDir, encInfo, next) {
1434
+ const dstFilePath = path.join(dstDir, 'control');
1435
+ log.verbose("package#createControlFile()", "createControlFile:" + dstFilePath);
1436
+
1437
+ const lines = [
1438
+ "Package: " + this.pkg.name,
1439
+ "Version: " + this.pkg.version,
1440
+ "Section: misc",
1441
+ "Priority: optional",
1442
+ "Architecture: " + (this.architecture || "all"),
1443
+ "Installed-Size: " + (this.size || 1234), // TODO: TBC
1444
+ "Maintainer: N/A <nobody@example.com>", // TODO: TBC
1445
+ "Description: This is a webOS application.",
1446
+ "webOS-Package-Format-Version: 2", // TODO: TBC
1447
+ "webOS-Packager-Version: x.y.x" // TODO: TBC
1448
+ ];
1449
+
1450
+ // To IPK security (SEAL)
1451
+ if (this.sign !== null) {
1452
+ lines.push('Application-Hash-Algorithm: SHA-256');
1453
+ lines.push('Application-Hash: ' + this.dataHash);
1454
+ }
1455
+ if (this.certificate !== null) {
1456
+ lines.push('Certificate-Hash: ' + this.certificateHash);
1457
+ lines.push('Signature-Algorithm: RSA');
1458
+ }
1459
+
1460
+ if (encInfo) {
1461
+ lines.push("Encrypt-Algorithm: AES-256-CBC");
1462
+ }
1463
+ lines.push(''); // for the trailing \n
1464
+ fs.writeFile(dstFilePath, lines.join("\n"), next);
1465
+ }
1466
+
1467
+ function createControlSignFile(ctrlDir, next) {
1468
+ try {
1469
+ if (this.sign === null) {
1470
+ log.verbose("package#createControlSignFile()", "App signing is skipped");
1471
+ return setImmediate(next);
1472
+ }
1473
+ let controlFilePath = path.join(ctrlDir, 'control'),
1474
+ controlSignFilePath = path.join(ctrlDir, 'control.sign'),
1475
+ keyPath = path.resolve(this.sign);
1476
+
1477
+ log.verbose("package#createControlSignFile()", "controlFilePath: " + controlFilePath);
1478
+ log.verbose("package#createControlSignFile()", "controlSignFilePath: " + controlSignFilePath);
1479
+ log.verbose("package#createControlSignFile()", "keyPath: " + keyPath);
1480
+
1481
+ let privateKey = fs.readFileSync(keyPath, 'utf-8');
1482
+
1483
+ fs.readFile(controlFilePath, function(err, controlData) {
1484
+ if (err) {
1485
+ setImmediate(next, err);
1486
+ return;
1487
+ }
1488
+
1489
+ // Gets hash from control
1490
+ let controlSigner = crypto.createSign('sha256')
1491
+ controlSigner.update(controlData);
1492
+ controlSigner.end();
1493
+ controlSign = controlSigner.sign(privateKey);
1494
+ let base64data = Buffer.from(controlSign).toString('base64');
1495
+
1496
+ fs.writeFile(controlSignFilePath, base64data, next);
1497
+ });
1498
+ } catch (err) {
1499
+ setImmediate(next, err);
1500
+ }
1501
+ }
1502
+
1503
+ function createDebianBinary(dstDir, next) {
1504
+ const dstFilePath = path.join(dstDir, "debian-binary");
1505
+ log.verbose("package#createDebianBinary()", dstFilePath);
1506
+ fs.writeFile(dstFilePath, "2.0\n", next);
1507
+ }
1508
+
1509
+ function makeTgz(srcDir, dstDir, next) {
1510
+ log.verbose("package#makeTgz()", "makeTgz " + dstDir + " from " + srcDir);
1511
+ const pkgServiceNames = this.pkgServiceNames;
1512
+ // @see https://github.com/isaacs/node-tar/issues/7
1513
+ // it is a workaround for packaged ipk on windows can set +x into directory
1514
+ const fixupDirs = function (filePath, entry) {
1515
+ const fileOrFolderName = filePath.split("/").pop();
1516
+ // opkg does not support Posix Tar fully
1517
+ if (fileOrFolderName.length !== Buffer.byteLength(fileOrFolderName)) {
1518
+ const errMsg = "Please use the file name in english letters. \n\t\t (" + filePath + ")",
1519
+ em = new (require('events').EventEmitter)();
1520
+ em.emit('error', new Error(errMsg));
1521
+ }
1522
+ // Make sure readable directories have execute permission
1523
+ if (entry.isDirectory()) {
1524
+ let maskingBits = 201; // 0311
1525
+ // special case for service directory should have writable permission.
1526
+ if (pkgServiceNames.indexOf(fileOrFolderName) !== -1) {
1527
+ maskingBits = 219; // 0333
1528
+ }
1529
+ entry.mode |= (entry.mode >>> 2) & maskingBits;
1530
+ } else if (entry.isFile()) {
1531
+ // Add other user's readable permission to all files
1532
+ entry.mode |= 4; // 04
1533
+ }
1534
+ if (entry.uid > 0o7777777) {
1535
+ entry.uid = 0;
1536
+ }
1537
+
1538
+ if (entry.gid > 0o7777777) {
1539
+ entry.gid = 0;
1540
+ }
1541
+
1542
+ return true;
1543
+ };
1544
+
1545
+ fs.readdir(srcDir, function (err, fileList) {
1546
+ if (err) setImmediate(next, err);
1547
+ else {
1548
+ tar.c({
1549
+ file: dstDir,
1550
+ gzip: true,
1551
+ cwd: srcDir,
1552
+ filter: fixupDirs
1553
+ }, fileList)
1554
+ .then(() => setImmediate(next))
1555
+ .catch(error => setImmediate(next, error));
1556
+ }
1557
+ });
1558
+ }
1559
+
1560
+ function setIpkFileName(next) {
1561
+ let filename = this.pkg.name;
1562
+ if (this.pkg.version) {
1563
+ // This is asked to replace 'x86' from 'i586' as a file suffix (From NDK)
1564
+ const archSuffix = ('i586' === this.architecture) ? 'x86' : (this.architecture || 'all');
1565
+ filename = filename.concat("_" + this.pkg.version + "_" + archSuffix + ".ipk");
1566
+ } else {
1567
+ filename = filename.concat(".ipk");
1568
+ }
1569
+ this.ipkFileName = filename;
1570
+ this.plainIpkFileName = filename + '_plain';
1571
+ setImmediate(next);
1572
+ }
1573
+
1574
+ function removeExistingIpk(destination, next) {
1575
+ if (this.appCount === 0) {
1576
+ return setImmediate(next);
1577
+ }
1578
+
1579
+ const filename = path.join(destination, this.ipkFileName);
1580
+ fs.exists(filename, function(exists) {
1581
+ if (exists) {
1582
+ fs.unlink(filename, next);
1583
+ } else {
1584
+ setImmediate(next); // Nothing to do
1585
+ }
1586
+ });
1587
+ }
1588
+
1589
+ function padSpace(input, length) {
1590
+ // max field length in ar is 16
1591
+ const ret = String(input + ' ');
1592
+ return ret.slice(0, length);
1593
+ }
1594
+
1595
+ function arFileHeader(name, size) {
1596
+ const epoch = Math.floor(Date.now() / 1000) ;
1597
+ return padSpace(name, 16) +
1598
+ padSpace(epoch, 12) +
1599
+ "0 " + // UID, 6 bytes
1600
+ "0 " + // GID, 6 bytes
1601
+ "100644 " + // file mode, 8 bytes
1602
+ padSpace(size, 10) +
1603
+ "\x60\x0A"; // don't ask
1604
+ }
1605
+
1606
+ function makeIpk(srcDir, next) {
1607
+ this.IpkDir = srcDir;
1608
+ this.ipk = path.join(srcDir, this.ipkFileName);
1609
+ log.info("package#makeIpk()", "makeIpk in dir " + this.IpkDir + " file " + this.ipkFileName);
1610
+
1611
+ if (this.nativecmd) { // TODO: TBR
1612
+ shelljs.cd(this.IpkDir);
1613
+ shelljs.exec("ar -q " + this.ipk + " debian-binary control.tar.gz data.tar.gz", {silent: this.silent});
1614
+
1615
+ setImmediate(next);
1616
+ return;
1617
+ }
1618
+
1619
+ // global header, see http://en.wikipedia.org/wiki/Ar_%28Unix%29
1620
+ const header = "!<arch>\n",
1621
+ debBinary = arFileHeader("debian-binary",4) + "2.0\n",
1622
+ that = this,
1623
+ arStream = CombinedStream.create(),
1624
+ pkgFiles = [ 'control.tar.gz', 'data.tar.gz' ],
1625
+ ipkStream = fstream.Writer(this.ipk);
1626
+
1627
+ arStream.append(header + debBinary);
1628
+ pkgFiles.forEach(function(f) {
1629
+ const fpath = path.join(that.IpkDir, f),
1630
+ s = fstream.Reader({ path: fpath, type: 'File'}),
1631
+ stat = fs.statSync(fpath); // TODO: move to asynchronous processing
1632
+
1633
+ arStream.append(arFileHeader(f, stat.size));
1634
+ arStream.append(s);
1635
+ if ((stat.size % 2) !== 0) {
1636
+ log.verbose("package#makeIpk()", 'adding a filler for file ' + f);
1637
+ arStream.append('\n');
1638
+ }
1639
+ }, this);
1640
+
1641
+ arStream.pipe(ipkStream);
1642
+ ipkStream.on('close', function() {
1643
+ setImmediate(next);
1644
+ });
1645
+ ipkStream.on('error', next);
1646
+ }
1647
+
1648
+ function cleanupTmpDir(middleCb, next) {
1649
+ if (this.noclean) {
1650
+ middleCb("Skipping removal of " + this.tempDir);
1651
+ setImmediate(next);
1652
+ } else {
1653
+ rimraf(this.tempDir, function(err) {
1654
+ log.verbose("package#cleanupTmpDir()", "removed " + this.tempDir);
1655
+ setImmediate(next, err);
1656
+ }.bind(this));
1657
+ }
1658
+ }
1659
+
1660
+ function checkDirectory(options, directory, callback) {
1661
+ log.verbose("package#checkDirectory()", directory);
1662
+ if (fs.existsSync(directory)) { // TODO: move to asynchronous processing
1663
+ const stat = fs.statSync(directory);
1664
+ if (!stat.isDirectory()) {
1665
+ callback(errHndl.getErrMsg("NOT_DIRTYPE_PATH", directory));
1666
+ return;
1667
+ }
1668
+ directory = fs.realpathSync(directory);
1669
+ } else {
1670
+ callback(errHndl.getErrMsg("NOT_EXIST_PATH", directory));
1671
+ return;
1672
+ }
1673
+
1674
+ if (options.force) {
1675
+ return callback();
1676
+ }
1677
+
1678
+ if (fs.existsSync(path.join(directory, "packageinfo.json"))) {
1679
+ return callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_PKGDIR"));
1680
+ }
1681
+
1682
+ if (fs.existsSync(path.join(directory, "appinfo.json"))) {// TODO: move to asynchronous processing
1683
+ this.appCount++;
1684
+ log.verbose("package#checkDirectory()", "FOUND appinfo.json, appCount " + this.appCount);
1685
+
1686
+ if (this.appCount > 1) {
1687
+ callback(errHndl.getErrMsg("OVER_APPCOUNT"));
1688
+ } else if (this.rscCount > 0) {
1689
+ callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_RESOURCE"));
1690
+ } else {
1691
+ this.appDir = directory;
1692
+ this.originAppDir = directory;
1693
+ if (fs.existsSync(path.join(directory, "package.js"))) {
1694
+ this.pkgJSExist = true;
1695
+ }
1696
+ callback();
1697
+ }
1698
+ } else if (fs.existsSync(path.join(directory, "services.json"))) {
1699
+ if (this.rscCount > 0) {
1700
+ callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_RESOURCE"));
1701
+ }
1702
+ this.svcDir = this.svcDir || [];
1703
+ this.svcDir = this.svcDir.concat(directory);
1704
+ callback();
1705
+ } else if (fs.existsSync(path.join(directory, "resourceinfo.json"))) {
1706
+ this.rscCount++;
1707
+ log.verbose("FOUND resourceinfo.json, rscCount " + this.rscCount);
1708
+ if (this.appCount > 0 || this.svcDir && this.svcDir.length > 0) {
1709
+ return callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_RESOURCE"));
1710
+ }
1711
+ this.resources = this.resources || [];
1712
+ const rsc = {};
1713
+ rsc.dir = directory;
1714
+ this.resources = this.resources.concat(rsc);
1715
+ callback();
1716
+ } else if (fs.existsSync(path.join(directory, "account-templates.json"))) {
1717
+ callback(errHndl.getErrMsg("NO_ACCOUNT"));
1718
+ } else {
1719
+ // find service directory recursively
1720
+ const foundSvcDirs = [];
1721
+ this.svcDir = this.svcDir || [];
1722
+ this.svcDir = this.svcDir.concat(directory);
1723
+
1724
+ findServiceDir.call(this, foundSvcDirs, function() {
1725
+ if (foundSvcDirs.length > 0) {
1726
+ if (this.rscCount > 0) {
1727
+ callback(errHndl.getErrMsg("NOT_PACKAGE_WITH_RESOURCE"));
1728
+ }
1729
+ callback();
1730
+ } else {
1731
+ callback(errHndl.getErrMsg("NO_METAFILE", "APP_DIR/SVC_DIR", directory));
1732
+ }
1733
+ });
1734
+ }
1735
+ }
1736
+
1737
+ // find service directories checking if directory has services.json file
1738
+ function findServiceDir(services, next) {
1739
+ const checkDirs = [].concat(this.svcDir || this.originAppDir || []),
1740
+ foundFilePath = [];
1741
+ if (checkDirs.length === 0) {
1742
+ return setImmediate(next);
1743
+ }
1744
+
1745
+ async.forEach(checkDirs, function(checkDir, next) {
1746
+ walkFolder(checkDir, "services.json", foundFilePath, 3, function(err) {
1747
+ if (err) {
1748
+ return setImmediate(next, err);
1749
+ }
1750
+
1751
+ foundFilePath.forEach(function(filePath) {
1752
+ const svc = new Service();
1753
+ svc.srcDir = path.dirname(filePath);
1754
+ svc.dirName = path.basename(svc.srcDir);
1755
+ services.push(svc);
1756
+ });
1757
+ foundFilePath.pop();
1758
+ setImmediate(next, err);
1759
+ });
1760
+ }, function(err) {
1761
+ setImmediate(next, err);
1762
+ });
1763
+ }
1764
+
1765
+ function walkFolder(dirPath, findFileName, foundFilePath, depth, next) {
1766
+ if (depth <= 0) {
1767
+ return next();
1768
+ }
1769
+ async.waterfall([
1770
+ fs.readdir.bind(null, dirPath),
1771
+ function(fileNames, next) {
1772
+ async.forEach(fileNames, function(fileName, next) {
1773
+ const filePath = path.join(dirPath, fileName);
1774
+ async.waterfall([
1775
+ fs.lstat.bind(null, filePath),
1776
+ function(stat, next) {
1777
+ if (stat.isFile()) {
1778
+ if (fileName === findFileName) {
1779
+ foundFilePath.push(filePath);
1780
+ }
1781
+ next();
1782
+ } else if (stat.isDirectory()) {
1783
+ walkFolder(filePath, findFileName, foundFilePath, (depth-1), next);
1784
+ } else {
1785
+ next();
1786
+ }
1787
+ }
1788
+ ], next); // async.waterfall
1789
+ }, next); // async.forEach
1790
+ }
1791
+ ], function(err) {
1792
+ next(err);
1793
+ }); // async.waterfall
1794
+ }
1795
+
1796
+ // read services.json recursivly
1797
+ function loadServiceInfo(next) {
1798
+ for (const idx in this.services) {
1799
+ const filename = path.join(this.services[idx].srcDir, "services.json");
1800
+ try {
1801
+ const data = fs.readFileSync(filename),
1802
+ info = JSON.parse(data);
1803
+ if (!(Object.prototype.hasOwnProperty.call(info, 'id') &&
1804
+ Object.prototype.hasOwnProperty.call(info, 'services'))) {
1805
+ continue;
1806
+ }
1807
+ this.services[idx].serviceInfo = info;
1808
+ this.services[idx].valid = true;
1809
+ } catch (err) {
1810
+ return setImmediate(next, err);
1811
+ }
1812
+ }
1813
+ log.info("package#loadServiceInfo()", "num of serviceInfo: " + this.services.length);
1814
+ setImmediate(next);
1815
+ }
1816
+
1817
+ // check services.json recursivly
1818
+ function checkServiceInfo(next) {
1819
+ const pkgId = this.pkgId || this.appinfo.id,
1820
+ svcIds = [];
1821
+ let errFlag = false;
1822
+
1823
+ this.services.forEach(function(service) {
1824
+ if (service.valid === false) {
1825
+ return;
1826
+ }
1827
+
1828
+ svcIds.push(getPkgServiceNames(service.serviceInfo)[0]);
1829
+ });
1830
+
1831
+ svcIds.forEach(function(svcId) {
1832
+ if (svcId.indexOf(pkgId + ".") !== 0) {
1833
+ errFlag = true;
1834
+ }
1835
+ });
1836
+
1837
+ if (errFlag) {
1838
+ return setImmediate(next, errHndl.getErrMsg("INVALID_SERVICEID", pkgId));
1839
+ }
1840
+ setImmediate(next);
1841
+ }
1842
+
1843
+ // create dir with each service's name under (tmp) + data/usr/palm/services/
1844
+ function createServiceDir(next) {
1845
+ this.services.forEach(function(service) {
1846
+ if (service.valid === false) {
1847
+ return;
1848
+ }
1849
+
1850
+ getPkgServiceNames(service.serviceInfo).forEach(function(serviceName) {
1851
+ const serviceDir = path.join(this.tempDir, "data/usr/palm/services", serviceName);
1852
+ service.dstDirs.push(serviceDir);
1853
+ try {
1854
+ log.info("package#createServiceDir()", "service dir:" + serviceDir);
1855
+ mkdirp.sync(serviceDir);
1856
+ } catch (err) {
1857
+ return setImmediate(next, err);
1858
+ }
1859
+ }.bind(this));
1860
+ }.bind(this));
1861
+ setImmediate(next);
1862
+ }
1863
+
1864
+ // copy service files into each serviceInfos[x].id directory.
1865
+ function copyService(next) {
1866
+ log.info("package#copyService()");
1867
+ const self = this,
1868
+ validServices = this.services.filter(function(service) {
1869
+ return service.valid;
1870
+ });
1871
+ try {
1872
+ async.forEachSeries(validServices, function(service, next) {
1873
+ async.forEach(service.dstDirs, function(dstDir, next) {
1874
+ self.dataCopyCount++;
1875
+ self.minifyDone = !self.minify;
1876
+ copySrcToDst.call(self, service.srcDir, dstDir, next);
1877
+ }, next);
1878
+ }, next);
1879
+ } catch (err) {
1880
+ setImmediate(next, err);
1881
+ }
1882
+ }
1883
+
1884
+ // add service info into packageinfo.json.
1885
+ function addServiceInPkgInfo(next) {
1886
+ if (!this.rom) {
1887
+ const filename = path.join(this.packageDir, "packageinfo.json");
1888
+ let pkginfo, validServiceCount;
1889
+ try {
1890
+ const data = fs.readFileSync(filename);
1891
+ validServiceCount = 0;
1892
+ pkginfo = JSON.parse(data);
1893
+ log.silly("package#addServiceInPkgInfo()", "PACKAGEINFO:", pkginfo);
1894
+ } catch (err) {
1895
+ console.error(err);
1896
+ setImmediate(next, err);
1897
+ }
1898
+ this.services.filter(function(s) {
1899
+ return s.valid;
1900
+ }).forEach(function(service) {
1901
+ getPkgServiceNames(service.serviceInfo).forEach(function(serviceName) {
1902
+ this.pkgServiceNames.push(serviceName);
1903
+ validServiceCount++;
1904
+ }.bind(this));
1905
+ }.bind(this));
1906
+
1907
+ if (validServiceCount > 0) {
1908
+ pkginfo.services = this.pkgServiceNames;
1909
+ const data = JSON.stringify(pkginfo, null, 2) + "\n";
1910
+ log.silly("package#addServiceInPkgInfo()", "Modified package.json:" + data);
1911
+ fs.writeFile(path.join(this.packageDir, "packageinfo.json"), data, next);
1912
+ } else {
1913
+ setImmediate(next);
1914
+ }
1915
+ } else {
1916
+ setImmediate(next);
1917
+ }
1918
+ }
1919
+
1920
+ // remove service dir from tmp source dir before packaging
1921
+ function removeServiceFromAppDir(middleCb, next) {
1922
+ if (this.appCount === 0) {
1923
+ return setImmediate(next);
1924
+ }
1925
+
1926
+ let checkDir = this.applicationDir,
1927
+ needRmCheckDir = false;
1928
+ const fileList = fs.readdirSync(checkDir);
1929
+
1930
+ function _checkDir(dir) {
1931
+ if (this.dirName === dir) {
1932
+ try {
1933
+ const rmDir = path.join(this.applicationDir, this.dirName);
1934
+ shelljs.rm('-rf', rmDir);
1935
+ } catch (err) {
1936
+ next(Error("ERROR" + err), null);
1937
+ }
1938
+ }
1939
+ }
1940
+
1941
+ if (fileList.indexOf('services') !== -1) {
1942
+ checkDir = path.join(this.applicationDir, 'services');
1943
+ const stats = fs.statSync(checkDir);
1944
+ if (stats.isDirectory()) {
1945
+ needRmCheckDir = true;
1946
+ }
1947
+ }
1948
+ if (needRmCheckDir === true) {
1949
+ try {
1950
+ shelljs.rm('-rf', checkDir);
1951
+ } catch (err) {
1952
+ middleCb("ERROR:" + err);
1953
+ }
1954
+ } else {
1955
+ for (const idx in this.services) {
1956
+ this.dirName = this.services[idx].dirName;
1957
+ fileList.forEach(_checkDir, this);
1958
+ }
1959
+ }
1960
+ setImmediate(next);
1961
+ }
1962
+
1963
+ function loadResourceInfo(next) {
1964
+ log.verbose("loadResourceInfo");
1965
+ if (this.rscCount === 0) {
1966
+ return setImmediate(next);
1967
+ }
1968
+
1969
+ this.resources.forEach(function(resource) {
1970
+ const filePath = path.join(resource.dir, "resourceinfo.json");
1971
+ try {
1972
+ const data = fs.readFileSync(filePath),
1973
+ info = JSON.parse(data);
1974
+ resource.info = info;
1975
+ } catch (err) {
1976
+ return setImmediate(next, errHndl.getErrMsg("INVALID_JSON_FORMAT", "resourceinfo.json"));
1977
+ }
1978
+ });
1979
+ log.verbose("num of resourceInfo: " + this.resources.length);
1980
+ setImmediate(next);
1981
+ }
1982
+
1983
+ function checkResourceInfo(next) {
1984
+ log.verbose("checkResourceInfo");
1985
+ const pkgId = this.pkgId;
1986
+
1987
+ this.resources.forEach(function(resource) {
1988
+ if (!resource.info.id) {
1989
+ return setImmediate(next, errHndl.getErrMsg("REQUIRED_FIELD", "id"));
1990
+ } else if (resource.info.id.indexOf(pkgId) !== 0) {
1991
+ return setImmediate(next, errHndl.getErrMsg("INVALID_RESOURCEID", pkgId));
1992
+ } else if (resource.info.id.length < 1 || !(/^[a-z0-9.+-]*$/.test(resource.info.id))) {
1993
+ log.error(errHndl.getErrMsg("INVALID_VALUE", "id", resource.info.id));
1994
+ return setImmediate(next, errHndl.getErrMsg("INVALID_ID_RULE"));
1995
+ }
1996
+ });
1997
+ setImmediate(next);
1998
+ }
1999
+
2000
+ function createResourceDir(next) {
2001
+ log.verbose("createResourceDir");
2002
+ this.resources.forEach(function(resource) {
2003
+ try {
2004
+ const resourceDir = path.join(this.tempDir, "data/usr/palm/resources", resource.info.id);
2005
+ log.verbose("resource dir = " + resourceDir);
2006
+ resource.dstDir = resourceDir;
2007
+ mkdirp.sync(resourceDir);
2008
+ } catch (err) {
2009
+ return setImmediate(next, err);
2010
+ }
2011
+ }.bind(this));
2012
+ log.silly("this.resources:", this.resources);
2013
+ setImmediate(next);
2014
+ }
2015
+
2016
+ function copyResource(next) {
2017
+ log.verbose("copyResource()");
2018
+ if (this.rscCount === 0) {
2019
+ return setImmediate(next);
2020
+ }
2021
+
2022
+ const self = this;
2023
+ try {
2024
+ async.forEachSeries(this.resources, function(resource, next) {
2025
+ self.dataCopyCount++;
2026
+ log.verbose("copyResource(), copy " + resource.dir + " ==> " + resource.dstDir);
2027
+ copySrcToDst.call(self, resource.dir, resource.dstDir, next);
2028
+ }, next);
2029
+ } catch (err) {
2030
+ setImmediate(next, err);
2031
+ }
2032
+ }
2033
+
2034
+ function addResourceInPkgInfo(next) {
2035
+ log.verbose("addResourceInPkgInfo");
2036
+ if (!this.rom && this.rscCount > 0) {
2037
+ const filename = path.join(this.packageDir, "packageinfo.json");
2038
+ let pkginfo, data;
2039
+ try {
2040
+ data = fs.readFileSync(filename);
2041
+ log.verbose("PACKAGEINFO: " + data);
2042
+ pkginfo = JSON.parse(data);
2043
+ } catch (err) {
2044
+ console.error(err);
2045
+ setImmediate(next, err);
2046
+ }
2047
+
2048
+ this.resources.forEach(function(resource) {
2049
+ this.pkgResourceNames.push(resource.info.id);
2050
+ }.bind(this));
2051
+
2052
+ pkginfo.resources = this.pkgResourceNames;
2053
+ data = JSON.stringify(pkginfo, null, 2) + "\n";
2054
+ log.verbose("Modified package.json: " + data);
2055
+ fs.writeFile(path.join(this.packageDir, "packageinfo.json"), data, next);
2056
+ } else {
2057
+ setImmediate(next);
2058
+ }
2059
+ }
2060
+
2061
+ function copyData(inDirs, forceCopy, next) {
2062
+ log.verbose("package#copyData()", "only run when force packaging");
2063
+ if (forceCopy && this.dataCopyCount === 0) {
2064
+ const dst = path.join(this.tempDir, "data");
2065
+ async.forEachSeries(inDirs, function(src, next) {
2066
+ copySrcToDst.call(this, src, dst, next);
2067
+ }, function(err) {
2068
+ setImmediate(next, err);
2069
+ });
2070
+ } else {
2071
+ return setImmediate(next);
2072
+ }
2073
+ }
2074
+
2075
+ function getPkgServiceNames(serviceInfo) {
2076
+ let serviceNames = [];
2077
+ if (servicePkgMethod === "id") {
2078
+ serviceNames = [serviceInfo.id];
2079
+ } else if (serviceInfo.services) {
2080
+ const serviceProps = (serviceInfo.services instanceof Array)
2081
+ ? serviceInfo.services : [serviceInfo.services];
2082
+ serviceNames = serviceProps.map(function(serviceProp) {
2083
+ return serviceProp.name;
2084
+ });
2085
+ }
2086
+ return serviceNames;
2087
+ }
2088
+
2089
+ function setUmask(mask, next) {
2090
+ this.oldmask = process.umask(mask);
2091
+ setImmediate(next);
2092
+ }
2093
+
2094
+ function recoverUmask(next) {
2095
+ if (this.oldmask) {
2096
+ process.umask(this.oldmask);
2097
+ }
2098
+ setImmediate(next);
2099
+ }
2100
+
2101
+ function rewriteFileWoBOMAsUtf8(filePath, rewriteFlag, next) {
2102
+ let data = fs.readFileSync(filePath);
2103
+ const encodingFormat = chardet.detect(Buffer.from(data));
2104
+
2105
+ if (['UTF-8', 'ISO-8895-1'].indexOf(encodingFormat) === -1) {
2106
+ log.silly("package#rewriteFileWoBOMAsUtf8()", "current encoding type:" + encodingFormat);
2107
+ data = encoding.convert(data, "UTF-8", encodingFormat);
2108
+ }
2109
+ data = stripbom(data);
2110
+
2111
+ if (rewriteFlag) {
2112
+ fs.writeFileSync(filePath,
2113
+ data, { encoding: "utf8" }
2114
+ );
2115
+ }
2116
+
2117
+ if (next !== 'undefined' && typeof next === 'function') {
2118
+ setImmediate(next, null, data);
2119
+ }
2120
+ return data;
2121
+ }
2122
+
2123
+ function encryptPackage(next) {
2124
+ if (this.rom || !this.encrypt) { // Do not encrypt when -rom option is given
2125
+ setImmediate(next);
2126
+ return;
2127
+ } else {
2128
+ this.encryptDir = path.join(this.tempDir, "encrypt");
2129
+ const encryptDir = this.encryptDir,
2130
+ encryptCtrlDir = path.join(encryptDir, 'ctrl'),
2131
+ ctrlTgzFile = path.join(encryptDir, 'control.tar.gz'),
2132
+ encryptDataDir = path.join(encryptDir, 'data'),
2133
+ dataTgzFile = path.join(encryptDir, 'data.tar.gz');
2134
+
2135
+ async.series([
2136
+ createDir.bind(this, encryptDir),
2137
+ createDir.bind(this, encryptCtrlDir),
2138
+ createDir.bind(this, encryptDataDir),
2139
+ createkeyIVfile.bind(this, encryptCtrlDir),
2140
+ encryptIpk.bind(this, encryptDataDir),
2141
+ makeTgz.bind(this, encryptDataDir, dataTgzFile),
2142
+ createControlFile.bind(this, encryptCtrlDir, true),
2143
+ makeTgz.bind(this, encryptCtrlDir, ctrlTgzFile),
2144
+ createDebianBinary.bind(this, encryptDir),
2145
+ makeIpk.bind(this, encryptDir)
2146
+ ], function(err) {
2147
+ if (err) {
2148
+ setImmediate(next, err);
2149
+ return;
2150
+ }
2151
+ log.verbose("package#encryptPackage()", "success to encrypt pacakge");
2152
+ setImmediate(next);
2153
+ });
2154
+ }
2155
+ }
2156
+
2157
+ function createkeyIVfile(dstPath, next) {
2158
+ // generate random key& IV
2159
+ this.key = Buffer.from(crypto.randomBytes(32), 'base64');
2160
+ this.iv = Buffer.from(crypto.randomBytes(16), 'base64');
2161
+
2162
+ try {
2163
+ // Read public key
2164
+ const publickeyPath = path.join(__dirname, '../', 'files', 'conf', 'pubkey.pem'),
2165
+ publickey = fs.readFileSync(publickeyPath, 'utf8');
2166
+
2167
+ // Encrypt key, iv by publickey
2168
+ const encryptedKey= crypto.publicEncrypt({
2169
+ key: publickey,
2170
+ padding: 4 /* crypto.constants.RSA_PKCS1_OAEP_PADDING */
2171
+ }, Buffer.from(this.key.toString('base64')));
2172
+
2173
+ const encryptedIV= crypto.publicEncrypt({
2174
+ key: publickey,
2175
+ padding: 4 /* crypto.constants.RSA_PKCS1_OAEP_PADDING */
2176
+ }, Buffer.from(this.iv.toString('base64')));
2177
+
2178
+ const keyFilePath = path.join(dstPath, "key");
2179
+ fs.writeFileSync(keyFilePath, encryptedKey, 'binary');
2180
+
2181
+ // write iv file on encrypt/control
2182
+ const ivFilePath = path.join(dstPath , "iv");
2183
+ fs.writeFileSync(ivFilePath, encryptedIV, 'binary');
2184
+
2185
+ } catch (err) {
2186
+ return setImmediate(next, errHndl.getErrMsg(err));
2187
+ }
2188
+ setImmediate(next);
2189
+ }
2190
+
2191
+ function copyOutputToDst(destination, middleCb, next) {
2192
+ let self = this;
2193
+ // copy data directory to destination
2194
+ if (this.rom) {
2195
+ middleCb("Create output directory to " + destination);
2196
+ copySrcToDst.call(this, path.join(this.tempDir, 'data'), destination, next);
2197
+ } else if (this.encrypt) {
2198
+ // copy encrypted ipk to destination
2199
+ if (this.remainPlainIPK) {
2200
+ log.verbose("Remain Plain IPK file from : " + self.tempDir, self.plainIpkFileName);
2201
+ log.verbose(" to : " + destination);
2202
+ middleCb("Remain Plain IPK file " + self.plainIpkFileName + " to " + destination);
2203
+ copySrcToDst.call(self, path.join(self.tempDir, self.plainIpkFileName), destination, function() {
2204
+ middleCb("Create encrypted " + self.ipkFileName + " to " + destination);
2205
+ copySrcToDst.call(self, path.join(self.encryptDir, self.ipkFileName), destination, next);
2206
+ });
2207
+
2208
+ } else {
2209
+ middleCb("Create encrypted " + this.ipkFileName + " to " + destination);
2210
+ copySrcToDst.call(this, path.join(this.encryptDir, this.ipkFileName), destination, next);
2211
+ }
2212
+ } else {
2213
+ // copy plain ipk to destination
2214
+ let outmsg = "Create ";
2215
+ if (this.sign && this.certificate) {
2216
+ outmsg = outmsg.concat("signed ");
2217
+ }
2218
+ middleCb(outmsg + this.ipkFileName + " to " + destination);
2219
+ copySrcToDst.call(this, path.join(this.tempDir, this.ipkFileName), destination, next);
2220
+ }
2221
+ }
2222
+
2223
+ function encryptIpk(dstPath, next) {
2224
+ log.verbose("package#encryptPackage()#encrypIpk()", "encrypt plain ipk to /encrypt/data");
2225
+ const plainIpkPath = path.join(this.tempDir, this.ipkFileName),
2226
+ encrypedIpkPath = path.join(dstPath, this.ipkFileName);
2227
+
2228
+ let self = this;
2229
+
2230
+ try {
2231
+ const input = fs.createReadStream(plainIpkPath),
2232
+ output = fs.createWriteStream(encrypedIpkPath),
2233
+ cipher = crypto.createCipheriv('aes-256-cbc', this.key, this.iv);
2234
+
2235
+ output.on('close', function() {
2236
+ log.verbose("package#encryptPackage()#encrypIpk()", "encrypted Ipk to " + encrypedIpkPath);
2237
+ if (self.remainPlainIPK === true) {
2238
+ log.verbose("Remain plain IPK file name : " + path.join(plainIpkPath));
2239
+ log.verbose("** to : " + path.join(self.tempDir, self.plainIpkFileName));
2240
+ fs.renameSync(plainIpkPath, path.join(self.tempDir, self.plainIpkFileName));
2241
+ }
2242
+ setImmediate(next);
2243
+ }).
2244
+ on('error', function(err) {
2245
+ setImmediate(next, err);
2246
+ });
2247
+
2248
+ input.pipe(cipher).pipe(output);
2249
+ } catch (err) {
2250
+ setImmediate(next, err);
2251
+ }
2252
+ }
2253
+ }());