summaryrefslogtreecommitdiff
path: root/www-client/chromium-bin/files/chromium-bin-launcher.sh
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-04-16 13:07:24 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-04-16 13:07:24 +0100
commit0c100b7dd2b30e75b799d806df4ef899fd98e1ea (patch)
tree464c922e949c7e4d5d891fb2cdda5daee5612537 /www-client/chromium-bin/files/chromium-bin-launcher.sh
parente68d405c5d712af4387159df07e226217bdda049 (diff)
gentoo resync : 16.04.2022
Diffstat (limited to 'www-client/chromium-bin/files/chromium-bin-launcher.sh')
-rw-r--r--www-client/chromium-bin/files/chromium-bin-launcher.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/www-client/chromium-bin/files/chromium-bin-launcher.sh b/www-client/chromium-bin/files/chromium-bin-launcher.sh
new file mode 100644
index 000000000000..3e9283df2e29
--- /dev/null
+++ b/www-client/chromium-bin/files/chromium-bin-launcher.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# Allow the user to override command-line flags, bug #357629.
+# This is based on Debian's chromium-browser package, and is intended
+# to be consistent with Debian.
+for f in /etc/chromium-bin/*; do
+ [[ -f ${f} ]] && source "${f}"
+done
+
+# Prefer user defined CHROMIUM_BIN_USER_FLAGS (from env) over system
+# default CHROMIUM_BIN_FLAGS (from /etc/chromium-bin/default).
+CHROMIUM_BIN_FLAGS=${CHROMIUM_BIN_USER_FLAGS:-"$CHROMIUM_BIN_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 [[ ${EUID} == 0 && -O ${XDG_CONFIG_HOME:-${HOME}} ]]; then
+ # Running as root with HOME owned by root.
+ # Pass --user-data-dir to work around upstream failsafe.
+ CHROMIUM_BIN_FLAGS="--user-data-dir=${XDG_CONFIG_HOME:-${HOME}/.config}/chromium
+ ${CHROMIUM_BIN_FLAGS}"
+fi
+
+# Set the .desktop file name
+export CHROME_DESKTOP="chromium-bin-browser-chromium.desktop"
+
+exec -a "chromium-bin-browser" "$PROGDIR/chrome" --extra-plugin-dir=/usr/lib/nsbrowser/plugins ${CHROMIUM_BIN_FLAGS} "$@"