From: Youngsoo Choi Date: Mon, 9 Aug 2021 06:47:24 +0000 (-0700) Subject: [Public][DeviceHome] Run on booting time X-Git-Tag: submit/tizen/20210812.013703^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1db8702a4d338bc387806806c3971cb703304ac5;p=platform%2Fframework%2Fweb%2Fwrtjs.git [Public][DeviceHome] Run on booting time 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 --- diff --git a/device_home/config.xml b/device_home/config.xml index c1cd2e37..b70a1015 100755 --- a/device_home/config.xml +++ b/device_home/config.xml @@ -12,7 +12,7 @@ - + DeviceHomeService DeviceHomeService diff --git a/device_home/node_modules/.bin/mime b/device_home/node_modules/.bin/mime deleted file mode 120000 index fbb7ee0e..00000000 --- a/device_home/node_modules/.bin/mime +++ /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 index aae83f03..00000000 --- a/device_home/node_modules/.bin/qrcode +++ /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 index d297ef3a..00000000 --- a/device_home/node_modules/ejs/bin/cli.js +++ /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 index 01b220a7..00000000 --- a/device_home/node_modules/jake/bin/cli.js +++ /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 index 7f1bca11..00000000 --- a/device_home/node_modules/qrcode/bin/qrcode +++ /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] ') - .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 index 9d34703f..00000000 --- a/packaging/device_home.xml.in +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - http://tizen.org/privilege/appmanager.launch - - diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index ad8b24b4..0520f15a 100755 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -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/ diff --git a/tizen/build/build_app.sh b/tizen/build/build_app.sh index 950972cd..76cb1d55 100755 --- a/tizen/build/build_app.sh +++ b/tizen/build/build_app.sh @@ -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 index ef6aa8d0..00000000 --- a/tizen/build/build_devicehome.sh +++ /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} .