mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
Merge branch 'confirm' into master
This commit is contained in:
commit
d96478b209
6
Makefile
6
Makefile
@ -106,7 +106,7 @@ run: testenv $(TESTENV_GPIO)
|
|||||||
&& cp /testenv/$(if $(P),$(P),$(DEFAULT_PLATFORM)).override.yaml /etc/kvmd/override.yaml \
|
&& cp /testenv/$(if $(P),$(P),$(DEFAULT_PLATFORM)).override.yaml /etc/kvmd/override.yaml \
|
||||||
&& nginx -c /etc/kvmd/nginx/nginx.conf -g 'user http; error_log stderr;' \
|
&& nginx -c /etc/kvmd/nginx/nginx.conf -g 'user http; error_log stderr;' \
|
||||||
&& ln -s $(TESTENV_VIDEO) /dev/kvmd-video \
|
&& ln -s $(TESTENV_VIDEO) /dev/kvmd-video \
|
||||||
&& $(if $(CMD),$(CMD),python -m kvmd.apps.kvmd) \
|
&& $(if $(CMD),$(CMD),python -m kvmd.apps.kvmd --run) \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ run-ipmi: testenv
|
|||||||
&& cp /usr/share/kvmd/configs.default/kvmd/*passwd /etc/kvmd \
|
&& cp /usr/share/kvmd/configs.default/kvmd/*passwd /etc/kvmd \
|
||||||
&& cp /usr/share/kvmd/configs.default/kvmd/main/$(if $(P),$(P),$(DEFAULT_PLATFORM)).yaml /etc/kvmd/main.yaml \
|
&& cp /usr/share/kvmd/configs.default/kvmd/main/$(if $(P),$(P),$(DEFAULT_PLATFORM)).yaml /etc/kvmd/main.yaml \
|
||||||
&& cp /testenv/$(if $(P),$(P),$(DEFAULT_PLATFORM)).override.yaml /etc/kvmd/override.yaml \
|
&& cp /testenv/$(if $(P),$(P),$(DEFAULT_PLATFORM)).override.yaml /etc/kvmd/override.yaml \
|
||||||
&& $(if $(CMD),$(CMD),python -m kvmd.apps.ipmi) \
|
&& $(if $(CMD),$(CMD),python -m kvmd.apps.ipmi --run) \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ run-vnc: testenv
|
|||||||
&& cp /usr/share/kvmd/configs.default/kvmd/*passwd /etc/kvmd \
|
&& cp /usr/share/kvmd/configs.default/kvmd/*passwd /etc/kvmd \
|
||||||
&& cp /usr/share/kvmd/configs.default/kvmd/main/$(if $(P),$(P),$(DEFAULT_PLATFORM)).yaml /etc/kvmd/main.yaml \
|
&& cp /usr/share/kvmd/configs.default/kvmd/main/$(if $(P),$(P),$(DEFAULT_PLATFORM)).yaml /etc/kvmd/main.yaml \
|
||||||
&& cp /testenv/$(if $(P),$(P),$(DEFAULT_PLATFORM)).override.yaml /etc/kvmd/override.yaml \
|
&& cp /testenv/$(if $(P),$(P),$(DEFAULT_PLATFORM)).override.yaml /etc/kvmd/override.yaml \
|
||||||
&& $(if $(CMD),$(CMD),python -m kvmd.apps.vnc) \
|
&& $(if $(CMD),$(CMD),python -m kvmd.apps.vnc --run) \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ Restart=always
|
|||||||
RestartSec=3
|
RestartSec=3
|
||||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||||
|
|
||||||
ExecStart=/usr/bin/kvmd-ipmi
|
ExecStart=/usr/bin/kvmd-ipmi --run
|
||||||
TimeoutStopSec=3
|
TimeoutStopSec=3
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|||||||
@ -9,7 +9,7 @@ Type=simple
|
|||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
|
||||||
ExecStart=/usr/bin/kvmd-vnc
|
ExecStart=/usr/bin/kvmd-vnc --run
|
||||||
TimeoutStopSec=3
|
TimeoutStopSec=3
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|||||||
@ -10,8 +10,8 @@ Restart=always
|
|||||||
RestartSec=3
|
RestartSec=3
|
||||||
AmbientCapabilities=CAP_NET_RAW
|
AmbientCapabilities=CAP_NET_RAW
|
||||||
|
|
||||||
ExecStart=/usr/bin/kvmd
|
ExecStart=/usr/bin/kvmd --run
|
||||||
ExecStopPost=/usr/bin/kvmd-cleanup
|
ExecStopPost=/usr/bin/kvmd-cleanup --run
|
||||||
TimeoutStopSec=10
|
TimeoutStopSec=10
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|||||||
@ -104,6 +104,7 @@ def init(
|
|||||||
prog: Optional[str]=None,
|
prog: Optional[str]=None,
|
||||||
description: Optional[str]=None,
|
description: Optional[str]=None,
|
||||||
add_help: bool=True,
|
add_help: bool=True,
|
||||||
|
check_run: bool=False,
|
||||||
argv: Optional[List[str]]=None,
|
argv: Optional[List[str]]=None,
|
||||||
**load: bool,
|
**load: bool,
|
||||||
) -> Tuple[argparse.ArgumentParser, List[str], Section]:
|
) -> Tuple[argparse.ArgumentParser, List[str], Section]:
|
||||||
@ -118,6 +119,9 @@ def init(
|
|||||||
help="Override config options list (like sec/sub/opt=value)")
|
help="Override config options list (like sec/sub/opt=value)")
|
||||||
args_parser.add_argument("-m", "--dump-config", dest="dump_config", action="store_true",
|
args_parser.add_argument("-m", "--dump-config", dest="dump_config", action="store_true",
|
||||||
help="View current configuration (include all overrides)")
|
help="View current configuration (include all overrides)")
|
||||||
|
if check_run:
|
||||||
|
args_parser.add_argument("--run", dest="run", action="store_true",
|
||||||
|
help="Run the service")
|
||||||
(options, remaining) = args_parser.parse_known_args(argv)
|
(options, remaining) = args_parser.parse_known_args(argv)
|
||||||
|
|
||||||
if options.dump_config:
|
if options.dump_config:
|
||||||
@ -135,6 +139,14 @@ def init(
|
|||||||
|
|
||||||
logging.captureWarnings(True)
|
logging.captureWarnings(True)
|
||||||
logging.config.dictConfig(config.logging)
|
logging.config.dictConfig(config.logging)
|
||||||
|
|
||||||
|
if check_run and not options.run:
|
||||||
|
raise SystemExit(
|
||||||
|
"To prevent accidental startup, you must specify the --run option to start.\n"
|
||||||
|
"Try the --help option to find out what this service does.\n"
|
||||||
|
"Make sure you understand exactly what you are doing!"
|
||||||
|
)
|
||||||
|
|
||||||
return (args_parser, remaining, config)
|
return (args_parser, remaining, config)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -78,6 +78,7 @@ def main(argv: Optional[List[str]]=None) -> None:
|
|||||||
config = init(
|
config = init(
|
||||||
prog="kvmd-cleanup",
|
prog="kvmd-cleanup",
|
||||||
description="Kill KVMD and clear resources",
|
description="Kill KVMD and clear resources",
|
||||||
|
check_run=True,
|
||||||
argv=argv,
|
argv=argv,
|
||||||
)[2].kvmd
|
)[2].kvmd
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,7 @@ def main(argv: Optional[List[str]]=None) -> None:
|
|||||||
config = init(
|
config = init(
|
||||||
prog="kvmd-ipmi",
|
prog="kvmd-ipmi",
|
||||||
description="IPMI to KVMD proxy",
|
description="IPMI to KVMD proxy",
|
||||||
|
check_run=True,
|
||||||
argv=argv,
|
argv=argv,
|
||||||
)[2].ipmi
|
)[2].ipmi
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,7 @@ def main(argv: Optional[List[str]]=None) -> None:
|
|||||||
prog="kvmd",
|
prog="kvmd",
|
||||||
description="The main Pi-KVM daemon",
|
description="The main Pi-KVM daemon",
|
||||||
argv=argv,
|
argv=argv,
|
||||||
|
check_run=True,
|
||||||
load_auth=True,
|
load_auth=True,
|
||||||
load_hid=True,
|
load_hid=True,
|
||||||
load_atx=True,
|
load_atx=True,
|
||||||
|
|||||||
@ -39,6 +39,7 @@ def main(argv: Optional[List[str]]=None) -> None:
|
|||||||
config = init(
|
config = init(
|
||||||
prog="kvmd-vnc",
|
prog="kvmd-vnc",
|
||||||
description="VNC to KVMD proxy",
|
description="VNC to KVMD proxy",
|
||||||
|
check_run=True,
|
||||||
argv=argv,
|
argv=argv,
|
||||||
)[2].vnc
|
)[2].vnc
|
||||||
|
|
||||||
|
|||||||
@ -57,6 +57,7 @@ def test_ok(tmpdir) -> None: # type: ignore
|
|||||||
"--set-options",
|
"--set-options",
|
||||||
f"kvmd/server/unix={kvmd_sock_path}",
|
f"kvmd/server/unix={kvmd_sock_path}",
|
||||||
f"kvmd/streamer/unix={ustreamer_sock_path}",
|
f"kvmd/streamer/unix={ustreamer_sock_path}",
|
||||||
|
"--run",
|
||||||
])
|
])
|
||||||
|
|
||||||
assert not os.path.exists(ustreamer_sock_path)
|
assert not os.path.exists(ustreamer_sock_path)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user