From 2298fe68b9f8face648cf93d4a85a0ffea689dd7 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 3 Nov 2015 18:44:34 +0100 Subject: [PATCH] cleanup ctl --- ctl | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ctl b/ctl index d06340c..2b442d8 100755 --- a/ctl +++ b/ctl @@ -9,13 +9,13 @@ if [ -e oml ]; then fi BASE=`pwd` SYSTEM=`uname -s` -SYSTEM_=`uname -s` PLATFORM=`uname -m` if [ $SYSTEM == "Linux" ]; then - SYSTEM="${SYSTEM}_${PLATFORM}" + export PLATFORM_ENV="$BASE/platform/${SYSTEM}_${PLATFORM}" +else + export PLATFORM_ENV="$BASE/platform/$SYSTEM" fi -export PLATFORM_ENV="$BASE/platform/$SYSTEM" if [ $SYSTEM == "Darwin" ]; then export DYLD_FALLBACK_LIBRARY_PATH="$PLATFORM_ENV/lib" fi @@ -39,7 +39,7 @@ hash -r 2>/dev/null # allow more open files ulimit -S -n 2048 -if [ "$1" == "start" ]; then +function remove_loginscript { if [ $SYSTEM == "Darwin" ]; then launchd_name="com.openmedialibrary.loginscript" launchd_plist="$HOME/Library/LaunchAgents/${launchd_name}.plist" @@ -49,7 +49,11 @@ if [ "$1" == "start" ]; then rm "$launchd_plist" fi fi - if [ $SYSTEM_ == "Linux" ]; then +} + +if [ "$1" == "start" ]; then + remove_loginscript + if [ $SYSTEM == "Linux" ]; then if [ -e "$HOME/.config/autostart/openmedialibrary.desktop" ]; then rm "$HOME/.config/autostart/openmedialibrary.desktop" fi @@ -77,11 +81,7 @@ if [ "$1" == "debug" ]; then exec python3 oml server $@ fi if [ "$1" == "stop" ]; then - if [ $SYSTEM == "Darwin" ]; then - launchd_name="com.openmedialibrary.loginscript" - launchd_plist="$HOME/Library/LaunchAgents/${launchd_name}.plist" - test -e "$launchd_plist" && launchctl stop "$launchd_name" - fi + remove_loginscript test -e $PID && kill `cat $PID` test -e $PID && rm $PID exit $? @@ -97,12 +97,10 @@ if [ "$1" == "restart" ]; then fi fi if [ "$1" == "open" ]; then - #time to switch to python and use webbrowser.open_tab? - echo $SYSTEM if [ $SYSTEM == "Darwin" ]; then open "/Applications/Open Media Library.app" fi - if [ $SYSTEM_ == "Linux" ]; then + if [ $SYSTEM == "Linux" ]; then exec python3 "$NAME/oml/gtkwebkit.py" $@ fi exit 0