blob: 500d73a6b5e28298b1fb459da2f64e7bd1fb6892 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/bin/sh
# Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Running Chromium via this script makes it possible to set Chromium as the
# default browser directly out of a compile, without needing to package it.
DESKTOP="chromium-devel"
TITLE="Chromium"
# Check to see if there is a desktop file of the given name
exists_desktop_file() {
# Build a search list from $XDG_DATA_HOME and $XDG_DATA_DIRS, the latter
# of which can itself be a colon-separated list of directories to search.
search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
IFS=:
for dir in $search; do
unset IFS
[ "$dir" -a -d "$dir/applications" ] || continue
[ -r "$dir/applications/$DESKTOP.desktop" ] && return
done
# Didn't find it in the search path
return 1
}
# Generate a desktop file that will run this script
generate_desktop_file() {
apps="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
cat > "$apps/$DESKTOP.desktop" << EOF
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=$TITLE
Exec=$CHROME_WRAPPER %U
Terminal=false
Icon=$HERE/product_logo_48.png
Type=Application
Categories=Application;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;
EOF
}
# Let the wrapped binary know that it has been run through the wrapper
export CHROME_WRAPPER="`readlink -f "$0"`"
export CHROME_DESKTOP="$DESKTOP.desktop"
HERE="`dirname "$CHROME_WRAPPER"`"
case ":$PATH:" in
*:$HERE:*)
# $PATH already contains $HERE
;;
*)
# Append $HERE to $PATH
export PATH="$PATH:$HERE"
;;
esac
# Always use our ffmpeg and other shared libs.
export LD_LIBRARY_PATH="$HERE:$HERE/lib:$LD_LIBRARY_PATH"
exists_desktop_file || generate_desktop_file
exec "$HERE/chrome" "$@"
|