| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Running Chromium via this script makes it possible to set Chromium as the | 7 # Running Chromium via this script makes it possible to set Chromium as the |
| 8 # default browser directly out of a compile, without needing to package it. | 8 # default browser directly out of a compile, without needing to package it. |
| 9 | 9 |
| 10 DESKTOP="chromium-devel" | 10 DESKTOP="chromium-devel" |
| 11 TITLE="Chromium" | 11 TITLE="Chromium" |
| 12 | 12 |
| 13 usage() { | 13 usage() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 EOF | 67 EOF |
| 68 } | 68 } |
| 69 | 69 |
| 70 # Let the wrapped binary know that it has been run through the wrapper. | 70 # Let the wrapped binary know that it has been run through the wrapper. |
| 71 export CHROME_WRAPPER="`readlink -f "$0"`" | 71 export CHROME_WRAPPER="`readlink -f "$0"`" |
| 72 export CHROME_DESKTOP="$DESKTOP.desktop" | 72 export CHROME_DESKTOP="$DESKTOP.desktop" |
| 73 | 73 |
| 74 HERE="`dirname "$CHROME_WRAPPER"`" | 74 HERE="`dirname "$CHROME_WRAPPER"`" |
| 75 | 75 |
| 76 # We include some xdg utilities next to the binary, and we want to prefer them | 76 # We include some xdg utilities next to the binary, and we want to prefer them |
| 77 # over the system versions because we know they work correctly for us. But if | 77 # over the system versions when we know the system versions are very old. We |
| 78 # our path already exists, we leave it where it is, to allow overriding this. | 78 # detect whether the system xdg utilities are sufficiently new to be likely to |
| 79 # (Once distributions have picked up the updated xdg-mime, we can go back to | 79 # work for us by looking for xdg-settings. If we find it, we leave $PATH alone, |
| 80 # appending $HERE rather than prepending.) | 80 # so that the system xdg utilities (including any distro patches) will be used. |
| 81 case ":$PATH:" in | 81 if ! which xdg-settings &> /dev/null; then |
| 82 *:$HERE:*) | 82 # Old xdg utilities. Prepend $HERE to $PATH to use ours instead. |
| 83 # $PATH already contains $HERE, leave it where it is. | 83 export PATH="$HERE:$PATH" |
| 84 ;; | 84 else |
| 85 *) | 85 # Use system xdg utilities. But first create mimeapps.list if it doesn't |
| 86 # Prepend $HERE to $PATH. | 86 # exist; some systems have bugs in xdg-mime that make it fail without it. |
| 87 export PATH="$HERE:$PATH" | 87 xdg_app_dir="${XDG_DATA_HOME:-$HOME/.local/share/applications}" |
| 88 ;; | 88 mkdir -p "$xdg_app_dir" |
| 89 esac | 89 [ -f "$xdg_app_dir/mimeapps.list" ] || touch "$xdg_app_dir/mimeapps.list" |
| 90 fi |
| 90 | 91 |
| 91 # Always use our ffmpeg and other shared libs. | 92 # Always use our ffmpeg and other shared libs. |
| 92 export LD_LIBRARY_PATH="$HERE:$HERE/lib:$HERE/lib.target${LD_LIBRARY_PATH:+:${LD
_LIBRARY_PATH}}" | 93 export LD_LIBRARY_PATH="$HERE:$HERE/lib:$HERE/lib.target${LD_LIBRARY_PATH:+:${LD
_LIBRARY_PATH}}" |
| 93 | 94 |
| 94 MISSING_LIBS=$(ldd "$HERE/chrome" 2> /dev/null |grep "not found$" | cut -d" " -f
1|sed 's/\t//') | 95 MISSING_LIBS=$(ldd "$HERE/chrome" 2> /dev/null |grep "not found$" | cut -d" " -f
1|sed 's/\t//') |
| 95 CHROME_ARCH=$(check_executable "$HERE/chrome") | 96 CHROME_ARCH=$(check_executable "$HERE/chrome") |
| 96 uname -m | grep -qs x86_64 | 97 uname -m | grep -qs x86_64 |
| 97 if [ $? = 1 ]; then | 98 if [ $? = 1 ]; then |
| 98 LIBDIRS="/lib /lib32 /usr/lib /usr/lib32" | 99 LIBDIRS="/lib /lib32 /usr/lib /usr/lib32" |
| 99 else | 100 else |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 "--man-page") | 154 "--man-page") |
| 154 exec man "$HERE/../../chrome/app/resources/manpage.1.in" ;; | 155 exec man "$HERE/../../chrome/app/resources/manpage.1.in" ;; |
| 155 *) | 156 *) |
| 156 ARGS=( "${ARGS[@]}" "$1" ) ;; | 157 ARGS=( "${ARGS[@]}" "$1" ) ;; |
| 157 esac | 158 esac |
| 158 shift | 159 shift |
| 159 done | 160 done |
| 160 set -- "${ARGS[@]}" "$@" | 161 set -- "${ARGS[@]}" "$@" |
| 161 | 162 |
| 162 exec $CMD_PREFIX "$HERE/chrome" "$@" | 163 exec $CMD_PREFIX "$HERE/chrome" "$@" |
| OLD | NEW |