1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Remove macos install scripts (#161506)

This commit is contained in:
Marc Mueller
2026-01-24 03:09:52 +01:00
committed by GitHub
parent 6c1b44aae2
commit 374d7478f6
2 changed files with 0 additions and 105 deletions

View File

@@ -1,67 +0,0 @@
"""Script to install/uninstall HA into OS X."""
import os
import time
# mypy: allow-untyped-calls, allow-untyped-defs
def install_osx():
"""Set up to run via launchd on OS X."""
with os.popen("which hass") as inp:
hass_path = inp.read().strip()
with os.popen("whoami") as inp:
user = inp.read().strip()
template_path = os.path.join(os.path.dirname(__file__), "launchd.plist")
with open(template_path, encoding="utf-8") as tinp:
plist = tinp.read()
plist = plist.replace("$HASS_PATH$", hass_path)
plist = plist.replace("$USER$", user)
path = os.path.expanduser("~/Library/LaunchAgents/org.homeassistant.plist")
try:
with open(path, "w", encoding="utf-8") as outp:
outp.write(plist)
except OSError as err:
print(f"Unable to write to {path}", err)
return
os.popen(f"launchctl load -w -F {path}")
print("Home Assistant has been installed. Open it here: http://localhost:8123")
def uninstall_osx():
"""Unload from launchd on OS X."""
path = os.path.expanduser("~/Library/LaunchAgents/org.homeassistant.plist")
os.popen(f"launchctl unload {path}")
print("Home Assistant has been uninstalled.")
def run(args: list[str]) -> int:
"""Handle OSX commandline script."""
commands = "install", "uninstall", "restart"
if not args or args[0] not in commands:
print("Invalid command. Available commands:", ", ".join(commands))
return 1
if args[0] == "install":
install_osx()
return 0
if args[0] == "uninstall":
uninstall_osx()
return 0
if args[0] == "restart":
uninstall_osx()
# A small delay is needed on some systems to let the unload finish.
time.sleep(0.5)
install_osx()
return 0
raise ValueError(f"Invalid command {args[0]}")

View File

@@ -1,38 +0,0 @@
<?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.homeassistant</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin/:/usr/bin:/usr/sbin:/sbin:$PATH</string>
<key>LC_CTYPE</key>
<string>UTF-8</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/homeassistant.log</string>
<key>StandardOutPath</key>
<string>/Users/$USER$/Library/Logs/homeassistant.log</string>
</dict>
</plist>