[Public][DeviceHome] Run on booting time 65/262365/10 accepted/tizen/unified/20210812.131700 submit/tizen/20210812.013703 submit/tizen/20210812.041911
authorYoungsoo Choi <kenshin.choi@samsung.com>
Mon, 9 Aug 2021 06:47:24 +0000 (23:47 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Thu, 12 Aug 2021 00:51:44 +0000 (17:51 -0700)
Device home needs to be run on booting time to handle remote device requests.
To do that, the device home package needs platform level signing.

Also, unused bin folders are removed.

Change-Id: Ibc2c46f35da395034f5ab563888e1dc14719000e
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>
device_home/config.xml
device_home/node_modules/.bin/mime [deleted symlink]
device_home/node_modules/.bin/qrcode [deleted symlink]
device_home/node_modules/ejs/bin/cli.js [deleted file]
device_home/node_modules/jake/bin/cli.js [deleted file]
device_home/node_modules/qrcode/bin/qrcode [deleted file]
packaging/device_home.xml.in [deleted file]
packaging/wrtjs.spec
tizen/build/build_app.sh
tizen/build/build_devicehome.sh [deleted file]

index c1cd2e3..b70a101 100755 (executable)
@@ -12,7 +12,7 @@
     <tizen:privilege name="http://tizen.org/privilege/filesystem.write"/>
     <tizen:privilege name="http://tizen.org/privilege/internet"/>
     <tizen:privilege name="http://tizen.org/privilege/mediastorage"/>
-    <tizen:service id="9z6IujVul3.DeviceHomeService" type="global">
+    <tizen:service id="9z6IujVul3.DeviceHomeService" type="global" auto-restart="true" on-boot="true">
         <tizen:content src="service/service.js"/>
         <tizen:name>DeviceHomeService</tizen:name>
         <tizen:description>DeviceHomeService</tizen:description>
diff --git a/device_home/node_modules/.bin/mime b/device_home/node_modules/.bin/mime
deleted file mode 120000 (symlink)
index fbb7ee0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../mime/cli.js
\ No newline at end of file
diff --git a/device_home/node_modules/.bin/qrcode b/device_home/node_modules/.bin/qrcode
deleted file mode 120000 (symlink)
index aae83f0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../qrcode/bin/qrcode
\ No newline at end of file
diff --git a/device_home/node_modules/ejs/bin/cli.js b/device_home/node_modules/ejs/bin/cli.js
deleted file mode 100755 (executable)
index d297ef3..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-let program=require("jake").program;delete global.jake,program.setTaskNames=function(e){this.taskNames=e};let ejs=require("../lib/ejs"),{hyphenToCamel:hyphenToCamel}=require("../lib/utils"),fs=require("fs"),args=process.argv.slice(2),usage=fs.readFileSync(`${__dirname}/../usage.txt`).toString();const CLI_OPTS=[{full:"output-file",abbr:"o",expectValue:!0},{full:"data-file",abbr:"f",expectValue:!0},{full:"data-input",abbr:"i",expectValue:!0},{full:"delimiter",abbr:"m",expectValue:!0,passThrough:!0},{full:"open-delimiter",abbr:"p",expectValue:!0,passThrough:!0},{full:"close-delimiter",abbr:"c",expectValue:!0,passThrough:!0},{full:"strict",abbr:"s",expectValue:!1,allowValue:!1,passThrough:!0},{full:"no-with",abbr:"n",expectValue:!1,allowValue:!1},{full:"locals-name",abbr:"l",expectValue:!0,passThrough:!0},{full:"rm-whitespace",abbr:"w",expectValue:!1,allowValue:!1,passThrough:!0},{full:"debug",abbr:"d",expectValue:!1,allowValue:!1,passThrough:!0},{full:"help",abbr:"h",passThrough:!0},{full:"version",abbr:"V",passThrough:!0},{full:"version",abbr:"v",passThrough:!0}];let preempts={version:function(){program.die(ejs.VERSION)},help:function(){program.die(usage)}},stdin="";function run(){program.availableOpts=CLI_OPTS,program.parseArgs(args);let e=program.taskNames[0],r=program.envVars,a={};for(let e in program.opts){let r=hyphenToCamel(e);a[r]=program.opts[e]}let l,t={},s={};CLI_OPTS.forEach((e=>{let r=hyphenToCamel(e.full);e.passThrough&&void 0!==a[r]&&(t[r]=a[r])}));for(let e in t)if(preempts[e])return preempts[e]();if(t.views=["."],!e)throw new Error("Please provide a template path. (Run ejs -h for help)");t.strict&&(a.noWith=!0),a.noWith&&(t._with=!1);let o=new Error("Please do not pass data multiple ways. Pick one of stdin, -f, or -i.");if(stdin)l=stdin;else if(a.dataInput){if(l)throw o;l=decodeURIComponent(a.dataInput)}else if(a.dataFile){if(l)throw o;l=fs.readFileSync(a.dataFile).toString()}l&&(s=JSON.parse(l));for(let e in r)s[e]=r[e];let i=fs.readFileSync(e).toString(),p=ejs.render(i,s,t);a.outputFile?fs.writeFileSync(a.outputFile,p):process.stdout.write(p),process.exit()}process.stdin.setEncoding("utf8"),process.stdin.on("readable",(()=>{let e;for(;null!==(e=process.stdin.read());)stdin+=e})),setImmediate(run);
\ No newline at end of file
diff --git a/device_home/node_modules/jake/bin/cli.js b/device_home/node_modules/jake/bin/cli.js
deleted file mode 100755 (executable)
index 01b220a..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-try{require(`${process.cwd()}/node_modules/jake`)}catch(e){require("../lib/jake")}var args=process.argv.slice(2);jake.run.apply(jake,args);
\ No newline at end of file
diff --git a/device_home/node_modules/qrcode/bin/qrcode b/device_home/node_modules/qrcode/bin/qrcode
deleted file mode 100755 (executable)
index 7f1bca1..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/usr/bin/env node
-var yargs = require('yargs')
-var qr = require('../lib')
-
-function save (file, text, options) {
-  qr.toFile(file, text, options, function (err, data) {
-    if (err) {
-      console.error('Error:', err.message)
-      process.exit(1)
-    }
-
-    console.log('saved qrcode to: ' + file + '\n')
-  })
-}
-
-function print (text, options) {
-  options.type = 'terminal'
-  qr.toString(text, options, function (err, text) {
-    if (err) {
-      console.error('Error:', err.message)
-      process.exit(1)
-    }
-
-    console.log(text)
-  })
-}
-
-function parseOptions (args) {
-  return {
-    version: args.qversion,
-    errorCorrectionLevel: args.error,
-    type: args.type,
-    maskPattern: args.mask,
-    margin: args.qzone,
-    width: args.width,
-    scale: args.scale,
-    color: {
-      light: args.lightcolor,
-      dark: args.darkcolor
-    }
-  }
-}
-
-function processInputs (text, opts) {
-  if (!text.length) {
-    yargs.showHelp()
-    process.exit(1)
-  }
-
-  if (opts.output) {
-    save(opts.output, text, parseOptions(opts))
-  } else {
-    print(text, parseOptions(opts))
-  }
-}
-
-var argv = yargs
-  .detectLocale(false)
-  .usage('Usage: $0 [options] <input string>')
-  .option('v', {
-    alias: 'qversion',
-    description: 'QR Code symbol version (1 - 40)',
-    group: 'QR Code options:',
-    type: 'number'
-  })
-  .option('e', {
-    alias: 'error',
-    description: 'Error correction level',
-    choices: ['L', 'M', 'Q', 'H'],
-    group: 'QR Code options:'
-  })
-  .option('m', {
-    alias: 'mask',
-    description: 'Mask pattern (0 - 7)',
-    group: 'QR Code options:',
-    type: 'number'
-  })
-  .option('t', {
-    alias: 'type',
-    description: 'Output type',
-    choices: ['png', 'svg', 'utf8'],
-    implies: 'output',
-    group: 'Renderer options:'
-  })
-  .option('w', {
-    alias: 'width',
-    description: 'Image width (px)',
-    conflicts: 'scale',
-    group: 'Renderer options:',
-    type: 'number'
-  })
-  .option('s', {
-    alias: 'scale',
-    description: 'Scale factor',
-    conflicts: 'width',
-    group: 'Renderer options:',
-    type: 'number'
-  })
-  .option('q', {
-    alias: 'qzone',
-    description: 'Quiet zone size',
-    group: 'Renderer options:',
-    type: 'number'
-  })
-  .option('l', {
-    alias: 'lightcolor',
-    description: 'Light RGBA hex color',
-    group: 'Renderer options:'
-  })
-  .option('d', {
-    alias: 'darkcolor',
-    description: 'Dark RGBA hex color',
-    group: 'Renderer options:'
-  })
-  .option('o', {
-    alias: 'output',
-    description: 'Output file'
-  })
-  .help('h')
-  .alias('h', 'help')
-  .version()
-  .example('$0 "some text"', 'Draw in terminal window')
-  .example('$0 -o out.png "some text"', 'Save as png image')
-  .example('$0 -d F00 -o out.png "some text"', 'Use red as foreground color')
-  .parserConfiguration({'parse-numbers': false})
-  .argv
-
-if (process.stdin.isTTY) {
-  processInputs(argv._.join(' '), argv)
-} else {
-  var text = ''
-  process.stdin.setEncoding('utf8')
-  process.stdin.on('readable', function () {
-    var chunk = process.stdin.read()
-    if (chunk !== null) {
-      text += chunk
-    }
-  })
-
-  process.stdin.on('end', function () {
-    // this process can be run as a command outside of a tty so if there was no
-    // data on stdin read from argv
-    processInputs(text.length?text:argv._.join(' '), argv)
-  })
-}
diff --git a/packaging/device_home.xml.in b/packaging/device_home.xml.in
deleted file mode 100644 (file)
index 9d34703..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="@PACKAGE_ID@" type="wgt" version="@WRTJS_VERSION@" api-version="@TIZEN_VERSION@" nodisplay-setting="false" readonly="true" preload="true">
-  <label>D2DGlobalService</label>
-  <author/>
-  <ui-application appid="@PACKAGE_ID@.DeviceHomeService" exec="/usr/apps/@PACKAGE_ID@/bin/@PACKAGE_ID@.DeviceHomeService" type="capp" taskmanage="false" nodisplay="true" multiple="false">
-    <label>DeviceHomeService</label>
-  </ui-application>
-  <ui-application appid="@PACKAGE_ID@.SignalingService" exec="/usr/apps/@PACKAGE_ID@/bin/@PACKAGE_ID@.SignalingService" type="capp" taskmanage="false" nodisplay="true" multiple="false">
-    <label>SignalingService</label>
-  </ui-application>
-  <privileges>
-    <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
-  </privileges>
-</manifest>
index ad8b24b..0520f15 100755 (executable)
@@ -161,7 +161,7 @@ cp -r %{app_dir}/* %{buildroot}%{_resourcedir}/
   touch debugsources.list
   %define _tpk_file_name %{__pkgid}-%{version}-v%{tizen_version_major}.%{tizen_version_minor}.%{repo_name}.%{ARCHITECTURE}.tpk
   %define __tpk_install_post \
-      tizen/build/build_app.sh %{GENERATED_APP_DIR} wrtjs_tpk_root %{_tpk_file_name} tpk %{?profile}
+      tizen/build/build_app.sh %{GENERATED_APP_DIR} wrtjs_tpk_root %{_tpk_file_name} tpk platform %{?profile}
   %define __spec_install_post \
       %{?__tpk_install_post} \
       %{nil}
@@ -173,7 +173,11 @@ cp -r %{app_dir}/* %{buildroot}%{_resourcedir}/
   %define _d2d_wgt_file_name device_home.wgt
   install -m 0644 key.pem device_home/signaling_server/gen/
   install -m 0644 cert.pem device_home/signaling_server/gen/
-  tizen/build/build_devicehome.sh device_home/ %{buildroot} %{_d2d_wgt_file_name}
+  %if "%{?profile}" == "tv"
+    tizen/build/build_app.sh %{buildroot} device_home %{_d2d_wgt_file_name} wgt public %{?profile}
+  %else
+    tizen/build/build_app.sh %{buildroot} device_home %{_d2d_wgt_file_name} wgt platform %{?profile}
+  %endif
 
   install -d %{buildroot}%{_appdir}/.preload-rw-wgt/
   install -m 0644 %{buildroot}/%{_d2d_wgt_file_name} %{buildroot}%{_appdir}/.preload-rw-wgt/
index 950972c..76cb1d5 100755 (executable)
@@ -5,7 +5,8 @@ source_dir_name=${2}
 source_path=${output_path}/${source_dir_name}
 file_name=${3}
 file_extension=${4}
-profile=${5}
+privilege=${5}
+profile=${6}
 
 echo "Start $0..."
 echo "ARGS=$@"
@@ -13,6 +14,7 @@ echo "PWD=$PWD"
 echo "output_path=$output_path"
 echo "source_path=$source_path"
 echo "file_name=$file_name"
+echo "privilege=$privilege"
 echo "profile=$profile"
 
 if [ "${file_extension}" == "tpk" ]; then
@@ -23,25 +25,28 @@ if [ "${file_extension}" == "tpk" ]; then
   install -m 0644 packaging/tizen-manifest-tpk.xml ${source_path}/tizen-manifest.xml
   install -m 0644 LICENSE ${source_path}/license
   cp -rf out/gen/app ${source_path}/shared/res/wrt/app
+elif [ "${file_extension}" == "wgt" ]; then
+  # DeviceHome
+  cp -rf device_home ${source_path}
 else
   echo "Please add proper file extension."
   exit 1
 fi
 
 # Test signing
-/usr/bin/hash-signer.sh -a -d -p platform -b ${output_path} ${source_dir_name}
+/usr/bin/hash-signer.sh -a -d -p ${privilege} -b ${output_path} ${source_dir_name}
 
 pushd ${source_path}
 echo "* zip"
-zip -yr $file_name *
+zip -yr $file_name .
 mv $file_name ../
 popd
 
 # tpkresigning from app-signer package
-if [ "${profile}" == "tv" ]; then
-  tpkresigner -a -d -p platform -n %{4}  ${output_path}/${file_name}
+if [ "${profile}" == "tv" -a "${privilege}" != "public" ]; then
+  tpkresigner -a -d -p ${privilege} -n %{4} ${output_path}/${file_name}
 fi
 ls ${output_path}
 rm -rf ${source_path}
 
-echo "Finished $0"
+echo "Finished $0 $@"
diff --git a/tizen/build/build_devicehome.sh b/tizen/build/build_devicehome.sh
deleted file mode 100755 (executable)
index ef6aa8d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-device_home_root=$1
-build_root=$2
-wgt_file_name=$3
-
-# This should be 'public' level with hash-signer
-/usr/bin/hash-signer.sh -a -d -b . ${device_home_root}
-
-cd ${device_home_root}
-zip -rq ${build_root}/${wgt_file_name} .