All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trevor Woerner <twoerner@gmail.com>
To: openembedded-devel@lists.openembedded.org
Cc: Otavio Salvador <otavio@ossystems.com.br>
Subject: [meta-browser][PATCH 2/3] chromium: update run script for early run
Date: Tue,  5 Jan 2016 16:15:41 -0500	[thread overview]
Message-ID: <1452028543-30812-2-git-send-email-twoerner@gmail.com> (raw)
In-Reply-To: <1452028543-30812-1-git-send-email-twoerner@gmail.com>

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@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



  reply	other threads:[~2016-01-05 21:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05 21:15 [meta-browser][PATCH 1/3] chromium_40.0.2214.91: API keys update Trevor Woerner
2016-01-05 21:15 ` Trevor Woerner [this message]
2016-01-06 12:07   ` [meta-browser][PATCH 2/3] chromium: update run script for early run Koen Kooi
2016-01-06 14:44     ` Trevor Woerner
2016-01-05 21:15 ` [meta-browser][PATCH 3/3] chromium: add kiosk-mode PACKAGECONFIG Trevor Woerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452028543-30812-2-git-send-email-twoerner@gmail.com \
    --to=twoerner@gmail.com \
    --cc=openembedded-devel@lists.openembedded.org \
    --cc=otavio@ossystems.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.