zood/main.go

68 lines
1.4 KiB
Go
Raw Permalink Normal View History

2024-11-15 01:22:47 -06:00
// Copyright 2016 The go-qemu Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"embed"
"os"
2024-11-15 09:12:08 -06:00
"time"
2024-11-15 01:22:47 -06:00
"go.wit.com/dev/alexflint/arg"
2024-11-15 18:11:52 -06:00
"go.wit.com/lib/protobuf/zoopb"
2024-11-15 01:22:47 -06:00
"go.wit.com/log"
)
var VERSION string
2024-11-15 13:40:07 -06:00
var BUILDTIME string
2024-11-15 01:22:47 -06:00
//go:embed resources/*
var resources embed.FS
func main() {
var pp *arg.Parser
pp = arg.MustParse(&argv)
if pp == nil {
pp.WriteHelp(os.Stdout)
os.Exit(0)
}
2024-11-15 18:11:52 -06:00
if argv.Daemon {
// turn off timestamps for STDOUT (systemd adds them)
log.DaemonMode(true)
2024-11-15 01:22:47 -06:00
}
2024-11-15 18:11:52 -06:00
me = new(stuff)
me.zookeeper = "zookeeper.wit.com"
me.hostname, _ = os.Hostname()
me.pollDelay = 3 * time.Second
2024-11-15 18:11:52 -06:00
// what OS?
me.distro = initDistro()
2024-11-15 20:59:42 -06:00
// init my machine protobuf
me.machine = new(zoopb.Machine)
2024-11-15 21:05:03 -06:00
me.machine.Packages = new(zoopb.Packages)
2024-11-15 20:59:42 -06:00
me.machine.Hostname = me.hostname
2024-11-15 18:11:52 -06:00
// init the installed package list
2024-11-15 21:05:03 -06:00
// me.packages = new(zoopb.Packages)
2024-11-15 18:11:52 -06:00
initPackages()
2024-11-15 09:12:08 -06:00
go NewWatchdog()
2024-11-15 01:22:47 -06:00
startHTTP()
}