-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchromium-wrapper.txt
143 lines (122 loc) · 4.14 KB
/
chromium-wrapper.txt
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
#!/usr/bin/sh
# Chromium launcher
# Authors:
# Fabien Tassin <[email protected]>
# License: GPLv2 or later
APPNAME=chromium
LIBDIR=@LIBDIR@/chromium
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"
}
# FFmpeg needs to know where its libs are located
if [ "Z$LD_LIBRARY_PATH" != Z ] ; then
LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=$LIBDIR
fi
export LD_LIBRARY_PATH
LD_PRELOAD=$LIBDIR/libffmpeg.so${LD_PRELOAD:+:$LD_PRELOAD}
# Set CHROME_VERSION_EXTRA visible in the About dialog and in about:version
export CHROME_VERSION_EXTRA="Built from source for @@BUILDTARGET@@"
# 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 <<EOF > ~/.config/chromium/Default/Preferences
{
"browser": {
"custom_chrome_frame": false
},
"extensions": {
"theme": {
"colors": {
},
"id": "",
"images": {
},
"properties": {
},
"tints": {
},
"use_system": true
}
},
"homepage": "https://unitedrpms.github.io/",
"homepage_is_newtabpage": false,
"session": {
"restore_on_startup": 1
},
"webkit": {
"webprefs": {
"default_fixed_font_size": 13,
"default_font_size": 16,
"fixed_font_family": "Droid Sans Mono",
"sansserif_font_family": "Droid Sans",
"serif_font_family": "Droid Serif"
}
}
}
EOF
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 ]; then
. /etc/default/chromium
fi
# Detect if PepperFlash has been installed (based on the package in packman)
# If so, automatically enable it
if [ -f @LIBDIR@/chromium/PepperFlash/libpepflashplayer.so ]; then
PEPPER_FLASH_VERSION=$(grep '"version":' @LIBDIR@/chromium/PepperFlash/manifest.json| grep -Po '(?<=version": ")(?:\d|\.)*')
PEPPERFLASH="--ppapi-flash-path=@LIBDIR@/chromium/PepperFlash/libpepflashplayer.so --ppapi-flash-version=$PEPPER_FLASH_VERSION"
fi
# Detect if Widevine update component exist
if [ ! -f $HOME/.config/chromium/WidevineCdm/latest-component-updated-widevine-cdm ] || [ ! -n $HOME/.config/chromium/WidevineCdm ] ; then
mkdir -p $HOME/.config/chromium/WidevineCdm
echo '{"Path":"/usr/lib64/chromium/WidevineCdm"}' > $HOME/.config/chromium/WidevineCdm/latest-component-updated-widevine-cdm
fi
# Prefer user defined CHROMIUM_USER_FLAGS (from env) over system
# default CHROMIUM_FLAGS (from /etc/chromium/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
exec $LIBDIR/$APPNAME -u ${CHROMIUM_FLAGS} ${PEPPERFLASH} "--password-store=basic" "--enable-plugins" "--enable-extensions" "--enable-user-scripts" "--enable-printing" "--enable-native-gpu-memory-buffers" "--enable-gpu-rasterization" "--enable-accelerated-video-decode" "--enable-zero-copy" "$@"
fi