Advertisement
Kimarite

chromium (sh)_crunchbang waldorf

Jun 5th, 2014
597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  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. EXTRALIB=/usr/lib/xulrunner-1.9.1
  12. GDB=/usr/bin/gdb
  13. BUILD_DIST="Debian 7.5"
  14.  
  15. usage () {
  16. echo "$APPNAME [-h|--help] [-g|--debug] [--temp-profile] [options] [URL]"
  17. echo
  18. echo " -g or --debug Start within $GDB"
  19. echo " -h or --help This help screen"
  20. echo " --temp-profile Start with a new and temporary profile"
  21. echo
  22. echo " Other supported options are:"
  23. MANWIDTH=80 man chromium | sed -e '1,/OPTIONS/d; /ENVIRONMENT/,$d'
  24. echo " See 'man chromium' for more details"
  25. }
  26.  
  27. if [ -f /etc/$APPNAME/default ] ; then
  28. . /etc/$APPNAME/default
  29. fi
  30.  
  31. # Prefer user defined CHROMIUM_USER_FLAGS (fron env) over system
  32. # default CHROMIUM_FLAGS (from /etc/$APPNAME/default)
  33. CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"}
  34.  
  35. # FFmpeg needs to know where its libs are located
  36. if [ "Z$LD_LIBRARY_PATH" != Z ] ; then
  37. LD_LIBRARY_PATH=$LIBDIR:$EXTRALIB:$LD_LIBRARY_PATH
  38. else
  39. LD_LIBRARY_PATH=$LIBDIR:$EXTRALIB
  40. fi
  41. export LD_LIBRARY_PATH
  42.  
  43. # For the Default Browser detection to work, we need to give access
  44. # to xdg-settings. Also set CHROME_WRAPPER in case xdg-settings is
  45. # not able to do anything useful
  46. export PATH="$LIBDIR:$PATH"
  47. export CHROME_WRAPPER="`readlink -f "$0"`"
  48. export CHROME_DESKTOP=$APPNAME.desktop
  49.  
  50. #DIST=`lsb_release -si`
  51. #RELEASE=`lsb_release -sr`
  52. DIST=Debian
  53. RELEASE=`cat /etc/debian_version`
  54.  
  55. # Set CHROME_VERSION_EXTRA visible in the About dialog and in about:version
  56. if [ "$DIST $RELEASE" = "$BUILD_DIST" ] ; then
  57. export CHROME_VERSION_EXTRA="$DIST $RELEASE"
  58. else
  59. export CHROME_VERSION_EXTRA="Built on $BUILD_DIST, running on $DIST $RELEASE"
  60. fi
  61.  
  62. want_debug=0
  63. want_temp_profile=0
  64. while [ $# -gt 0 ]; do
  65. case "$1" in
  66. -h | --help | -help )
  67. usage
  68. exit 0 ;;
  69. -g | --debug )
  70. want_debug=1
  71. shift ;;
  72. --temp-profile )
  73. want_temp_profile=1
  74. shift ;;
  75. -- ) # Stop option prcessing
  76. shift
  77. break ;;
  78. * )
  79. break ;;
  80. esac
  81. done
  82.  
  83. if [ $want_temp_profile -eq 1 ] ; then
  84. TEMP_PROFILE=`mktemp -d`
  85. CHROMIUM_FLAGS="$CHROMIUM_FLAGS --user-data-dir=$TEMP_PROFILE"
  86. fi
  87.  
  88. if [ $want_debug -eq 1 ] ; then
  89. if [ ! -x $GDB ] ; then
  90. echo "Sorry, can't find usable $GDB. Please install it."
  91. exit 1
  92. fi
  93. tmpfile=`mktemp /tmp/chromiumargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; }
  94. trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
  95. echo "set args $CHROMIUM_FLAGS ${1+"$@"}" > $tmpfile
  96. echo "# Env:"
  97. echo "# LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
  98. echo "# PATH=$PATH"
  99. echo "# GTK_PATH=$GTK_PATH"
  100. echo "# CHROMIUM_USER_FLAGS=$CHROMIUM_USER_FLAGS"
  101. echo "# CHROMIUM_FLAGS=$CHROMIUM_FLAGS"
  102. echo "$GDB $LIBDIR/$APPNAME -x $tmpfile"
  103. $GDB "$LIBDIR/$APPNAME" -x $tmpfile
  104. if [ $want_temp_profile -eq 1 ] ; then
  105. rm -rf $TEMP_PROFILE
  106. fi
  107. exit $?
  108. else
  109. if [ $want_temp_profile -eq 0 ] ; then
  110. exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
  111. else
  112. # we can't exec here as we need to clean-up the temporary profile
  113. $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
  114. rm -rf $TEMP_PROFILE
  115. fi
  116. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement