source: projects/specs/trunk/c/chromium/chromium-browser-vine.sh @ 8557

Revision 8557, 3.4 KB checked in by Takemikaduchi, 10 years ago (diff)

new upstream release

  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# Chromium launcher
4
5# Authors:
6#  Fabien Tassin <fta@sofaraway.org>
7# License: GPLv2 or later
8
9APPNAME=chromium
10LIBDIR=/usr/lib/chromium
11GDB=/usr/bin/gdb
12
13usage () {
14  echo "$APPNAME [-h|--help] [-g|--debug] [options] [URL]"
15  echo
16  echo "        -g or --debug           Start within $GDB"
17  echo "        -h or --help            This help screen"
18}
19
20# FFmpeg needs to know where its libs are located
21if [ "Z$LD_LIBRARY_PATH" != Z ] ; then
22  LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH
23else
24  LD_LIBRARY_PATH=$LIBDIR
25fi
26export LD_LIBRARY_PATH
27
28# xdg-settings should in PATH
29PATH=$PATH:$LIBDIR
30export PATH
31
32want_debug=0
33while [ $# -gt 0 ]; do
34  case "$1" in
35    -h | --help | -help )
36      usage
37      exit 0 ;;
38    -g | --debug )
39      want_debug=1
40      shift ;;
41    -- ) # Stop option prcessing
42      shift
43      break ;;
44    * )
45      break ;;
46  esac
47done
48
49# Setup the default profile if this is none
50# Set the default theme as GTK+ with system window decoration
51if [ ! -d ~/.config/chromium/Default ]; then
52    mkdir -p ~/.config/chromium/Default
53    cat <<EOF > ~/.config/chromium/Default/Preferences
54{
55   "browser": {
56      "custom_chrome_frame": true
57   },
58   "extensions": {
59      "theme": {
60         "colors": {
61
62         },
63         "id": "",
64         "images": {
65
66         },
67         "properties": {
68
69         },
70         "tints": {
71
72         },
73         "use_system": true
74      }
75   },
76   "homepage": "http://vinelinux.org/",
77   "homepage_is_newtabpage": false,
78   "session": {
79      "restore_on_startup": 1
80   },
81   "webkit": {
82      "webprefs": {
83         "default_fixed_font_size": 13,
84         "default_font_size": 16,
85         "fixed_font_family": "monospace",
86         "sansserif_font_family": "sans-serif",
87         "serif_font_family": "serif"
88      }
89   }
90}
91EOF
92fi
93
94if [ ! -u $CHROME_SANDBOX ] ; then
95   echo "The chrome_sandbox binary does not have the SETUID set.\n"
96   echo "This is most likely caused by the permission state (Secure/Paranoid) of the system. Therefore running Chromium is not possible."
97fi
98
99# Allow users to override command-line options
100# Based on Gentoo's chromium package (and by extension, Debian's)
101if [ -f /etc/default/chromium ]; then
102        . /etc/default/chromium
103fi
104
105# Detect if PepperFlash has been installed
106# If so, automatically enable it
107if [ -f /usr/lib/chromium/PepperFlash/libpepflashplayer.so ]; then
108      PEPPER_FLASH_VERSION=$(grep '"version":' /usr/lib/chromium/PepperFlash/manifest.json| grep -Po '(?<=version": ")(?:\d|\.)*')
109      PEPPERFLASH="--ppapi-flash-path=/usr/lib/chromium/PepperFlash/libpepflashplayer.so --ppapi-flash-version=$PEPPER_FLASH_VERSION"
110fi
111
112# Prefer user defined CHROMIUM_USER_FLAGS (from env) over system
113# default CHROMIUM_FLAGS (from /etc/chromium/default)
114CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-$CHROMIUM_FLAGS}
115
116if [ $want_debug -eq 1 ] ; then
117  if [ ! -x $GDB ] ; then
118    echo "Sorry, can't find usable $GDB. Please install it."
119    exit 1
120  fi
121  tmpfile=`mktemp /tmp/chromiumargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; }
122  trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
123  echo "set args ${1+"$@"}" > $tmpfile
124  echo "# Env:"
125  echo "#     LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
126  echo "$GDB $LIBDIR/$APPNAME -x $tmpfile"
127  $GDB "$LIBDIR/$APPNAME" -x $tmpfile
128  exit $?
129else
130  exec $LIBDIR/$APPNAME $SANDBOX ${CHROMIUM_FLAGS} ${PEPPERFLASH} "--password-store=basic" "--enable-threaded-compositing" "$@"
131fi
132
Note: See TracBrowser for help on using the repository browser.