1 | #!/bin/sh |
---|
2 | |
---|
3 | # Chromium launcher |
---|
4 | |
---|
5 | # Authors: |
---|
6 | # Fabien Tassin <fta@sofaraway.org> |
---|
7 | # License: GPLv2 or later |
---|
8 | |
---|
9 | APPNAME=chromium |
---|
10 | LIBDIR=/usr/lib/chromium |
---|
11 | GDB=/usr/bin/gdb |
---|
12 | CHROME_SANDBOX=/usr/lib/chrome_sandbox |
---|
13 | |
---|
14 | # # Let the Chromium aware MeeGo desktop environment. |
---|
15 | # # For system proxy setting integration. |
---|
16 | # GNOME_DESKTOP_SESSION_ID="this-is-deprecated" |
---|
17 | # export GNOME_DESKTOP_SESSION_ID |
---|
18 | |
---|
19 | usage () { |
---|
20 | echo "$APPNAME [-h|--help] [-g|--debug] [options] [URL]" |
---|
21 | echo |
---|
22 | echo " -g or --debug Start within $GDB" |
---|
23 | echo " -h or --help This help screen" |
---|
24 | } |
---|
25 | |
---|
26 | # FFmpeg needs to know where its libs are located |
---|
27 | if [ "Z$LD_LIBRARY_PATH" != Z ] ; then |
---|
28 | LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH |
---|
29 | else |
---|
30 | LD_LIBRARY_PATH=$LIBDIR |
---|
31 | fi |
---|
32 | export LD_LIBRARY_PATH |
---|
33 | |
---|
34 | # xdg-settings should in PATH |
---|
35 | PATH=$PATH:$LIBDIR |
---|
36 | export PATH |
---|
37 | |
---|
38 | want_debug=0 |
---|
39 | while [ $# -gt 0 ]; do |
---|
40 | case "$1" in |
---|
41 | -h | --help | -help ) |
---|
42 | usage |
---|
43 | exit 0 ;; |
---|
44 | -g | --debug ) |
---|
45 | want_debug=1 |
---|
46 | shift ;; |
---|
47 | -- ) # Stop option prcessing |
---|
48 | shift |
---|
49 | break ;; |
---|
50 | * ) |
---|
51 | break ;; |
---|
52 | esac |
---|
53 | done |
---|
54 | |
---|
55 | # # Set plugin search path. Chromium will read mozilla's plugin |
---|
56 | # # search path. This is for platforms (handset, TV, etc..) where |
---|
57 | # # plugins are not copied/linked to the standard mozilla plugin |
---|
58 | # # path due to reasons. PDF plugin is in the list though it is |
---|
59 | # # not really supported by chromium on Linux. |
---|
60 | # moz_plugin_path=$(find /usr/java/jre* \ |
---|
61 | # /usr/lib/flash-plugin \ |
---|
62 | # /opt/Adobe* /usr/Adobe* \ |
---|
63 | # -name "libnpjp2.so" -exec dirname {} \; -o \ |
---|
64 | # -name "libflashplayer.so" -exec dirname {} \; -o \ |
---|
65 | # -name "nppdf.so" -exec dirname {} \; 2>/dev/null | xargs echo) |
---|
66 | # MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:${moz_plugin_path// /:} |
---|
67 | # export MOZ_PLUGIN_PATH |
---|
68 | |
---|
69 | # Setup the default profile if this is none |
---|
70 | # Set the default theme as GTK+ with system window decoration |
---|
71 | if [ ! -d ~/.config/chromium/Default ]; then |
---|
72 | mkdir -p ~/.config/chromium/Default |
---|
73 | cat <<EOF > ~/.config/chromium/Default/Preferences |
---|
74 | { |
---|
75 | "browser": { |
---|
76 | "custom_chrome_frame": false |
---|
77 | }, |
---|
78 | "extensions": { |
---|
79 | "theme": { |
---|
80 | "colors": { |
---|
81 | |
---|
82 | }, |
---|
83 | "id": "", |
---|
84 | "images": { |
---|
85 | |
---|
86 | }, |
---|
87 | "properties": { |
---|
88 | |
---|
89 | }, |
---|
90 | "tints": { |
---|
91 | |
---|
92 | }, |
---|
93 | "use_system": true |
---|
94 | } |
---|
95 | }, |
---|
96 | "homepage": "http://meego.com/", |
---|
97 | "homepage_is_newtabpage": false, |
---|
98 | "session": { |
---|
99 | "restore_on_startup": 1 |
---|
100 | }, |
---|
101 | "webkit": { |
---|
102 | "webprefs": { |
---|
103 | "default_fixed_font_size": 13, |
---|
104 | "default_font_size": 16, |
---|
105 | "fixed_font_family": "Droid Sans Mono", |
---|
106 | "sansserif_font_family": "Droid Sans", |
---|
107 | "serif_font_family": "Droid Serif" |
---|
108 | } |
---|
109 | } |
---|
110 | } |
---|
111 | EOF |
---|
112 | # # Set the default browser |
---|
113 | # $LIBDIR/xdg-settings set default-web-browser chromium-browser.desktop |
---|
114 | fi |
---|
115 | |
---|
116 | if [ ! -u $CHROME_SANDBOX ] ; then |
---|
117 | SANDBOX="--no-sandbox" |
---|
118 | fi |
---|
119 | |
---|
120 | |
---|
121 | if [ $want_debug -eq 1 ] ; then |
---|
122 | if [ ! -x $GDB ] ; then |
---|
123 | echo "Sorry, can't find usable $GDB. Please install it." |
---|
124 | exit 1 |
---|
125 | fi |
---|
126 | tmpfile=`mktemp /tmp/chromiumargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; } |
---|
127 | trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15 |
---|
128 | echo "set args ${1+"$@"}" > $tmpfile |
---|
129 | echo "# Env:" |
---|
130 | echo "# LD_LIBRARY_PATH=$LD_LIBRARY_PATH" |
---|
131 | echo "$GDB $LIBDIR/$APPNAME -x $tmpfile" |
---|
132 | $GDB "$LIBDIR/$APPNAME" -x $tmpfile |
---|
133 | exit $? |
---|
134 | else |
---|
135 | exec $LIBDIR/$APPNAME $SANDBOX "--password-store=detect" "--enable-experimental-extension-apis" "--enable-plugins" "--enable-extensions" "--enable-user-scripts" "--enable-printing" "--enable-sync" "--auto-ssl-client-auth" "$@" |
---|
136 | fi |
---|
137 | |
---|