summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go8
-rw-r--r--doLinux.go8
-rw-r--r--doPublish.go7
-rw-r--r--doRdate.go24
-rw-r--r--exit.go1
-rw-r--r--main.go13
6 files changed, 29 insertions, 32 deletions
diff --git a/argv.go b/argv.go
index a474169..df33691 100644
--- a/argv.go
+++ b/argv.go
@@ -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")
}
diff --git a/doLinux.go b/doLinux.go
index 42db562..66ce02b 100644
--- a/doLinux.go
+++ b/doLinux.go
@@ -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"})
-}
diff --git a/exit.go b/exit.go
index 05cbd02..7e1a9b0 100644
--- a/exit.go
+++ b/exit.go
@@ -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)
diff --git a/main.go b/main.go
index de887c5..f70a605 100644
--- a/main.go
+++ b/main.go
@@ -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 {