firefox.vine.sh.in 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. #!/bin/sh
  2. #
  3. # The contents of this file are subject to the Netscape Public
  4. # License Version 1.1 (the "License"); you may not use this file
  5. # except in compliance with the License. You may obtain a copy of
  6. # the License at http://www.mozilla.org/NPL/
  7. #
  8. # Software distributed under the License is distributed on an "AS
  9. # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10. # implied. See the License for the specific language governing
  11. # rights and limitations under the License.
  12. #
  13. # The Original Code is mozilla.org code.
  14. #
  15. # The Initial Developer of the Original Code is Netscape
  16. # Communications Corporation. Portions created by Netscape are
  17. # Copyright (C) 1998 Netscape Communications Corporation. All
  18. # Rights Reserved.
  19. #
  20. # Contributor(s):
  21. #
  22. ##
  23. ## Usage:
  24. ##
  25. ## $ mozilla
  26. ##
  27. ## This script is meant to run a mozilla program from the mozilla
  28. ## rpm installation.
  29. ##
  30. ## The script will setup all the environment voodoo needed to make
  31. ## mozilla work.
  32. cmdname=`basename $0`
  33. ##
  34. ## Variables
  35. ##
  36. MOZ_ARCH=$(uname -m)
  37. case $MOZ_ARCH in
  38. x86_64 | ia64 | s390 )
  39. MOZ_LIB_DIR="/usr/lib64"
  40. SECONDARY_LIB_DIR="/usr/lib"
  41. ;;
  42. * )
  43. MOZ_LIB_DIR="/usr/lib"
  44. SECONDARY_LIB_DIR="/usr/lib64"
  45. ;;
  46. esac
  47. if [ ! -x $MOZ_LIB_DIR/firefox-FIREFOX_VERSION/firefox ]; then
  48. if [ ! -x $SECONDARY_LIB_DIR/firefox-FIREFOX_VERSION/firefox ]; then
  49. echo "Error: $MOZ_LIB_DIR/firefox-FIREFOX_VERSION/firefox not found"
  50. if [ -d $SECONDARY_LIB_DIR ]; then
  51. echo " $SECONDARY_LIB_DIR/firefox-FIREFOX_VERSION/firefox not found"
  52. fi
  53. exit 1
  54. fi
  55. MOZ_LIB_DIR="$SECONDARY_LIB_DIR"
  56. fi
  57. MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox-FIREFOX_VERSION"
  58. MOZ_EXTENSIONS_DIR="$MOZ_DIST_BIN/extensions"
  59. MOZ_PROGRAM="$MOZ_DIST_BIN/firefox"
  60. MOZ_LAUCHER="$MOZ_DIST_BIN/run-mozilla.sh"
  61. ##
  62. ## Set MOZ_GRE_CONF
  63. ##
  64. MOZ_GRE_CONF=/etc/gre.d/gre.conf
  65. if [ "$MOZ_LIB_DIR" == "/usr/lib64" ]; then
  66. MOZ_GRE_CONF=/etc/gre.d/gre64.conf
  67. fi
  68. export MOZ_GRE_CONF
  69. ##
  70. ## Set MOZILLA_FIVE_HOME
  71. ##
  72. MOZILLA_FIVE_HOME="$MOZ_DIST_BIN"
  73. export MOZILLA_FIVE_HOME
  74. ##
  75. ## Select the propper plugin dir
  76. ## Wrapped plug-ins are located in /lib/mozilla/plugins-wrapped
  77. ##
  78. if [ -x "/usr/bin/mozilla-plugin-config" ]
  79. then
  80. MOZ_PLUGIN_DIR="plugins-wrapped"
  81. else
  82. MOZ_PLUGIN_DIR="plugins"
  83. fi
  84. ##
  85. ## Make sure that we set the plugin path
  86. ##
  87. if [ "$MOZ_PLUGIN_PATH" ]
  88. then
  89. MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
  90. else
  91. MOZ_PLUGIN_PATH=$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR
  92. fi
  93. export MOZ_PLUGIN_PATH
  94. ##
  95. ## If plugins are wrapped, check them
  96. ##
  97. if [ -x "/usr/bin/mozilla-plugin-config" ]
  98. then
  99. /usr/bin/mozilla-plugin-config
  100. fi
  101. ##
  102. ## Set FONTCONFIG_PATH for Xft/fontconfig
  103. ##
  104. FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft"
  105. export FONTCONFIG_PATH
  106. ##
  107. ## Set MOZ_DISABLE_PANGO
  108. ## Vine Linux's firefox is build with Pango rendering by default.
  109. ## But Pango rendering cause slower rendering in some pages especially in CJK page.
  110. ## So we disable it by default.
  111. ##
  112. if [ ! "$MOZ_ENABLE_PANGO" == "1" ]
  113. then
  114. MOZ_DISABLE_PANGO=1
  115. export MOZ_DISABLE_PANGO
  116. fi
  117. ##
  118. ## firefox with flash on composite enabled X server
  119. ##
  120. XLIB_SKIP_ARGB_VISUALS=1
  121. export XLIB_SKIP_ARGB_VISUALS
  122. ##
  123. ## use Pulseaudio on Flash-plugins, if pulseaudio server is available.
  124. ##
  125. if ( /sbin/pidof pulseauido > /dev/null )
  126. then
  127. FLASH_FORCE_PULSEAUDIO=1
  128. export FLASH_FORCE_PULSEAUDIO
  129. fi
  130. # OK, here's where all the real work gets done
  131. # check system locale
  132. MOZARGS=
  133. MOZLOCALE=`echo $LANG | sed "s|_\([^.]*\).*|-\1|g"`
  134. MOZLOCALESHORT=`echo $MOZLOCALE | cut -f1 -d-`
  135. if [ -f $MOZILLA_FIVE_HOME/chrome/$MOZLOCALE.jar ] || [ -f $MOZILLA_FIVE_HOME/chrome/$MOZLOCALESHORT.jar ];
  136. then
  137. MOZARGS="-UILocale $MOZLOCALE"
  138. else
  139. MOZARGS="-UILocale en-US"
  140. fi
  141. # Prepare command line arguments
  142. script_args=""
  143. pass_arg_count=0
  144. while [ $# -gt $pass_arg_count ]
  145. do
  146. case "$1" in
  147. -g | --debug)
  148. script_args="$script_args -g"
  149. debugging=1
  150. shift
  151. ;;
  152. -d | --debugger)
  153. if [ $# -gt 1 ]; then
  154. script_args="$script_args -d $2"
  155. shift 2
  156. else
  157. shift
  158. fi
  159. ;;
  160. *)
  161. # Move the unrecognized argument to the end of the list.
  162. arg="$1"
  163. shift
  164. set -- "$@" "$arg"
  165. pass_arg_count=`expr $pass_arg_count + 1`
  166. ;;
  167. esac
  168. done
  169. # Run the browser
  170. debugging=0
  171. if [ $debugging = 1 ]
  172. then
  173. echo $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"
  174. fi
  175. exec $MOZ_LAUCHER $script_args $MOZ_PROGRAM $MOZARGS "$@"