diff options
| -rw-r--r-- | argv.go | 8 | ||||
| -rw-r--r-- | doLinux.go | 8 | ||||
| -rw-r--r-- | doPublish.go | 7 | ||||
| -rw-r--r-- | doRdate.go | 24 | ||||
| -rw-r--r-- | exit.go | 1 | ||||
| -rw-r--r-- | main.go | 13 |
6 files changed, 29 insertions, 32 deletions
@@ -25,7 +25,7 @@ type args struct { Build *BuildCmd `arg:"subcommand:build" help:"build and install things"` ListPkgs *EmptyCmd `arg:"subcommand:list" help:"list all the packages on mirrors.wit.com"` Clone *CloneCmd `arg:"subcommand:clone" help:"go-clone from a gowebd repomap"` - Rdate *EmptyCmd `arg:"subcommand:rdate" help:"standard rdate"` + Linux *LinuxCmd `arg:"subcommand:linux" help:"helpful linux things"` Zoo *EmptyCmd `arg:"subcommand:zoo" help:"WIT Private Cloud info"` PB *ProtoCmd `arg:"subcommand:pb" help:"WIT Private Cloud info"` Upgrade *UpgradeCmd `arg:"subcommand:upgrade" help:"apt upgrade packages installed from mirrors.wit.com"` @@ -51,6 +51,10 @@ type ProtoCmd struct { Indentify string `arg:"--identify" help:"identify a .pb file"` } +type LinuxCmd struct { + Rdate *EmptyCmd `arg:"subcommand:rdate" help:"rdate: check the time from the network"` +} + type DebianCmd struct { Release bool `arg:"--release" help:"use go-deb --release"` DryRun bool `arg:"--dry-run" help:"only show what would be packaged"` @@ -133,7 +137,7 @@ func (args) Appname() string { } func (a args) DoAutoComplete(pb *prep.Auto) { - base := []string{"--version", "build", "upgrade", "git", "publish", "--force", "--all", "pb"} + base := []string{"--version", "build", "upgrade", "git", "publish", "--force", "--all", "pb", "linux"} if _, err := fhelp.CheckCmd("zood"); err == nil { base = append(base, "zoo") } @@ -20,7 +20,12 @@ func doUptime() { exitOnError([]string{"journalctl", "-b", "-1"}) // the last boot log } -func doRdate() { +func doRdate() (string, error) { + if !debian.AreRoot() { + exitOnError([]string{"rdate", "-p", "rdate.grid.wit.com"}) + exitOnError([]string{"date"}) + return "rdate ok", nil + } checkSuperuser() if _, err := fhelp.CheckCmd("rdate"); err != nil { @@ -33,4 +38,5 @@ func doRdate() { exitOnError([]string{"rdate", "rdate.grid.wit.com"}) exitOnError([]string{"hwclock", "-w"}) + return "", nil } diff --git a/doPublish.go b/doPublish.go index 8624e00..b15d92b 100644 --- a/doPublish.go +++ b/doPublish.go @@ -53,8 +53,13 @@ func doPublish() error { me.sh.BadExit("merge failed", nil) } - cmd = []string{"guireleaser", "--gui", "andlabs", "--auto-run", "quick"} + cmd = []string{"guireleaser", "--gui", "andlabs", "--auto-run"} + if !argv.All { + // only publish packages that have commits + cmd = append(cmd, "quick") + } if argv.Publish.Gomod { + // don't delete the .pb.go and go.* files from the master branch right away cmd = append(cmd, "--keep-gomod") } if _, err := shell.RunRealtimeError(cmd); err != nil { diff --git a/doRdate.go b/doRdate.go deleted file mode 100644 index 7896f1c..0000000 --- a/doRdate.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017-2025 WIT.COM Inc. All rights reserved. -// Use of this source code is governed by the GPL 3.0 - -package main - -import ( - "go.wit.com/lib/debian" - "go.wit.com/lib/fhelp" -) - -func doRdate() { - checkSuperuser() - - if _, err := fhelp.CheckCmd("rdate"); err != nil { - debian.AptInstallOrExit("rdate") - } - - if _, err := fhelp.CheckCmd("hwclock"); err != nil { - debian.AptInstallOrExit("util-linux-extra") - } - - exitOnError([]string{"rdate", "rdate.grid.wit.com"}) - exitOnError([]string{"hwclock", "-w"}) -} @@ -27,7 +27,6 @@ func areSuperuser() bool { func exitOnError(cmd []string) { var err error - log.Info("Running:", cmd) _, err = shell.RunVerbose(cmd) if err != nil { msg := fmt.Sprintf("Ran: %v", cmd) @@ -34,9 +34,16 @@ func main() { me.sh.GoodExit("") } - if argv.Rdate != nil { - doRdate() - me.sh.GoodExit("") + if argv.Linux != nil { + var s string + var err error + if argv.Linux.Rdate != nil { + s, err = doRdate() + } + if err != nil { + me.sh.BadExit(s, err) + } + me.sh.GoodExit(s) } if argv.Build != nil { |
