diff options
| author | Jeff Carr <[email protected]> | 2024-11-15 18:11:52 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-15 18:11:52 -0600 |
| commit | 9e4045f35e7b037f60b0a89a4368b9c4f77aa48d (patch) | |
| tree | 48a33398f5437ca41f18b2c159af3a30a7a66ef1 /main.go | |
| parent | 76db985cf1c3ca4ff792b82f6209e00ba5679b58 (diff) | |
use zoopb protobufs
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 57 |
1 files changed, 13 insertions, 44 deletions
@@ -16,11 +16,11 @@ package main import ( "embed" - "fmt" "os" "time" "go.wit.com/dev/alexflint/arg" + "go.wit.com/lib/protobuf/zoopb" "go.wit.com/log" ) @@ -39,53 +39,22 @@ func main() { os.Exit(0) } - me = new(stuff) - me.Zookeeper = "zookeeper.wit.com" - me.Hostname, _ = os.Hostname() - me.pollDelay = 3 * time.Second - - log.DaemonMode(true) - - installedPackages, err := getInstalledPackages() - if err != nil { - fmt.Println("Error:", err) - return - } - - log.Info("debian has", len(installedPackages), "installed") - /* - // Print the installed packages and their versions - for pkg, version := range installedPackages { - fmt.Printf("%s: %s\n", pkg, version) + if argv.Daemon { + // turn off timestamps for STDOUT (systemd adds them) + log.DaemonMode(true) } - */ - // Detect the Linux distribution - distro := detectDistro() - if distro == "" { - fmt.Println("Unable to detect Linux distribution.") - return - } - - fmt.Printf("Detected distribution: %s\n", distro) + me = new(stuff) + me.zookeeper = "zookeeper.wit.com" + me.hostname, _ = os.Hostname() + me.pollDelay = 3 * time.Second - // Get the list of installed packages for the detected distro - packages, err := getPackageList(distro) - if err != nil { - fmt.Println("Error:", err) - return - } + // what OS? + me.distro = initDistro() - /* - // Print the installed packages - fmt.Println("Installed Packages:") - for _, pkg := range packages { - if pkg != "" { - fmt.Println(pkg) - } - } - */ - log.Info(distro, "has", len(packages), "installed") + // init the installed package list + me.packages = new(zoopb.Packages) + initPackages() go NewWatchdog() |
