🎨 大部分的 make 指令

This commit is contained in:
zhaoyupeng
2025-11-24 18:37:44 +08:00
commit 27fa38aef0
38 changed files with 4356 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
package cmd
import (
"os"
"path/filepath"
"gitea.loveuer.com/yizhisec/pkg3/logger"
"github.com/spf13/cobra"
"yizhisec.com/hsv2/forge/internal/opt"
"yizhisec.com/hsv2/forge/pkg/resource"
)
func makeLessDNS() *cobra.Command {
_cmd := &cobra.Command{
Use: "lessdns",
Short: "Build lessdns",
Long: `Build lessdns`,
RunE: func(cmd *cobra.Command, args []string) error {
var (
err error
location = filepath.Join(opt.Cfg.Make.Dir, "dependency", "less-dns")
)
logger.Info("MakeLessDNS: 开始构建 less-dns...")
if err = os.MkdirAll(location, 0755); err != nil {
logger.Error("MakeLessDNS: 创建目录失败s")
logger.Debug("MakeLessDNS: 创建目录失败: %s", err.Error())
return err
}
if err = os.WriteFile(filepath.Join(location, "deployment.yaml"), resource.YAMLLessDNS, 0644); err != nil {
logger.Error("MakeLessDNS: 写入文件失败")
logger.Debug("MakeLessDNS: 写入文件失败: %s", err.Error())
return err
}
logger.Info("MakeLessDNS: 构建 less-dns 成功!!!")
return nil
},
}
return _cmd
}