跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

managers_linux.go

38 行 · 1.2 KB历史下载
1// SPDX-FileCopyrightText: Copyright The Lima Authors
2// SPDX-License-Identifier: Apache-2.0
3
4package autostart
5
6import "github.com/lima-vm/lima/v2/pkg/autostart/systemd"
7
8// DaemonManager is not supported on Linux; use systemd user services instead.
9func DaemonManager(_ string) autoStartManager {
10 return &notSupportedManager{}
11}
12
13// Manager returns the autostart manager for Linux, with keep-alive enabled by default.
14func Manager() autoStartManager {
15 return ManagerWith(true)
16}
17
18// ManagerWith returns the autostart manager for Linux. keepAlive controls the systemd
19// unit's Restart= directive: on-failure when enabled, no when disabled.
20func ManagerWith(keepAlive bool) autoStartManager {
21 if !systemd.IsRunningSystemd() {
22 // TODO: add support for non-systemd Linux distros
23 return &notSupportedManager{}
24 }
25 restart := "on-failure"
26 if !keepAlive {
27 restart = "no"
28 }
29 return &TemplateFileBasedManager{
30 filePath: systemd.GetUnitPath,
31 template: systemd.Template,
32 enabler: systemd.EnableDisableUnit,
33 autoStartedIdentifier: systemd.AutoStartedUnitName,
34 requestStart: systemd.RequestStart,
35 requestStop: systemd.RequestStop,
36 extraTemplateVars: map[string]string{"Restart": restart},
37 }
38}