mozilla.in 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/sh
  2. #
  3. # This Source Code Form is subject to the terms of the Mozilla Public
  4. # License, v. 2.0. If a copy of the MPL was not distributed with this
  5. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. ##
  7. ## Usage:
  8. ##
  9. ## $ mozilla [args]
  10. ##
  11. ## This script is meant to run the application binary from mozilla/dist/bin.
  12. ##
  13. ## The script will setup all the environment voodoo needed to make
  14. ## the application binary to work.
  15. ##
  16. #uncomment for debugging
  17. #set -x
  18. moz_libdir=%MOZAPPDIR%
  19. # Use run-mozilla.sh in the current dir if it exists
  20. # If not, then start resolving symlinks until we find run-mozilla.sh
  21. found=0
  22. progname="$0"
  23. curdir=`dirname "$progname"`
  24. progbase=`basename "$progname"`
  25. run_moz="$curdir/run-mozilla.sh"
  26. if test -x "$run_moz"; then
  27. dist_bin="$curdir"
  28. found=1
  29. else
  30. here=`/bin/pwd`
  31. while [ -h "$progname" ]; do
  32. bn=`basename "$progname"`
  33. cd `dirname "$progname"`
  34. # Resolve symlink of dirname
  35. cd `/bin/pwd`
  36. progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
  37. progbase=`basename "$progname"`
  38. if [ ! -x "$progname" ]; then
  39. break
  40. fi
  41. curdir=`dirname "$progname"`
  42. run_moz="$curdir/run-mozilla.sh"
  43. if [ -x "$run_moz" ]; then
  44. cd "$curdir"
  45. dist_bin=`/bin/pwd`
  46. run_moz="$dist_bin/run-mozilla.sh"
  47. found=1
  48. break
  49. fi
  50. done
  51. cd "$here"
  52. fi
  53. if [ $found = 0 ]; then
  54. # Check default compile-time libdir
  55. if [ -x "$moz_libdir/run-mozilla.sh" ]; then
  56. dist_bin="$moz_libdir"
  57. run_moz="$moz_libdir/run-mozilla.sh"
  58. else
  59. echo "Cannot find %MOZ_APP_DISPLAYNAME% runtime directory. Exiting."
  60. exit 1
  61. fi
  62. fi
  63. script_args=""
  64. debugging=0
  65. MOZILLA_BIN="${progbase}-bin"
  66. if [ "$OSTYPE" = "beos" ]; then
  67. mimeset -F "$MOZILLA_BIN"
  68. fi
  69. pass_arg_count=0
  70. while [ $# -gt $pass_arg_count ]
  71. do
  72. case "$1" in
  73. -p | --pure | -pure)
  74. MOZILLA_BIN="${MOZILLA_BIN}.pure"
  75. shift
  76. ;;
  77. -g | --debug)
  78. script_args="$script_args -g"
  79. debugging=1
  80. shift
  81. ;;
  82. -d | --debugger)
  83. script_args="$script_args -d $2"
  84. shift 2
  85. ;;
  86. *)
  87. # Move the unrecognized argument to the end of the list.
  88. arg="$1"
  89. shift
  90. set -- "$@" "$arg"
  91. pass_arg_count=`expr $pass_arg_count + 1`
  92. ;;
  93. esac
  94. done
  95. if [ $debugging = 1 ]
  96. then
  97. echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
  98. fi
  99. exec "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
  100. # EOF.