From cbeb74f1f3c8dff726f35b49d163fb3876f8a65f Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 19 Jun 2014 07:07:44 +0000 Subject: [PATCH] * fix relative symlink resolution issues (for homebrew) --- installer/appbundle/filebot.sh | 23 +++++++++++++++++++---- installer/appbundle/install.sh | 6 ------ 2 files changed, 19 insertions(+), 10 deletions(-) delete mode 100644 installer/appbundle/install.sh diff --git a/installer/appbundle/filebot.sh b/installer/appbundle/filebot.sh index d06ac49f..94237bfb 100644 --- a/installer/appbundle/filebot.sh +++ b/installer/appbundle/filebot.sh @@ -1,8 +1,23 @@ #!/bin/bash -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done -SOURCE="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +PRG="${BASH_SOURCE[0]}" -APP_ROOT="$SOURCE/../.." +# resolve relative symlinks +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi +done + +# make it fully qualified +WORKING_DIR=`pwd` +PRG_DIR=`dirname "$PRG"` +APP_ROOT=`cd "$PRG_DIR/../.." && pwd` + +# restore original working dir +cd "$WORKING_DIR" java -Djava.awt.headless=true -Dunixfs=false -DuseExtendedFileAttributes=true -DuseCreationDate=false -Djava.net.useSystemProxies=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Djna.nosys=true -Dapplication.deployment=app "-Djna.library.path=$APP_ROOT/Contents/MacOS" "-Djava.library.path=$APP_ROOT/Contents/MacOS" "-Dnet.filebot.AcoustID.fpcalc=$APP_ROOT/Contents/MacOS/fpcalc" -jar "$APP_ROOT"/Contents/Java/* "$@" diff --git a/installer/appbundle/install.sh b/installer/appbundle/install.sh deleted file mode 100644 index 8bf5006e..00000000 --- a/installer/appbundle/install.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done -SOURCE="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - -sudo ln -s -f "$SOURCE/filebot.sh" "/usr/bin/filebot"