Post Sun Oct 27, 2013 5:25 pm

atomic serviio-console script and symlink compatible

Hi,

I made this changes to the serviio-console.sh file to be able to symlink it to a bin folder and run automatically the server script.
I hope this changes become useful for other people that want to run serviio console with just one command or a desktop launcher.

The shebang should be changed to /bin/bash
  Code:
#!/bin/bash
### ====================================================================== ###
##                                                                          ##
##  Serviio Console ript                                                    ##
##                                                                          ##
### ====================================================================== ###

# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done

SERVIIO_CONSOLE_HOME="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
DIRNAME=`dirname $0`
PROGNAME=`basename $0`

if [ -z "$(pgrep serviio.sh)" ] ; then
   $SERVIIO_CONSOLE_HOME/bin/serviio.sh &
fi

# If you get a blank window and you're using a Non-Reparenting Windows Manager like Awesome or XMonad
wmname LG3D


This could be improved to work with Shell and be Darwin compatible.