Fix Mac OS install script (#2691)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2016-07-31 20:58:39 -07:00
1 parent 483b0045fc
commit 6f23869a89
3 files changed
+10 -4

No files matched your search

+9 -2
View File
@@ -5,8 +5,15 @@ import os
def run(args: str) -> int:
"""Run a script."""
scripts = [fil[:-3] for fil in os.listdir(os.path.dirname(__file__))
if fil.endswith('.py') and fil != '__init__.py']
scripts = []
path = os.path.dirname(__file__)
for fil in os.listdir(path):
if fil == '__pycache__':
continue
elif os.path.isdir(os.path.join(path, fil)):
scripts.append(fil)
elif fil != '__init__.py' and fil.endswith('.py'):
scripts.append(fil[:-3])
if not args:
print('Please specify a script to run.')
@@ -11,8 +11,7 @@ def install_osx():
with os.popen('whoami') as inp:
user = inp.read().strip()
cwd = os.path.dirname(__file__)
template_path = os.path.join(cwd, 'startup', 'launchd.plist')
template_path = os.path.join(os.path.dirname(__file__), 'launchd.plist')
with open(template_path, 'r', encoding='utf-8') as inp:
plist = inp.read()
+36
View File
@@ -0,0 +1,36 @@
<?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>org.homeassitant</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin/:/usr/bin:$PATH</string>
</dict>
<key>Program</key>
<string>$HASS_PATH$</string>
<key>AbandonProcessGroup</key>
<false/>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>StandardErrorPath</key>
<string>/Users/$USER$/Library/Logs/homeassitant.log</string>
<key>StandardOutPath</key>
<string>/Users/$USER$/Library/Logs/homeassitant.log</string>
</dict>
</plist>