diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-01-30 04:18:30 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-01-30 04:18:30 +0000 |
commit | 5b5371f1d1fb1555c42eff7f69736d789677da28 (patch) | |
tree | f360094312a5be2113b54ef0e8605d6d2347edc3 /www-client/ungoogled-chromium/files/chromium-launcher.sh | |
parent | 57e786aa1e103c8c3641a35c3316dedc4cbe6e08 (diff) |
www-client/ungoogled-chromium : new package
Diffstat (limited to 'www-client/ungoogled-chromium/files/chromium-launcher.sh')
-rw-r--r-- | www-client/ungoogled-chromium/files/chromium-launcher.sh | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/www-client/ungoogled-chromium/files/chromium-launcher.sh b/www-client/ungoogled-chromium/files/chromium-launcher.sh new file mode 100644 index 00000000..1163ff3d --- /dev/null +++ b/www-client/ungoogled-chromium/files/chromium-launcher.sh @@ -0,0 +1,59 @@ +#!/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/*; do + [[ -f ${f} ]] && source "${f}" +done + +# Prefer user defined CHROMIUM_USER_FLAGS (from env) over system +# default CHROMIUM_FLAGS (from /etc/chromium/default). +CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_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_FLAGS="--user-data-dir=${XDG_CONFIG_HOME:-${HOME}/.config}/chromium + ${CHROMIUM_FLAGS}" +fi + +# Select session type and platform +if @@OZONE_AUTO_SESSION@@; then + platform= + if [[ ${XDG_SESSION_TYPE} == x11 ]]; then + platform=x11 + elif [[ ${XDG_SESSION_TYPE} == wayland ]]; then + platform=wayland + else + if [[ -n ${WAYLAND_DISPLAY} ]]; then + platform=wayland + else + platform=x11 + fi + fi + if ${DISABLE_OZONE_PLATFORM:-false}; then + platform=x11 + fi + CHROMIUM_FLAGS="--ozone-platform=${platform} ${CHROMIUM_FLAGS}" +fi + +# Set the .desktop file name +export CHROME_DESKTOP="chromium-browser-chromium.desktop" + +exec -a "chromium-browser" "$PROGDIR/chrome" --extra-plugin-dir=/usr/lib/nsbrowser/plugins ${CHROMIUM_FLAGS} "$@" |