1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
#!/bin/bash
# Chromium launcher
# Authors:
# Chad Miller <chad.miller@canonical.com>
# Fabien Tassin <fta@sofaraway.org>
# License: GPLv2 or later
PLUGIN_PARAMETERS=""
discover_registration () {
local FILE_NAME
local PLUGIN_NAME
local VERSION
local VISIBLE_VERSION
local DESCRIPTION
local MIME_TYPES
registration_file=$1
option_prefix=$2
test -f "${registration_file}" || return 1
. "${registration_file}"
test "$VERSION" || return 2
test "$FILE_NAME" || return 3
echo "$PLUGIN_PARAMETERS" |grep -- "--${option_prefix}-path=" >/dev/null && return 4
PLUGIN_PARAMETERS="--${option_prefix}-path=${FILE_NAME} --${option_prefix}-version=${VERSION%%-*} ${PLUGIN_PARAMETERS}"
return 0
}
# Explicitly set the PATH to that of ENV_SUPATH in /etc/login.defs and unset
# various other variables. (LP: #1045986). This can be removed once AppArmor
# supports environment filtering (LP: #1045985)
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export ENV=
export BASH_ENV=
export CDPATH=
export GLOBIGNORE=
export BASH_XTRACEFD=
if grep -E -w ^Features\\s\*:.\*neon /proc/cpuinfo >/dev/null; then
export CPU_FEATURE_NEON=1
fi
if grep -E -w ^flags\\s\*:.\*sse /proc/cpuinfo >/dev/null; then
export CPU_FEATURE_SSE=1
fi
export CPU_FEATURES_TESTED=1
readonly APPNAME=chromium-browser
LIBDIR=/usr/lib/chromium-browser
GDB=/usr/bin/gdb
readonly BUILD_DIST="@BUILD_DIST@"
readonly UPSTREAM_VERSION="@UPSTREAM_VERSION@"
if test -x "${LIBDIR}/${UPSTREAM_VERSION}"/chromium-browser; then
LIBDIR="${LIBDIR}/${UPSTREAM_VERSION}"
fi
readonly LIBDIR
usage () {
echo "$APPNAME [-h|--help] [-g|--debug] [--temp-profile] [--no-touch-pinch] [options] [URL]"
echo
echo " --verbose Events logged to stderr."
echo " -g or --debug Start within $GDB"
echo " -h or --help This help screen"
echo " --temp-profile Start with a new and temporary profile"
echo " --no-touch-pinch Disable pinch gestures."
echo
echo " Other supported options are:"
MANWIDTH=80 man chromium-browser | sed -e '1,/OPTIONS/d; /ENVIRONMENT/,$d'
echo " See 'man chromium-browser' for more details"
}
if [ -f /etc/$APPNAME/default ] ; then
. /etc/$APPNAME/default
fi
if test -d /etc/$APPNAME/customizations; then
while read f; do
. "$f"
done < <(run-parts --list -- /etc/$APPNAME/customizations)
fi
test -f ~/.chromium-browser.init && . ~/.chromium-browser.init
FLASH_GOOD_PACKAGE="adobe-flashplugin"
if test "$FLASH_GOOD_PACKAGE"; then
PREVIOUS_CANDIDATE=""
CANDIDATE="$CHROMIUM_FLAGS"
while test "$PREVIOUS_CANDIDATE" != "$CANDIDATE"; do # Strip ppapi-flash-xxxx params off that are outside our known good params, for as long as we still make progress.
PREVIOUS_CANDIDATE="$CANDIDATE"
CANDIDATE=$(echo "$CANDIDATE" |sed -e "s,--ppapi-flash-\w*=\S*\s\(.*--ppapi-flash-path=/usr/lib/${FLASH_GOOD_PACKAGE}/libpepflashplayer.so --ppapi-flash-version=\),\1,")
CANDIDATE=$(echo "$CANDIDATE" |sed -e "s,\(.*--ppapi-flash-path=/usr/lib/${FLASH_GOOD_PACKAGE}/libpepflashplayer.so --ppapi-flash-version=.*\) --ppapi-flash-\w*=\S*,\1,")
done
CHROMIUM_FLAGS="$CANDIDATE"
fi
if test -x /usr/bin/python3 -a -f "/usr/lib/adobe-flashplugin/manifest.json"; then
if echo "$CHROMIUM_FLAGS" |grep -E -- "--ppapi-flash-version=( |\$)"; then
ver=$(python -c 'import json,sys; print(json.load(open("/usr/lib/adobe-flashplugin/manifest.json"))["version"]);')
CHROMIUM_FLAGS=${CHROMIUM_FLAGS/--ppapi-flash-version=/--ppapi-flash-version="${ver}" }
fi
fi
# Prefer user defined CHROMIUM_USER_FLAGS (fron env) over system
# default CHROMIUM_FLAGS (from /etc/$APPNAME/default)
if test -n "$CHROMIUM_USER_FLAGS"; then
echo "WARNING: \$CHROMIUM_USER_FLAGS is deprecated. Instead, update CHROMIUM_FLAGS in ~/.chromium-browser.init or place configuration for all sers in /etc/$APPNAME/customizations/ ."
echo "WARNING: Ignoring system flags because \$CHROMIUM_USER_FLAGS is set."
echo "CHROMIUM_FLAGS=${CHROMIUM_FLAGS}"
echo "CHROMIUM_USER_FLAGS=${CHROMIUM_USER_FLAGS}"
CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS}
fi
# For the Default Browser detection to work, we need to give access
# to xdg-settings if it's not present on the system (ensures that the system
# xdg-utils is recent enough). Also set CHROME_WRAPPER in case xdg-settings is
# not able to do anything useful
if [ ! -e /usr/bin/xdg-settings ] ; then
export PATH="$LIBDIR:$PATH"
fi
export CHROME_WRAPPER="`readlink -f "$0"`"
export CHROME_DESKTOP=$APPNAME.desktop
# lsb_release is slow so try to source the static file /etc/lsb-release instead
if [ -e /etc/lsb-release ] ; then
. /etc/lsb-release
fi
# Fall back to lsb_release if we didn't get the information we need
if test -z "${DISTRIB_ID:-}"; then
DIST=$(lsb_release -si)
RELEASE=$(lsb_release -sr)
else
DIST=${DISTRIB_ID}
RELEASE=${DISTRIB_RELEASE}
fi
# Set CHROME_VERSION_EXTRA visible in the About dialog and in about:version
if [ "$DIST $RELEASE" = "$BUILD_DIST" ] ; then
export CHROME_VERSION_EXTRA="$DIST $RELEASE"
else
export CHROME_VERSION_EXTRA="Built on $BUILD_DIST, running on $DIST $RELEASE"
fi
want_touch_pinch=1
want_debug=0
want_temp_profile=0
want_verbose=0
while [ $# -gt 0 ]; do
case "$1" in
-h | --help | -help )
usage
exit 0 ;;
--verbose )
want_verbose=1
shift ;;
-g | --debug )
want_debug=1
shift ;;
--no-touch-pinch )
want_touch_pinch=0
shift ;;
--temp-profile )
want_temp_profile=1
shift ;;
-- ) # Stop option prcessing
shift
break ;;
* )
break ;;
esac
done
discover_registration ${LIBDIR}/pepper/pepper-flash.info ppapi-flash && echo "Pepper Flash detected."
CHROMIUM_FLAGS="${CHROMIUM_FLAGS} ${PLUGIN_PARAMETERS}"
if [ $want_verbose -eq 1 ] ; then
CHROMIUM_FLAGS="${CHROMIUM_FLAGS} --enable-logging=stderr --v=${want_verbose}"
fi
if [ $want_temp_profile -eq 1 ] ; then
TEMP_PROFILE=`mktemp -d`
CHROMIUM_FLAGS="$CHROMIUM_FLAGS --user-data-dir=$TEMP_PROFILE"
fi
if [ $want_touch_pinch -eq 1 ] ; then
CHROMIUM_FLAGS="$CHROMIUM_FLAGS --enable-pinch"
fi
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 $CHROMIUM_FLAGS ${1+"$@"}" > $tmpfile
echo "# Env:"
echo "# LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
echo "# PATH=$PATH"
echo "# GTK_PATH=$GTK_PATH"
echo "# CHROMIUM_USER_FLAGS=$CHROMIUM_USER_FLAGS"
echo "# CHROMIUM_FLAGS=$CHROMIUM_FLAGS"
echo "$GDB $LIBDIR/$APPNAME -x $tmpfile"
$GDB "$LIBDIR/$APPNAME" -x $tmpfile
if [ $want_temp_profile -eq 1 ] ; then
rm -rf $TEMP_PROFILE
fi
exit $?
else
if [ $want_temp_profile -eq 0 ] ; then
exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
else
# we can't exec here as we need to clean-up the temporary profile
$LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
rm -rf $TEMP_PROFILE
fi
fi
|