2014-02-19 17:13:04 +00:00
|
|
|
#!/bin/bash
|
2013-02-14 00:29:14 +00:00
|
|
|
|
|
|
|
EXEC="exec"
|
|
|
|
|
|
|
|
name="`basename $0`"
|
2014-02-19 17:13:04 +00:00
|
|
|
if [[ "$0" == `pwd`* ]] || [[ "$0" == "/"* ]]; then
|
2013-02-14 00:29:14 +00:00
|
|
|
full_path="$0"
|
|
|
|
else
|
|
|
|
full_path="`pwd`/$0"
|
|
|
|
fi
|
|
|
|
tmp=`dirname "$full_path"`
|
|
|
|
tmp=`dirname "$tmp"`
|
|
|
|
bundle=`dirname "$tmp"`
|
2015-09-20 14:47:24 +00:00
|
|
|
bundle_contents=${bundle%"/Contents"}"/Contents"
|
2013-02-14 00:29:14 +00:00
|
|
|
bundle_macos="$bundle_contents"/MacOS
|
|
|
|
bundle_res="$bundle_contents"/Resources
|
|
|
|
bundle_lib="$bundle_res"/lib
|
|
|
|
bundle_data="$bundle_res"/share
|
|
|
|
bundle_etc="$bundle_res"/etc
|
|
|
|
|
|
|
|
export DYLD_LIBRARY_PATH="$bundle_lib"
|
|
|
|
export XDG_CONFIG_DIRS="$bundle_etc"/xdg
|
|
|
|
export XDG_DATA_DIRS="$bundle_data"
|
|
|
|
|
|
|
|
#Set $PYTHON to point inside the bundle
|
2015-09-18 15:54:07 +00:00
|
|
|
export PYTHON="$bundle_macos/python"
|
2013-02-14 00:29:14 +00:00
|
|
|
export PYTHONHOME="$bundle_res"
|
|
|
|
#Add the bundle's python modules
|
|
|
|
PYTHONPATH="$bundle_lib:$PYTHONPATH"
|
|
|
|
PYTHONPATH="$bundle_lib/python/lib-dynload/:$PYTHONPATH"
|
|
|
|
PYTHONPATH="$bundle_lib/python/:$PYTHONPATH"
|
|
|
|
export PYTHONPATH
|
|
|
|
|
2015-12-10 21:31:37 +00:00
|
|
|
# Ensure deluged is available by adding macos dir to path.
|
|
|
|
PATH=$bundle_macos:$PATH
|
|
|
|
|
2013-02-14 00:29:14 +00:00
|
|
|
# We need a UTF-8 locale.
|
|
|
|
lang=`defaults read .GlobalPreferences AppleLocale 2>/dev/null`
|
|
|
|
if test "$?" != "0"; then
|
|
|
|
lang=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null | sed 's/_.*//'`
|
|
|
|
fi
|
|
|
|
LANG=""
|
|
|
|
if test "$lang" != ""; then
|
|
|
|
LANG="`grep \"\`echo $lang\`_\" /usr/share/locale/locale.alias | \
|
|
|
|
tail -n1 | sed 's/\./ /' | awk '{print $2}'`"
|
|
|
|
fi
|
|
|
|
if test "$LANG" == ""; then
|
|
|
|
export LANG="C"
|
|
|
|
else
|
|
|
|
export LANG="$LANG.utf8"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -f "$bundle_lib/charset.alias"; then
|
|
|
|
export CHARSETALIASDIR="$bundle_lib"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Extra arguments can be added in environment.sh.
|
|
|
|
EXTRA_ARGS=
|
|
|
|
if test -f "$bundle_res/environment.sh"; then
|
|
|
|
source "$bundle_res/environment.sh"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Strip out the argument added by the OS.
|
|
|
|
if [ "x`echo "x$1" | sed -e "s/^x-psn_.*//"`" == "x" ]; then
|
|
|
|
shift 1
|
|
|
|
fi
|
|
|
|
|
2014-02-19 17:13:04 +00:00
|
|
|
# Note that we're calling $PYTHON here to override the version used.
|
2015-12-10 21:31:37 +00:00
|
|
|
$EXEC "$PYTHON" "$bundle_macos/deluge-console-bin" "$@"
|