client flow

This commit is contained in:
2026-03-19 19:40:45 +00:00
parent 8c00a42663
commit 93527bb725
5 changed files with 377 additions and 0 deletions

View File

@@ -61,3 +61,47 @@ func DetectSambaInstallPlan(lookPath LookPathFunc, isRoot bool) (InstallPlan, bo
return InstallPlan{}, false
}
func DetectCIFSUtilsInstallPlan(lookPath LookPathFunc, isRoot bool) (InstallPlan, bool) {
sudoPrefix := []string{}
if !isRoot {
if _, err := lookPath("sudo"); err == nil {
sudoPrefix = []string{"sudo"}
}
}
type managerPlan struct {
bin string
name string
command []string
}
plans := []managerPlan{
{bin: "dnf", name: "dnf", command: []string{"dnf", "install", "-y", "cifs-utils"}},
{bin: "yum", name: "yum", command: []string{"yum", "install", "-y", "cifs-utils"}},
{bin: "pacman", name: "pacman", command: []string{"pacman", "-Sy", "--noconfirm", "cifs-utils"}},
{bin: "zypper", name: "zypper", command: []string{"zypper", "--non-interactive", "install", "cifs-utils"}},
{bin: "apk", name: "apk", command: []string{"apk", "add", "cifs-utils"}},
}
if _, err := lookPath("apt-get"); err == nil {
return InstallPlan{
ManagerName: "apt",
Command: append(
append([]string{}, sudoPrefix...),
"sh", "-c", "apt-get update && apt-get install -y cifs-utils",
),
}, true
}
for _, plan := range plans {
if _, err := lookPath(plan.bin); err == nil {
return InstallPlan{
ManagerName: plan.name,
Command: append(append([]string{}, sudoPrefix...), plan.command...),
}, true
}
}
return InstallPlan{}, false
}