-
Notifications
You must be signed in to change notification settings - Fork 0
/
tinyMediaManagerOSX.sh
84 lines (71 loc) · 3.06 KB
/
tinyMediaManagerOSX.sh
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh
#####################################################################################
# This is a "kickstarter" for OSX; we need to do some logic here, because in OSX
# there is no way to provide an updater and the app itself inside one app.
# There is exactly one "entry point" per .app which is defined in the info.plist.
# In our case this is JavaApplicationStub which is a simple shellscript that launches
# this shellscript. Here we do differend checks
#
# a) search the right Java JVM
# b) decide whether we need to launch the updater or launch tmm
#
#####################################################################################
# find the path where to execute tmm
PRG=$0
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '^.*-> \(.*\)$' 2>/dev/null`
if expr "$link" : '^/' 2> /dev/null >/dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
progdir=`dirname "$PRG"`
# check if tmm has been executed in a read only environment
if [ ! -w "$progdir" ]; then
osascript -e "tell application \"System Events\" to display dialog \"ERROR launching tinyMediaManager!
You need to execute tinyMediaManager from a writeable location (e.g. the Applications folder)\" with title \"tinyMediaManager\" buttons {\" OK \"} default button 1 with icon path to resource \"tmm.icns\" in bundle (path to me)"
exit 1
fi
# By default Mac OS X LC_ALL is set to "C", which means files with special characters will not be found.
export LC_ALL="en_US.UTF-8"
# --- rfuehrer: start ---
ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
"$ABSOLUTE_PATH/openjdk_portable_downloader.sh"
JAVACMD=$(find "$ABSOLUTE_PATH" -type f -name "java" -perm +0111 -print | head -n 1)
# # search for the right JVM - priority is java 8
# if [ -x /usr/libexec/java_home ]; then
# JAVA_HOME="`/usr/libexec/java_home -v 1.8 -F`"
# export JAVA_HOME
# fi
# if [ ! -f "$JAVA_HOME/bin/java" -a -x "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java" ]; then
# JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
# export JAVA_HOME
# fi
# JAVACMD="${JAVA_HOME}/bin/java"
#if [ ! -f "$JAVACMD" -o ! -x "$JAVACMD" ]; then
# # display error message with applescript
# osascript -e "tell application \"System Events\" to display dialog \"ERROR launching tinyMediaManager!
##You need to have JAVA installed on your Mac!
##Visit http://java.com for more information...\" with title \"tinyMediaManager\" buttons {\" OK \"} default button 1 with icon path to resource \"tmm.icns\" in bundle (path to me)"
#
# # and open java.com
# open http://java.com
#
# # exit with error
# exit 1
#fi
# --- rfuehrer: end ---
# have a look if we need to launch the updater or tmm directly
if [ -f tmm.jar ]; then
ARGS="-Dsilent=noupdate"
else
ARGS="-Xdock:name=`tinyMediaManager updater`"
ARGS="$ARGS -Xdock:icon=../tmm.icns"
fi
ARGS="$ARGS -Djava.net.preferIPv4Stack=true -Dappbase=http://www.tinymediamanager.org/"
# execute it :)
# --- rfuehrer: start ---
exec "$JAVACMD" ${ARGS} -jar getdown.jar .
# --- rfuehrer: end ---