diff --git a/run b/run old mode 100644 new mode 100755 index 04584010..fd9f698b --- a/run +++ b/run @@ -1,7 +1,14 @@ -#!/bin/sh +#!/bin/bash PYTHON=`which python` -DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" cd $DIR -$PYTHON -m octoprint.server $@ \ No newline at end of file +$PYTHON -m octoprint.server $@