[2028] | 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 | usage () { |
---|
| 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 |
---|
| 21 | if [ "Z$LD_LIBRARY_PATH" != Z ] ; then |
---|
| 22 | LD_LIBRARY_PATH=$LIBDIR:$LD_LIBRARY_PATH |
---|
| 23 | else |
---|
| 24 | LD_LIBRARY_PATH=$LIBDIR |
---|
| 25 | fi |
---|
| 26 | export LD_LIBRARY_PATH |
---|
| 27 | |
---|
| 28 | # xdg-settings should in PATH |
---|
| 29 | PATH=$PATH:$LIBDIR |
---|
| 30 | export PATH |
---|
| 31 | |
---|
| 32 | want_debug=0 |
---|
| 33 | while [ $# -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 |
---|
| 47 | done |
---|
| 48 | |
---|
| 49 | # Setup the default profile if this is none |
---|
| 50 | # Set the default theme as GTK+ with system window decoration |
---|
| 51 | if [ ! -d ~/.config/chromium/Default ]; then |
---|
| 52 | mkdir -p ~/.config/chromium/Default |
---|
| 53 | cat <<EOF > ~/.config/chromium/Default/Preferences |
---|
| 54 | { |
---|
| 55 | "browser": { |
---|
[8557] | 56 | "custom_chrome_frame": true |
---|
[2028] | 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 | }, |
---|
[8557] | 76 | "homepage": "http://vinelinux.org/", |
---|
[2028] | 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, |
---|
[8557] | 85 | "fixed_font_family": "monospace", |
---|
| 86 | "sansserif_font_family": "sans-serif", |
---|
| 87 | "serif_font_family": "serif" |
---|
[2028] | 88 | } |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | EOF |
---|
| 92 | fi |
---|
| 93 | |
---|
[5230] | 94 | if [ ! -u $CHROME_SANDBOX ] ; then |
---|
[8557] | 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." |
---|
[5230] | 97 | fi |
---|
| 98 | |
---|
[8557] | 99 | # Allow users to override command-line options |
---|
| 100 | # Based on Gentoo's chromium package (and by extension, Debian's) |
---|
| 101 | if [ -f /etc/default/chromium ]; then |
---|
| 102 | . /etc/default/chromium |
---|
| 103 | fi |
---|
[5230] | 104 | |
---|
[8557] | 105 | # Detect if PepperFlash has been installed |
---|
| 106 | # If so, automatically enable it |
---|
| 107 | if [ -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" |
---|
| 110 | fi |
---|
| 111 | |
---|
| 112 | # Prefer user defined CHROMIUM_USER_FLAGS (from env) over system |
---|
| 113 | # default CHROMIUM_FLAGS (from /etc/chromium/default) |
---|
| 114 | CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-$CHROMIUM_FLAGS} |
---|
| 115 | |
---|
[2028] | 116 | if [ $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 $? |
---|
| 129 | else |
---|
[8557] | 130 | exec $LIBDIR/$APPNAME $SANDBOX ${CHROMIUM_FLAGS} ${PEPPERFLASH} "--password-store=basic" "--enable-threaded-compositing" "$@" |
---|
[2028] | 131 | fi |
---|
| 132 | |
---|