mirror of
https://abf.rosa.ru/djam/chromium-browser-stable-test.git
synced 2025-02-23 17:42:45 +00:00
84 lines
2.5 KiB
Bash
84 lines
2.5 KiB
Bash
#!/bin/sh
|
|
|
|
# Chromium launcher
|
|
|
|
# Authors:
|
|
# Fabien Tassin <fta@sofaraway.org>
|
|
# License: GPLv2 or later
|
|
|
|
APPNAME=chrome
|
|
LIBDIR=@LIBDIR@/chromium-browser
|
|
GDB=/usr/bin/gdb
|
|
|
|
usage () {
|
|
echo "$APPNAME [-h|--help] [-g|--debug] [options] [URL]"
|
|
echo
|
|
echo " -g or --debug Start within $GDB"
|
|
echo " -h or --help This help screen"
|
|
}
|
|
|
|
# xdg-settings should in PATH
|
|
PATH=$PATH:$LIBDIR
|
|
export PATH
|
|
|
|
want_debug=0
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
-h | --help | -help )
|
|
usage
|
|
exit 0 ;;
|
|
-g | --debug )
|
|
want_debug=1
|
|
shift ;;
|
|
-- ) # Stop option prcessing
|
|
shift
|
|
break ;;
|
|
* )
|
|
break ;;
|
|
esac
|
|
done
|
|
|
|
# Setup the default profile if this is none
|
|
# Set the default theme as GTK+ with system window decoration
|
|
if [ ! -d ~/.config/chromium/Default ]; then
|
|
mkdir -p ~/.config/chromium/Default
|
|
# cat > instead of cp to e.g. respect umask
|
|
cat "$LIBDIR"/chromium-default-config.json > ~/.config/chromium/Default/Preferences
|
|
fi
|
|
|
|
if [ ! -u $CHROME_SANDBOX ] ; then
|
|
echo "The chrome_sandbox binary does not have the SETUID set.\n"
|
|
echo "This is most likely caused by the permission state (Secure/Paranoid) of the system. Therefore running Chromium is not possible."
|
|
fi
|
|
|
|
# Allow users to override command-line options
|
|
# Based on Gentoo's chromium package (and by extension, Debian's)
|
|
if [ -f /etc/default/chromium-browser ]; then
|
|
. /etc/default/chromium-browser
|
|
fi
|
|
|
|
# Prefer user defined CHROMIUM_USER_FLAGS (from env) over system
|
|
# default CHROMIUM_FLAGS (from /etc/chromium-browser/default)
|
|
CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-$CHROMIUM_FLAGS}
|
|
|
|
if [ $want_debug -eq 1 ] ; then
|
|
if [ ! -x $GDB ] ; then
|
|
echo "Sorry, can't find usable $GDB. Please install it."
|
|
exit 1
|
|
fi
|
|
tmpfile=`mktemp /tmp/chromiumargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; }
|
|
trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
|
|
echo "set args ${1+"$@"}" > $tmpfile
|
|
echo "# Env:"
|
|
echo "# LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
|
|
echo "$GDB $LIBDIR/$APPNAME -x $tmpfile"
|
|
$GDB "$LIBDIR/$APPNAME" -x $tmpfile
|
|
exit $?
|
|
else
|
|
# --disable-features=AudioServiceSandbox makes Chromium use the same policy as Chrome and fixes issues with
|
|
# accessing /run/user/%d/pulse/* on rosa2019.1+
|
|
# services/audio/audio_sandbox_hook_linux.cc in general looks like hackery with hardcoded paths
|
|
# https://bugs.chromium.org/p/chromium/issues/detail?id=1018580
|
|
exec $LIBDIR/$APPNAME $SANDBOX ${CHROMIUM_FLAGS} "--password-store=basic" "--disable-features=AudioServiceSandbox" "$@"
|
|
fi
|
|
|