diff options
| author | Jeff Carr <[email protected]> | 2025-10-03 05:50:14 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-03 05:50:14 -0500 |
| commit | 322ec42ce6da80915a80ed36f02bc6a15c238fb2 (patch) | |
| tree | 145e129edf7931fa4160e23d18504fde7688998b | |
| parent | 6e30c81f54f145b5b9cd1e428eaa44f8bdc5cd81 (diff) | |
try to make apt install --force to work
| -rw-r--r-- | argv.go | 9 | ||||
| -rw-r--r-- | doDebian.go | 18 | ||||
| -rw-r--r-- | doUpgrade.go | 32 | ||||
| -rw-r--r-- | main.go | 2 | ||||
| -rw-r--r-- | upgrade.go | 3 |
5 files changed, 37 insertions, 27 deletions
@@ -42,10 +42,9 @@ type args struct { } type DebianCmd struct { - DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` - Verbose bool `arg:"--verbose" help:"be loud about it"` - Force bool `arg:"--force" help:"rebuild everything"` - SkipInstall bool `arg:"--skip-install" help:"rebuild everything"` + DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` + Verbose bool `arg:"--verbose" help:"be loud about it"` + Force bool `arg:"--force" help:"rebuild everything"` } type UpgradeCmd struct { @@ -106,7 +105,7 @@ func (args) Appname() string { func (a args) DoAutoComplete(pb *prep.Auto) { if pb.Cmd == "" { - pb.Autocomplete3([]string{"--version", "push", "build", "debian", "upgrade", "macos", "git", "rdate"}) + pb.Autocomplete3([]string{"--version", "push", "build", "debian", "upgrade", "macos", "git", "rdate", "--force"}) } else { pb.SubCommand(pb.Goargs...) } diff --git a/doDebian.go b/doDebian.go index 63009b3..33e3f8d 100644 --- a/doDebian.go +++ b/doDebian.go @@ -47,21 +47,17 @@ func doDebian() { okExit("") } - if argv.Debian.SkipInstall { - log.Info("doDebian() skipping go install test") - } else { - me.forge.ConfigRill(16, 16) - stats := me.forge.RunOnRepos(found, doInstallRepo) - for s, stat := range stats { - log.Info(s, stat.Err) - if stat.Err != nil { - badExit(stat.Err) - } + me.forge.ConfigRill(16, 16) + stats := me.forge.RunOnRepos(found, doInstallRepo) + for s, stat := range stats { + log.Info(s, stat.Err) + if stat.Err != nil { + badExit(stat.Err) } } me.forge.ConfigRill(16, 16) - stats := me.forge.RunOnRepos(found, buildDeb) + stats = me.forge.RunOnRepos(found, buildDeb) for s, stat := range stats { log.Info(s, stat.Err) if stat.Err != nil { diff --git a/doUpgrade.go b/doUpgrade.go index 428c11d..fda9a04 100644 --- a/doUpgrade.go +++ b/doUpgrade.go @@ -13,16 +13,18 @@ import ( func doUpgrade() error { var cmd []string - checkSuperuser() + if !argv.DryRun { + checkSuperuser() - cmd = []string{"apt", "update"} - exitOnError(cmd) + cmd = []string{"apt", "update"} + exitOnError(cmd) - cmd = []string{"apt", "install", "wit-tools"} - exitOnError(cmd) + cmd = []string{"apt", "install", "wit-tools"} + exitOnError(cmd) + } me.machine, _ = zoopb.InitMachine() - doAptUpgrade() + // doAptUpgrade() fmt.Println("Installed Packages:") loop := me.machine.Wit.SortByName() @@ -30,19 +32,31 @@ func doUpgrade() error { p := loop.Next() // log.Info("apt install", p.Name) if p.Name == "" { - log.Info("odd /var/lib/apt/ list parse error. p.Name was blank (should be the package name)", p) + log.Infof("odd /var/lib/apt/ list parse error. p.Name was blank (should be the package name) p=%v\n", p) continue } if !me.machine.IsInstalled(p.Name) { continue } + found := me.machine.FindInstalledByName(p.Name) + + if found.Version == p.Version { + log.Info("name version already installed", p.Name, found.Version) + if !argv.Force { + continue + } + } else { + log.Info("name ver diff", p.Name, found.Version, p.Version) + } + if argv.DryRun { log.Info("should install package", p.Name) + continue } - if argv.Force || argv.Upgrade.Force { - cmd := []string{"apt", "remove", p.Name} + if argv.Force { + cmd := []string{"apt", "remove", "-y", p.Name} log.Info("Running:", cmd) exitOnError(cmd) @@ -57,7 +57,7 @@ func main() { } if argv.Upgrade != nil { - doAptUpgrade() + doUpgrade() } if argv.ListPkgs != nil { @@ -6,10 +6,10 @@ package main import ( "fmt" - "go.wit.com/lib/gui/shell" "go.wit.com/log" ) +/* func doAptUpgrade() { if argv.DryRun { log.Info("--dry-run", []string{"apt", "update"}) @@ -42,6 +42,7 @@ func doAptUpgrade() { } okExit("installed") } +*/ func doAptList() { log.DaemonMode(true) |
