cleanup ctl

This commit is contained in:
j 2015-11-03 18:44:34 +01:00
parent b0fa92ca6a
commit 2298fe68b9

24
ctl
View file

@ -9,13 +9,13 @@ if [ -e oml ]; then
fi fi
BASE=`pwd` BASE=`pwd`
SYSTEM=`uname -s` SYSTEM=`uname -s`
SYSTEM_=`uname -s`
PLATFORM=`uname -m` PLATFORM=`uname -m`
if [ $SYSTEM == "Linux" ]; then if [ $SYSTEM == "Linux" ]; then
SYSTEM="${SYSTEM}_${PLATFORM}" export PLATFORM_ENV="$BASE/platform/${SYSTEM}_${PLATFORM}"
else
export PLATFORM_ENV="$BASE/platform/$SYSTEM"
fi fi
export PLATFORM_ENV="$BASE/platform/$SYSTEM"
if [ $SYSTEM == "Darwin" ]; then if [ $SYSTEM == "Darwin" ]; then
export DYLD_FALLBACK_LIBRARY_PATH="$PLATFORM_ENV/lib" export DYLD_FALLBACK_LIBRARY_PATH="$PLATFORM_ENV/lib"
fi fi
@ -39,7 +39,7 @@ hash -r 2>/dev/null
# allow more open files # allow more open files
ulimit -S -n 2048 ulimit -S -n 2048
if [ "$1" == "start" ]; then function remove_loginscript {
if [ $SYSTEM == "Darwin" ]; then if [ $SYSTEM == "Darwin" ]; then
launchd_name="com.openmedialibrary.loginscript" launchd_name="com.openmedialibrary.loginscript"
launchd_plist="$HOME/Library/LaunchAgents/${launchd_name}.plist" launchd_plist="$HOME/Library/LaunchAgents/${launchd_name}.plist"
@ -49,7 +49,11 @@ if [ "$1" == "start" ]; then
rm "$launchd_plist" rm "$launchd_plist"
fi fi
fi fi
if [ $SYSTEM_ == "Linux" ]; then }
if [ "$1" == "start" ]; then
remove_loginscript
if [ $SYSTEM == "Linux" ]; then
if [ -e "$HOME/.config/autostart/openmedialibrary.desktop" ]; then if [ -e "$HOME/.config/autostart/openmedialibrary.desktop" ]; then
rm "$HOME/.config/autostart/openmedialibrary.desktop" rm "$HOME/.config/autostart/openmedialibrary.desktop"
fi fi
@ -77,11 +81,7 @@ if [ "$1" == "debug" ]; then
exec python3 oml server $@ exec python3 oml server $@
fi fi
if [ "$1" == "stop" ]; then if [ "$1" == "stop" ]; then
if [ $SYSTEM == "Darwin" ]; then remove_loginscript
launchd_name="com.openmedialibrary.loginscript"
launchd_plist="$HOME/Library/LaunchAgents/${launchd_name}.plist"
test -e "$launchd_plist" && launchctl stop "$launchd_name"
fi
test -e $PID && kill `cat $PID` test -e $PID && kill `cat $PID`
test -e $PID && rm $PID test -e $PID && rm $PID
exit $? exit $?
@ -97,12 +97,10 @@ if [ "$1" == "restart" ]; then
fi fi
fi fi
if [ "$1" == "open" ]; then if [ "$1" == "open" ]; then
#time to switch to python and use webbrowser.open_tab?
echo $SYSTEM
if [ $SYSTEM == "Darwin" ]; then if [ $SYSTEM == "Darwin" ]; then
open "/Applications/Open Media Library.app" open "/Applications/Open Media Library.app"
fi fi
if [ $SYSTEM_ == "Linux" ]; then if [ $SYSTEM == "Linux" ]; then
exec python3 "$NAME/oml/gtkwebkit.py" $@ exec python3 "$NAME/oml/gtkwebkit.py" $@
fi fi
exit 0 exit 0