-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppRun
executable file
·51 lines (51 loc) · 1.37 KB
/
AppRun
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
#!/bin/sh
# AppRun - Setup portable environment and invoke BitTorrent Sync GUI
#
die() {
echo "$@"
exit 1
}
find_in_path() {
local path="$PWD:$PATH"
local IFS=:
for sp in $path; do
if [ -x "$sp/$1" ]; then
echo "$sp/$1"
return 0
fi
done
return 1
}
case "$0" in
/*|./*|../*)
cd `dirname "$0"` > /dev/null || \
die 'I cannot CD to where this script was run from,' \
'So cannot invoke app. Sorry.'
;;
*)
fp=`find_in_path "$0"` && \
rp=`readlink -e "$fp"` && \
cd `dirname "$rp"` || \
die 'I cannot CD to where this script was run from,' \
'So cannot invoke app. Sorry.'
;;
esac
# Huristic test if we have the files we need
test -x ./usr/bin/btsync-gui -a -x ./usr/lib/btsync-common/btsync-core -a \
-r ./usr/lib/btsync-gui/btsync-gui.key || \
die 'Cannot find parts of the App. Sorry.'
# Setun environment
PATH="$PWD/usr/bin:$PATH"
export PATH
LD_LIBRARY_PATH="$PWD/usr/lib"
export LD_LIBRARY_PATH
PYTHONPATH="$PWD/usr/lib/python:$PWD/usr/lib:$PWD/usr/lib/btsync-gui"
export PYTHONPATH
if [ -z "$XDG_DATA_DIRS" ]; then
XDG_DATA_DIRS="$PWD/usr/share:/usr/local/share:/usr/share"
else
XDG_DATA_DIRS="$PWD/usr/share:$XDG_DATA_DIRS"
fi
export XDG_DATA_DIRS
# Run the app
exec "$PWD/usr/bin/btsync-gui" "$@"