2
0
mirror of https://github.com/acepanel/helper.git synced 2026-02-04 05:31:49 +08:00

feat: 添加软链接

This commit is contained in:
2026-01-27 22:59:34 +08:00
parent 5dff285325
commit 53f88c0849
2 changed files with 11 additions and 7 deletions

View File

@@ -500,6 +500,9 @@ func (i *installer) downloadPanel(ctx context.Context, cfg *types.InstallConfig)
_ = os.Rename(cfg.SetupPath+"/panel/cli", "/usr/local/sbin/acepanel")
_, _ = i.executor.Run(ctx, "chmod", "+x", "/usr/local/sbin/acepanel")
// 设置软链接
_ = os.Symlink("/usr/local/sbin/acepanel", "/usr/local/sbin/ace")
return nil
}

View File

@@ -42,7 +42,7 @@ func (u *uninstaller) SetVerboseCallback(cb system.VerboseCallback) {
}
func (u *uninstaller) Uninstall(ctx context.Context, setupPath string, progress ProgressCallback) error {
// 检查root权限
// 检查 root 权限
if err := u.detector.CheckRoot(); err != nil {
return err
}
@@ -53,7 +53,7 @@ func (u *uninstaller) Uninstall(ctx context.Context, setupPath string, progress
}
// 停止服务
progress(i18n.T.Get("Stopping panel service"), i18n.T.Get("Stopping acepanel service..."))
progress(i18n.T.Get("Stopping panel service"), i18n.T.Get("Stopping AcePanel service..."))
_ = u.systemd.Stop(ctx, "acepanel")
_ = u.systemd.Disable(ctx, "acepanel")
@@ -62,21 +62,22 @@ func (u *uninstaller) Uninstall(ctx context.Context, setupPath string, progress
_ = u.systemd.RemoveServiceFile("acepanel")
_ = u.systemd.DaemonReload(ctx)
// 删除CLI工具
progress(i18n.T.Get("Removing CLI tool"), i18n.T.Get("Removing /usr/local/sbin/acepanel..."))
// 删除 CLI 工具
progress(i18n.T.Get("Removing CLI tool"), i18n.T.Get("Removing AcePanel CLI tool..."))
_ = os.Remove("/usr/local/sbin/acepanel")
_ = os.Remove("/usr/local/sbin/ace")
// 移除swap
// 移除 swap
progress(i18n.T.Get("Removing swap file"), i18n.T.Get("Removing swap file..."))
swapFile := setupPath + "/swap"
if _, err := os.Stat(swapFile); err == nil {
_, _ = u.executor.Run(ctx, "swapoff", swapFile)
_ = os.Remove(swapFile)
// 从fstab中删除swap条目
// 从 fstab 中删除 swap 条目
_, _ = u.executor.Run(ctx, "sed", "-i", "/swap/d", "/etc/fstab")
}
// 验证fstab
// 验证 fstab
result, _ := u.executor.Run(ctx, "mount", "-a")
if result != nil && result.ExitCode != 0 {
return errors.New(i18n.T.Get("fstab configuration error, please check /etc/fstab"))