From fb372aad6f0cca032c1ed7577cd7747b4daca7fb Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 20 Jan 2025 01:40:14 -0600 Subject: code rearange --- main.go | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index b741233..7c52b7d 100644 --- a/main.go +++ b/main.go @@ -55,33 +55,11 @@ func main() { } if argv.Upgrade != nil { - if argv.DryRun { - log.Info("--dry-run", []string{"apt", "update"}) - } else { - result := shell.Run([]string{"apt", "update"}) - if result.Error != nil { - log.Info("apt update error:", result.Error) - badExit(result.Error) - } - } - - fmt.Println("Installed Packages:") - loop := me.forge.Machine.Wit.SortByName() - for loop.Scan() { - p := loop.Next() - // log.Info("apt install", name) - if me.forge.Machine.IsInstalled(p.Name) { - if argv.DryRun { - log.Info("--dry-run", []string{"apt", "install", p.Name}) - } else { - shell.RunRealtime([]string{"apt", "install", p.Name}) - } - } - } - okExit("installed") + doAptUpgrade() } if argv.ListPkgs != nil { + doAptList() log.DaemonMode(true) defer log.DaemonMode(false) fmt.Println("Installed Packages:") -- cgit v1.2.3