summaryrefslogtreecommitdiff
path: root/apt.go
blob: bdac375b6a8ffb9bddda182007926eebeb30ecff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
		if me.packages.Append(new1) {
			// log.Info("added", new1.Name, "ok")
		} else {
			log.Info("added", new1.Name, "failed")
		}
	}

	log.Info(me.hostname, "has distro", me.distro, "with", me.packages.Len(), "packages installed")
}