dont install launch agent on osx

This commit is contained in:
j 2015-11-03 00:28:09 +01:00
parent 28a1f3c268
commit a85023d560
3 changed files with 16 additions and 15 deletions

14
ctl
View file

@ -39,6 +39,20 @@ hash -r 2>/dev/null
ulimit -S -n 2048 ulimit -S -n 2048
if [ "$1" == "start" ]; then 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" cd "$BASE/$NAME"
if [ -e $PID ]; then if [ -e $PID ]; then
if ps -p `cat "$PID"` > /dev/null; then if ps -p `cat "$PID"` > /dev/null; then

View file

@ -49,9 +49,7 @@ class Install(Thread):
os.symlink('openmedialibrary/ctl', 'ctl') os.symlink('openmedialibrary/ctl', 'ctl')
self.status['progress'] = 0 self.status['progress'] = 0
self.status['installing'] = 'setup' self.status['installing'] = 'setup'
if sys.platform == 'darwin': if sys.platform.startswith('linux'):
os.system('./ctl install_launcher')
elif sys.platform.startswith('linux'):
apt_packages = '' apt_packages = ''
yum_packages = '' yum_packages = ''
try: try:

View file

@ -31,6 +31,7 @@ def uninstall_launcher():
os.unlink(f) os.unlink(f)
def install_launchd(): def install_launchd():
return
name = 'com.openmedialibrary.loginscript' name = 'com.openmedialibrary.loginscript'
plist = os.path.expanduser('~/Library/LaunchAgents/%s.plist'%name) plist = os.path.expanduser('~/Library/LaunchAgents/%s.plist'%name)
if os.path.exists(plist): if os.path.exists(plist):
@ -68,15 +69,3 @@ Terminal=false
Categories=Network;FileTransfer;P2P; Categories=Network;FileTransfer;P2P;
''' % {'base': root_dir}) ''' % {'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})