2025-02-15 09:11:45 -06:00
|
|
|
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by the GPL 3.0
|
|
|
|
|
2024-11-15 18:49:52 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"go.wit.com/lib/protobuf/zoopb"
|
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
|
|
|
|
|
|
|
// init the installed package list
|
|
|
|
func initPackages() {
|
|
|
|
// Get the list of installed packages for the detected distro
|
|
|
|
newP, err := getPackageList(me.distro)
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error:", err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Print the installed packages and their versions
|
|
|
|
for pkg, version := range newP {
|
|
|
|
new1 := new(zoopb.Package)
|
|
|
|
new1.Name = pkg
|
|
|
|
new1.Version = version
|
2025-02-08 19:01:02 -06:00
|
|
|
me.packages.Append(new1)
|
2024-11-15 18:49:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
log.Info(me.hostname, "has distro", me.distro, "with", me.packages.Len(), "packages installed")
|
|
|
|
}
|
|
|
|
|
2025-02-08 19:01:02 -06:00
|
|
|
func addNew(name string, version string) {
|
2024-11-15 18:49:52 -06:00
|
|
|
new1 := new(zoopb.Package)
|
|
|
|
new1.Name = name
|
|
|
|
new1.Version = version
|
2025-02-08 19:01:02 -06:00
|
|
|
me.packages.Append(new1)
|
2024-11-15 18:49:52 -06:00
|
|
|
}
|