diff --git a/ctl b/ctl index 2bc9695..7d6349a 100755 --- a/ctl +++ b/ctl @@ -39,6 +39,20 @@ hash -r 2>/dev/null ulimit -S -n 2048 if [ "$1" == "start" ]; then + if [ $SYSTEM == "Darwin" ]; then + launchd_name="com.openmedialibrary.loginscript" + launchd_plist="$HOME/Library/LaunchAgents/${launchd_name}.plist" + if [ -e "$launchd_plist" ]; then + launchctl stop "$launchd_name" + launchctl unload "$launchd_plist" + rm "$launchd_plist" + fi + fi + if [ $SYSTEM == "Linux" ]; then + if [ -e "$HOME/.config/autostart/openmedialibrary.desktop" ]; then + rm "$HOME/.config/autostart/openmedialibrary.desktop" + fi + fi cd "$BASE/$NAME" if [ -e $PID ]; then if ps -p `cat "$PID"` > /dev/null; then diff --git a/install b/install index 7a96e3f..dd5ca70 100755 --- a/install +++ b/install @@ -49,9 +49,7 @@ class Install(Thread): os.symlink('openmedialibrary/ctl', 'ctl') self.status['progress'] = 0 self.status['installing'] = 'setup' - if sys.platform == 'darwin': - os.system('./ctl install_launcher') - elif sys.platform.startswith('linux'): + if sys.platform.startswith('linux'): apt_packages = '' yum_packages = '' try: diff --git a/oml/integration.py b/oml/integration.py index 88ecaf5..d4f5258 100644 --- a/oml/integration.py +++ b/oml/integration.py @@ -31,6 +31,7 @@ def uninstall_launcher(): os.unlink(f) def install_launchd(): + return name = 'com.openmedialibrary.loginscript' plist = os.path.expanduser('~/Library/LaunchAgents/%s.plist'%name) if os.path.exists(plist): @@ -68,15 +69,3 @@ Terminal=false Categories=Network;FileTransfer;P2P; ''' % {'base': root_dir}) - start = os.path.expanduser('~/.config/autostart/openmedialibrary.desktop') - makefolder(start) - with open(start, 'w') as fd: - fd.write('''[Desktop Entry] -Type=Application -Name=Start Open Media Library -Exec=%(base)s/ctl start -Icon=%(base)s/openmedialibrary/static/png/oml.png -Hidden=false -NoDisplay=false -X-GNOME-Autostart-enabled=true -''' % {'base': root_dir})