[oe] [meta-browser][PATCH 2/3] chromium: update run script for early run

Trevor Woerner twoerner at gmail.com
Tue Jan 5 21:15:41 UTC 2016


If the chromium run-helper script (google-chrome) is run as part of a
(sysvinit) init script, shell variables $USER and $HOME will not be set
(leading to unwanted behaviour).

Replace the use of $USER with `whoami` and replace the use of $HOME with the
OE bitbake variable ROOT_HOME.

In this way the chromium run-helper script will work as expected in both
instances (as part of an init script and from the cmdline).

Signed-off-by: Trevor Woerner <twoerner at gmail.com>
---
 recipes-browser/chromium/chromium/google-chrome   | 4 ++--
 recipes-browser/chromium/chromium_40.0.2214.91.bb | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/recipes-browser/chromium/chromium/google-chrome b/recipes-browser/chromium/chromium/google-chrome
index b1ec288..b5c2541 100644
--- a/recipes-browser/chromium/chromium/google-chrome
+++ b/recipes-browser/chromium/chromium/google-chrome
@@ -4,8 +4,8 @@ export CHROME_DEVEL_SANDBOX=/usr/sbin/chrome-devel-sandbox
 export LD_LIBRARY_PATH=/usr/lib/chromium
 
 CHROME_EXTRA_ARGS=""
-if [ "${USER}" = "root" ] ; then
-	CHROME_EXTRA_ARGS="${CHROME_EXTRA_ARGS} --user-data-dir=${HOME}/.chromium/"
+if [ "`whoami`" = "root" ] ; then
+	CHROME_EXTRA_ARGS="${CHROME_EXTRA_ARGS} --user-data-dir=ROOT_HOME/.chromium/"
 fi
 
 /usr/bin/chromium/chrome ${CHROME_EXTRA_ARGS} $@
diff --git a/recipes-browser/chromium/chromium_40.0.2214.91.bb b/recipes-browser/chromium/chromium_40.0.2214.91.bb
index 6fddcc7..e138628 100644
--- a/recipes-browser/chromium/chromium_40.0.2214.91.bb
+++ b/recipes-browser/chromium/chromium_40.0.2214.91.bb
@@ -221,6 +221,9 @@ do_install_append() {
         # the dummy "CHROME_EXTRA_ARGS" line
         sed -i "s/^CHROME_EXTRA_ARGS=\"\"/CHROME_EXTRA_ARGS=\"${CHROMIUM_EXTRA_ARGS}\"/" ${D}${bindir}/google-chrome
 
+        # update ROOT_HOME with the root user's $HOME
+        sed -i "s#ROOT_HOME#${ROOT_HOME}#" ${D}${bindir}/google-chrome
+
 	# Always adding this libdir (not just with component builds), because the
         # LD_LIBRARY_PATH line in the google-chromium script refers to it
         install -d ${D}${libdir}/${BPN}/
-- 
2.7.0.rc3




More information about the Openembedded-devel mailing list