feat: add gateway install scope prompts (#1374)
This commit is contained in:
parent
a86b487349
commit
168a8e2e35
4 changed files with 207 additions and 13 deletions
|
|
@ -2240,7 +2240,9 @@ def setup_gateway(config: dict):
|
|||
from hermes_cli.gateway import (
|
||||
_is_service_installed,
|
||||
_is_service_running,
|
||||
systemd_install,
|
||||
has_conflicting_systemd_units,
|
||||
install_linux_gateway_from_setup,
|
||||
print_systemd_scope_conflict_warning,
|
||||
systemd_start,
|
||||
systemd_restart,
|
||||
launchd_install,
|
||||
|
|
@ -2252,6 +2254,10 @@ def setup_gateway(config: dict):
|
|||
service_running = _is_service_running()
|
||||
|
||||
print()
|
||||
if _is_linux and has_conflicting_systemd_units():
|
||||
print_systemd_scope_conflict_warning()
|
||||
print()
|
||||
|
||||
if service_running:
|
||||
if prompt_yes_no(" Restart the gateway to pick up changes?", True):
|
||||
try:
|
||||
|
|
@ -2277,15 +2283,18 @@ def setup_gateway(config: dict):
|
|||
True,
|
||||
):
|
||||
try:
|
||||
installed_scope = None
|
||||
did_install = False
|
||||
if _is_linux:
|
||||
systemd_install(force=False)
|
||||
installed_scope, did_install = install_linux_gateway_from_setup(force=False)
|
||||
else:
|
||||
launchd_install(force=False)
|
||||
did_install = True
|
||||
print()
|
||||
if prompt_yes_no(" Start the service now?", True):
|
||||
if did_install and prompt_yes_no(" Start the service now?", True):
|
||||
try:
|
||||
if _is_linux:
|
||||
systemd_start()
|
||||
systemd_start(system=installed_scope == "system")
|
||||
elif _is_macos:
|
||||
launchd_start()
|
||||
except Exception as e:
|
||||
|
|
@ -2295,6 +2304,8 @@ def setup_gateway(config: dict):
|
|||
print_info(" You can try manually: hermes gateway install")
|
||||
else:
|
||||
print_info(" You can install later: hermes gateway install")
|
||||
if _is_linux:
|
||||
print_info(" Or as a boot-time service: sudo hermes gateway install --system")
|
||||
print_info(" Or run in foreground: hermes gateway")
|
||||
else:
|
||||
print_info("Start the gateway to bring your bots online:")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue