chromium-browser-vine.sh 3.4 KB

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