删除多个不再使用的配置文件和脚本,更新工作区配置,优化构建和上传脚本,增强项目结构的清晰度和可维护性。

This commit is contained in:
zeaslity
2025-03-27 23:26:39 +08:00
parent 7dabce3fa5
commit c2ca7eb6d7
25 changed files with 157 additions and 1414 deletions

View File

@@ -29,7 +29,7 @@ func addAcmeSubcommands(cmd *cobra.Command) {
log.Info("安装acme")
// 检查是否安装acme
if utils.FileExistAndNotNull("/usr/local/bin/acme.sh") {
if utils.FileExistAndNotNull("/root/.acme.sh/acme.sh") {
log.Info("acme已安装")
return
}
@@ -37,7 +37,7 @@ func addAcmeSubcommands(cmd *cobra.Command) {
// 下载 这个文件到 /usr/local/bin/acme.sh
ok, err := utils.DownloadFile(
acmeShUrl,
"/usr/local/bin/acme.sh",
"/tmp/acme.sh",
)
if !ok {
log.Error("下载acme.sh失败", err)
@@ -45,11 +45,11 @@ func addAcmeSubcommands(cmd *cobra.Command) {
}
// 设置权限
utils.PermissionFileExecute("/usr/local/bin/acme.sh")
utils.PermissionFileExecute("/tmp/acme.sh")
// 执行安装命令
op.RealTimeCommandExecutor([]string{
"/usr/local/bin/acme.sh",
"/tmp/acme.sh",
"--install-online",
"ice@gmail.com",
})

View File

@@ -1,30 +1,30 @@
package cmd
import (
"agent-wdd/config"
"agent-wdd/log"
"agent-wdd/utils"
"github.com/spf13/cobra"
"agent-wdd/host_info"
"agent-wdd/log"
"agent-wdd/utils"
"github.com/spf13/cobra"
)
func addConfigSubcommands(cmd *cobra.Command) {
showConfigCmd := &cobra.Command{
Use: "show",
Short: "显示agent运行配置",
Run: func(cmd *cobra.Command, args []string) {
log.Info("显示agent运行配置")
content := utils.ReadAllContentFromFile(config.WddConfigFilePath)
utils.BeautifulPrintListWithTitle(content, "agent运行配置")
log.Info("显示agent运行配置完成")
},
}
cmd.AddCommand(showConfigCmd)
showConfigCmd := &cobra.Command{
Use: "show",
Short: "显示agent运行配置",
Run: func(cmd *cobra.Command, args []string) {
log.Info("显示agent运行配置")
content := utils.ReadAllContentFromFile(host_info.WddConfigFilePath)
utils.BeautifulPrintListWithTitle(content, "agent运行配置")
log.Info("显示agent运行配置完成")
},
}
cmd.AddCommand(showConfigCmd)
}

View File

@@ -285,10 +285,10 @@ func installXray() {
}
// 添加执行权限
os.Chmod("/tmp/install-release.sh", 0777)
utils.PermissionFileExecute("/tmp/install-release.sh")
// 执行安装脚本
ok, resultLog := op.SingleLineCommandExecutor([]string{"/bin/bash", "/tmp/install-release.sh", "-u", "root", "install"})
ok, resultLog := op.RealTimeCommandExecutor([]string{"/bin/bash", "/tmp/install-release.sh", "-u", "root", "install"})
if !ok {
log.Error("Install Xray failed ! error is %s", resultLog)
return