-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(chromium): Add launcher for passing startup env vars
Allows passing startup vars to Chromium via CHROMIUM_USER_FLAGS Signed-off-by: RJ Sampson <[email protected]>
- Loading branch information
Showing
3 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
|
||
for f in /etc/chromium/*.conf; do | ||
[ -f "$f" ] && . "$f" | ||
done | ||
|
||
# Append CHROMIUM_USER_FLAGS (from env) on top of system | ||
# default CHROMIUM_FLAGS (from /etc/chromium/chromium.conf). | ||
CHROMIUM_FLAGS="$CHROMIUM_FLAGS ${CHROMIUM_USER_FLAGS:+"$CHROMIUM_USER_FLAGS"}" | ||
|
||
# Let the wrapped binary know that it has been run through the wrapper | ||
export CHROME_WRAPPER="$(readlink -f "$0")" | ||
|
||
PROGDIR=${CHROME_WRAPPER%/*} | ||
|
||
case ":$PATH:" in | ||
*:$PROGDIR:*) | ||
# $PATH already contains $PROGDIR | ||
;; | ||
*) | ||
# Append $PROGDIR to $PATH | ||
export PATH="$PATH:$PROGDIR" | ||
;; | ||
esac | ||
|
||
if [ $(id -u) -eq 0 ] && [ $(stat -c %u -L ${XDG_CONFIG_HOME:-${HOME}}) -eq 0 ]; then | ||
# Running as root with HOME owned by root. | ||
# Pass --user-data-dir to work around upstream failsafe. | ||
CHROMIUM_FLAGS="--user-data-dir=${XDG_CONFIG_HOME:-"$HOME"/.config}/chromium $CHROMIUM_FLAGS" | ||
fi | ||
|
||
exec "$PROGDIR/chromium" ${CHROMIUM_FLAGS} "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters