优化Docker和SSH命令,增强系统配置和安装流程

- 更新Docker安装命令,默认版本升级到20.10.24
- 新增Docker配置命令,支持主节点配置daemon.json
- 修改SSH相关命令,增加输出换行以提高可读性
- 优化Zsh插件安装,使用完整git路径
- 改进系统配置中的主机名生成逻辑,增加内网IP最后一段标识
- 完善操作系统类型检测,扩展Ubuntu类型系统识别
- 调整包管理操作中的输出格式
This commit is contained in:
zeaslity
2025-03-05 16:47:14 +08:00
parent 2e96490926
commit 5c2325b7e4
5 changed files with 102 additions and 16 deletions

View File

@@ -57,12 +57,22 @@ func (o *OS) Gather() {
o.OsFamily = id
}
// 判定系统是否是ubuntu类型
if o.OsFamily == "ubuntu" || o.OsFamily == "debian" || o.OsFamily == "linuxmint" || o.OsFamily == "elementary" || o.OsFamily == "pop" || o.OsFamily == "mint" || o.OsFamily == "kali" || o.OsFamily == "deepin" || o.OsFamily == "zorin" {
o.IsUbuntuType = true
} else {
// 设置系统为非ubuntus
o.IsUbuntuType = false
}
// 获取系统版本
if version, ok := osInfo["VERSION_ID"]; ok {
o.OsVersion = version
} else {
// 针对RedHat系特殊处理
if o.OsFamily == "centos" || o.OsFamily == "rhel" {
// 针对RedHat系特殊处理
if data, err := os.ReadFile("/etc/redhat-release"); err == nil {
re := regexp.MustCompile(`\d+(\.\d+)+`)
if match := re.FindString(string(data)); match != "" {
@@ -78,16 +88,15 @@ func (o *OS) Gather() {
o.Kernel = strings.TrimSpace(string(out))
}
// 检查包管理的方式
if strings.Contains(o.OsFamily, "centos") || strings.Contains(o.OsFamily, "rhel") {
o.IsUbuntuType = false
}
// 获取系统架构
o.Arch = runtime.GOARCH
// 获取系统发行版代号
o.OSReleaseCode = judgeUbuntuReleaseFromOsVersion(o.OsVersion)
if o.IsUbuntuType {
o.OSReleaseCode = judgeUbuntuReleaseFromOsVersion(o.OsVersion)
} else {
o.OSReleaseCode = "non-ubuntu"
}
}