|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
3 |
| -# Sanitize risky env variables |
4 |
| -export PATH="/usr/bin:/bin" |
5 |
| -export LD_PRELOAD="" |
6 |
| -export LD_LIBRARY_PATH="" |
7 |
| -export LD_AUDIT="" |
8 |
| -export LD_PROFILE="" |
| 3 | +# Sanitize & protect risky variables |
| 4 | +readonly HOME="$HOME" |
| 5 | +readonly PATH="/usr/bin:/bin" |
| 6 | +readonly LD_PRELOAD="" |
| 7 | +readonly LD_LIBRARY_PATH="" |
| 8 | +readonly LD_AUDIT="" |
| 9 | +readonly LD_PROFILE="" |
9 | 10 |
|
10 | 11 | # unify branding
|
11 |
| -export CHROMIUM_NAME="@@CHROMIUM_NAME@@" |
| 12 | +readonly CHROMIUM_NAME="@@CHROMIUM_NAME@@" |
12 | 13 |
|
13 | 14 | # Let the wrapped binary know that it has been run through the wrapper.
|
14 |
| -export CHROME_WRAPPER="`readlink -f "$0"`" |
| 15 | +readonly CHROME_WRAPPER="`readlink -f "$0"`" |
| 16 | +readonly HERE="`dirname "$CHROME_WRAPPER"`" |
15 | 17 |
|
16 |
| -HERE="`dirname "$CHROME_WRAPPER"`" |
17 |
| - |
18 |
| -# We include some xdg utilities next to the binary, and we want to prefer them |
19 |
| -# over the system versions when we know the system versions are very old. We |
20 |
| -# detect whether the system xdg utilities are sufficiently new to be likely to |
21 |
| -# work for us by looking for xdg-settings. If we find it, we leave $PATH alone, |
22 |
| -# so that the system xdg utilities (including any distro patches) will be used. |
23 |
| -if ! which xdg-settings &> /dev/null; then |
24 |
| - # Old xdg utilities. Prepend $HERE to $PATH to use ours instead. |
25 |
| - export PATH="$HERE:$PATH" |
26 |
| -else |
27 |
| - # Use system xdg utilities. But first create mimeapps.list if it doesn't |
28 |
| - # exist; some systems have bugs in xdg-mime that make it fail without it. |
29 |
| - xdg_app_dir="${XDG_DATA_HOME:-$HOME/.local/share/applications}" |
30 |
| - mkdir -p "$xdg_app_dir" |
31 |
| - [ -f "$xdg_app_dir/mimeapps.list" ] || touch "$xdg_app_dir/mimeapps.list" |
32 |
| -fi |
| 18 | +# obtain chromium flags from system file |
| 19 | +[[ -f /etc/$CHROMIUM_NAME/$CHROMIUM_NAME.conf ]] && . /etc/$CHROMIUM_NAME/$CHROMIUM_NAME.conf |
| 20 | +readonly CHROMIUM_FLAGS="$CHROMIUM_FLAGS" |
33 | 21 |
|
34 | 22 | export CHROME_VERSION_EXTRA="Built from source for @@BUILD_TARGET@@"
|
35 | 23 |
|
36 | 24 | # We don't want bug-buddy intercepting our crashes. http://crbug.com/24120
|
37 | 25 | export GNOME_DISABLE_CRASH_DIALOG=SET_BY_GOOGLE_CHROME
|
38 | 26 |
|
39 |
| -# Allow users to override command-line options and prefer user defined |
40 |
| -# CHROMIUM_USER_FLAGS from env over system wide CHROMIUM_FLAGS |
41 |
| -[[ -f /etc/$CHROMIUM_NAME/$CHROMIUM_NAME.conf ]] && . /etc/$CHROMIUM_NAME/$CHROMIUM_NAME.conf |
42 |
| -CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-$CHROMIUM_FLAGS} |
| 27 | +# desktop integration |
| 28 | +xdg_app_dir="${XDG_DATA_HOME:-$HOME/.local/share/applications}" |
| 29 | +mkdir -p "$xdg_app_dir" |
| 30 | +[ -f "$xdg_app_dir/mimeapps.list" ] || touch "$xdg_app_dir/mimeapps.list" |
43 | 31 |
|
44 | 32 | # handle migration from the old directory
|
45 | 33 | # the migration file just tells this wrapper not to copy over data
|
|
0 commit comments