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