From 49722fef4431ca5ad7a5eef474b87036c0ddd94e Mon Sep 17 00:00:00 2001 From: Sanghyup Lee Date: Wed, 8 Nov 2017 11:38:16 +0900 Subject: [PATCH] [Tizen] Fix file permission error Owner account can't write in current resource path. This patch fixes resource path. - From: /usr/apps/org.tizen.electron-efl/bin/resources/wrt_release - To: /opt/usr/home/owner/data/electron Change-Id: Ia0a8795033545489981c0663349aea4b64d49591 Signed-off-by: Sanghyup Lee Signed-off-by: Youngsoo Choi --- atom/common/node_bindings.cc | 4 ++++ packaging/electron-efl.spec | 31 ++++++++++++++++++++++--------- wrt/build/script/run_was_tizen.sh | 2 +- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index 6017e3d..4c8e82f 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -82,6 +82,10 @@ std::unique_ptr StringVectorToArgArray( } base::FilePath GetResourcesPath(bool is_browser) { +#if defined(OS_TIZEN) + // TODO: We should fix hardcoded path. + return base::FilePath("/opt/usr/home/owner/data/electron"); +#endif auto command_line = base::CommandLine::ForCurrentProcess(); base::FilePath exec_path(command_line->GetProgram()); PathService::Get(base::FILE_EXE, &exec_path); diff --git a/packaging/electron-efl.spec b/packaging/electron-efl.spec index 03b830b..67048f0 100755 --- a/packaging/electron-efl.spec +++ b/packaging/electron-efl.spec @@ -75,23 +75,36 @@ sed -e 's#@VERSION@#%{tizen_version_major}.%{tizen_version_minor}#g' \ > %{_out}/packaging/%{_pkgid}.xml install -m 0644 %{_out}/packaging/%{_pkgid}.xml %{buildroot}%{_xmldir} -mkdir -p %{buildroot}/usr/apps/org.tizen.electron-efl/bin/resources/wrt_release +mkdir -p %{buildroot}/usr/apps/org.tizen.electron-efl/bin/ install -d %{buildroot}/%{_icondir} install -d %{buildroot}/%{_libdir} install -m 0644 packaging/%{_pkgid}.png %{buildroot}/%{_icondir} install -m 0755 %{_out}/libnode.so %{buildroot}/%{_libdir} install -m 0755 %{_out}/electron %{buildroot}/usr/apps/org.tizen.electron-efl/bin install -m 0755 wrt/build/script/run_was_tizen.sh %{buildroot}/usr/apps/org.tizen.electron-efl/bin -install -m 0755 %{_out}/resources/default_app.asar %{buildroot}/usr/apps/org.tizen.electron-efl/bin/resources -install -m 0755 %{_out}/resources/electron.asar %{buildroot}/usr/apps/org.tizen.electron-efl/bin/resources -cp -rf wrt/wrt_support %{buildroot}/usr/apps/org.tizen.electron-efl/bin/resources -cp -rf wrt/node_modules %{buildroot}/usr/apps/org.tizen.electron-efl/bin/resources -cp -rf wrt/package.json wrt/src/ wrt/static %{buildroot}/usr/apps/org.tizen.electron-efl/bin/resources/wrt_release +# install resource. +mkdir -p %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl/wrt_release +install -m 0755 %{_out}/resources/default_app.asar %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl +install -m 0755 %{_out}/resources/electron.asar %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl + +cp -rf wrt/wrt_support %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl +cp -rf wrt/node_modules %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl +cp -rf wrt/package.json wrt/src/ wrt/static %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl/wrt_release ./wrt/build/node_modules/grunt-electron-installer/node_modules/asar/bin/asar p \ - %{buildroot}/usr/apps/org.tizen.electron-efl/bin/resources/wrt_release %{_out}/resources/app.asar -install -m 0755 %{_out}/resources/app.asar %{buildroot}/usr/apps/org.tizen.electron-efl/bin/resources + %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl/wrt_release %{_out}/resources/app.asar +install -m 0755 %{_out}/resources/app.asar %{buildroot}/opt/usr/home/owner/data/org.tizen.electron-efl + +%post +# Owner account can't write /opt/usr/home/owner/data/org.tizen.electron-efl +# which is created in 'install'. So we should copy resources in 'post'. +cp -rf /opt/usr/home/owner/data/org.tizen.electron-efl /opt/usr/home/owner/data/electron +chown -R owner:users /opt/usr/home/owner/data/electron +rm -rf /opt/usr/home/owner/data/org.tizen.electron-efl + +%postun +rm -rf /opt/usr/home/owner/data/electron %clean rm -fr %{buildroot} @@ -100,7 +113,7 @@ rm -fr %{buildroot} %manifest packaging/electron-efl.manifest /usr/apps/org.tizen.electron-efl/bin/electron /usr/apps/org.tizen.electron-efl/bin/run_was_tizen.sh -/usr/apps/org.tizen.electron-efl/bin/resources/* +/opt/usr/home/owner/data/org.tizen.electron-efl/* %{_icondir}/%{_pkgid}.png %{_libdir}/libnode.so %{_xmldir}/%{_pkgid}.xml diff --git a/wrt/build/script/run_was_tizen.sh b/wrt/build/script/run_was_tizen.sh index 76ab74c..d20d131 100755 --- a/wrt/build/script/run_was_tizen.sh +++ b/wrt/build/script/run_was_tizen.sh @@ -2,7 +2,7 @@ ##value export SCRIPTDIR=$(readlink -e $(dirname $0)) -export WAS_HOME=$SCRIPTDIR/resources/wrt_support +export WAS_HOME=/opt/usr/home/owner/data/electron/wrt_support # we use this npm module for debugging # https://github.com/visionmedia/debug -- 2.7.4