use ctl install_launcher, only start via launchctl if launcher is installed
This commit is contained in:
parent
0731e8c963
commit
01e66b647a
2 changed files with 9 additions and 28 deletions
|
@ -5,9 +5,13 @@ if [[ ! -e "/usr/sbin/miredo" ]]; then
|
|||
open -W ../Resources/miredo-osx-v1.2.6-beta2.pkg
|
||||
fi
|
||||
if [[ -e "$BASE" ]]; then
|
||||
launchctl start com.openmedialibrary.loginscript
|
||||
open "$BASE/openmedialibrary/static/html/load.html"
|
||||
if [[ -e "$HOME/Library/LaunchAgents/com.openmedialibrary.loginscript.plist" ]]; then
|
||||
launchctl start com.openmedialibrary.loginscript
|
||||
open "$BASE/openmedialibrary/static/html/load.html"
|
||||
else
|
||||
"$BASE/ctl" open
|
||||
fi
|
||||
else
|
||||
python install.py "$BASE" &
|
||||
open ../Resources/static/install.html
|
||||
python install.py "$BASE" &
|
||||
open ../Resources/static/install.html
|
||||
fi
|
||||
|
|
|
@ -85,7 +85,7 @@ class Install(Thread):
|
|||
self.status["progress"] = 1
|
||||
with open('config/release.json', 'w') as fd:
|
||||
json.dump(release, fd, indent=2)
|
||||
self.install_launchd()
|
||||
os.system("./ctl install_launcher")
|
||||
self.status = {"done": True}
|
||||
self.httpd.shutdown()
|
||||
|
||||
|
@ -111,29 +111,6 @@ class Install(Thread):
|
|||
data = json.load(u)
|
||||
return data
|
||||
|
||||
def install_launchd(self):
|
||||
name = 'com.openmedialibrary.loginscript'
|
||||
plist = os.path.expanduser('~/Library/LaunchAgents/%s.plist'%name)
|
||||
with open(plist, 'w') as f:
|
||||
f.write('''<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>%s</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>%s/ctl</string>
|
||||
<string>start</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>''' % (name, self.target))
|
||||
os.system('launchctl load "%s"' % plist)
|
||||
os.system('launchctl start %s' % name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) == 1:
|
||||
target = os.path.join(os.curdir, 'openmedialibrary')
|
||||
|
|
Loading…
Reference in a new issue