Radarr/osx/Sonarr

59 lines
1.9 KiB
Plaintext
Raw Normal View History

2014-12-02 00:35:58 +00:00
#!/bin/sh
2014-12-02 00:35:58 +00:00
#get the bundle's MacOS directory full path
DIR=$(cd "$(dirname "$0")"; pwd)
2014-12-02 00:35:58 +00:00
#change these values to match your app
2017-01-05 19:42:02 +00:00
EXE_PATH="$DIR/Radarr.exe"
2014-12-02 00:35:58 +00:00
APPNAME="Sonarr"
2017-01-05 19:42:02 +00:00
2014-12-02 00:35:58 +00:00
#set up environment
if [[ -x '/opt/local/bin/mono' ]]; then
export PATH="/opt/local/bin:$PATH"
fi
export DYLD_FALLBACK_LIBRARY_PATH="$DIR"
if [ -e /Library/Frameworks/Mono.framework ]; then
MONO_FRAMEWORK_PATH=/Library/Frameworks/Mono.framework/Versions/Current
export PATH="$MONO_FRAMEWORK_PATH/bin:$PATH"
export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:$MONO_FRAMEWORK_PATH/lib"
fi
if [[ -f '/opt/local/lib/libsqlite3.0.dylib' ]]; then
export DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib:$DYLD_FALLBACK_LIBRARY_PATH"
fi
export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:$HOME/lib:/usr/local/lib:/lib:/usr/lib"
2014-12-02 00:35:58 +00:00
#mono version check
REQUIRED_MAJOR=3
REQUIRED_MINOR=10
2017-01-05 19:42:02 +00:00
2014-12-02 00:35:58 +00:00
VERSION_TITLE="Cannot launch $APPNAME"
2014-12-03 03:05:26 +00:00
VERSION_MSG="$APPNAME requires Mono Runtime Environment(MRE) $REQUIRED_MAJOR.$REQUIRED_MINOR or later."
2014-12-02 00:35:58 +00:00
DOWNLOAD_URL="http://www.mono-project.com/download/#download-mac"
2017-01-05 19:42:02 +00:00
2014-12-02 00:35:58 +00:00
MONO_VERSION="$(mono --version | grep 'Mono JIT compiler version ' | cut -f5 -d\ )"
# if [[ -o DEBUG ]]; then osascript -e "display dialog \"MONO_VERSION: $MONO_VERSION\""; fi
2014-12-02 00:35:58 +00:00
MONO_VERSION_MAJOR="$(echo $MONO_VERSION | cut -f1 -d.)"
MONO_VERSION_MINOR="$(echo $MONO_VERSION | cut -f2 -d.)"
if [ -z "$MONO_VERSION" ] \
|| [ $MONO_VERSION_MAJOR -lt $REQUIRED_MAJOR ] \
2017-01-05 19:42:02 +00:00
|| [ $MONO_VERSION_MAJOR -eq $REQUIRED_MAJOR -a $MONO_VERSION_MINOR -lt $REQUIRED_MINOR ]
2014-12-02 00:35:58 +00:00
then
osascript \
-e "set question to display dialog \"$VERSION_MSG\" with title \"$VERSION_TITLE\" buttons {\"Cancel\", \"Download...\"} default button 2" \
-e "if button returned of question is equal to \"Download...\" then open location \"$DOWNLOAD_URL\""
echo "$VERSION_TITLE"
echo "$VERSION_MSG"
exit 1
fi
2017-01-05 19:42:02 +00:00
2014-12-02 00:59:16 +00:00
MONO_EXEC="exec mono --debug"
2017-01-05 19:42:02 +00:00
2014-12-02 00:35:58 +00:00
#run app using mono
2017-01-05 19:42:02 +00:00
$MONO_EXEC "$EXE_PATH"