mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 02:07:54 +00:00
blocks!
This commit is contained in:
parent
3b27bef1ac
commit
8bba0b88fd
@ -163,13 +163,20 @@ def write_pid(pid_file):
|
|||||||
|
|
||||||
def install_osx():
|
def install_osx():
|
||||||
""" Setup to run via launchd on OS X """
|
""" Setup to run via launchd on OS X """
|
||||||
hass_path = os.popen('which hass').read().strip()
|
with os.popen('which hass') as inp:
|
||||||
user = os.popen('whoami').read().strip()
|
hass_path = inp.read().strip()
|
||||||
|
|
||||||
|
with os.popen('whoami') as inp:
|
||||||
|
user = inp.read().strip()
|
||||||
|
|
||||||
cwd = os.path.dirname(__file__)
|
cwd = os.path.dirname(__file__)
|
||||||
template_path = os.path.join(cwd, 'startup', 'launchd.plist')
|
template_path = os.path.join(cwd, 'startup', 'launchd.plist')
|
||||||
|
|
||||||
|
with open(template_path, 'r', encoding='utf-8') as inp:
|
||||||
|
plist = inp.read()
|
||||||
|
|
||||||
plist = codecs.open(template_path, 'r', 'utf-8')
|
plist = codecs.open(template_path, 'r', 'utf-8')
|
||||||
|
|
||||||
plist = plist.read()
|
plist = plist.read()
|
||||||
|
|
||||||
plist = plist.replace("$HASS_PATH$", hass_path)
|
plist = plist.replace("$HASS_PATH$", hass_path)
|
||||||
@ -180,9 +187,9 @@ def install_osx():
|
|||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
|
||||||
plist_file = codecs.open(path, 'w', 'utf-8')
|
with codecs.open(path, 'w', 'utf-8') as outp:
|
||||||
plist_file.write(plist)
|
outp.write(plist)
|
||||||
plist_file.close()
|
|
||||||
os.popen('launchctl load -w -F ' + path)
|
os.popen('launchctl load -w -F ' + path)
|
||||||
|
|
||||||
print("Home Assistant has been installed. \
|
print("Home Assistant has been installed. \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user