diff options
| -rw-r--r-- | argv.go | 16 | ||||
| -rw-r--r-- | doDroplet.go | 19 | ||||
| -rw-r--r-- | main.go | 4 |
3 files changed, 35 insertions, 4 deletions
@@ -24,10 +24,11 @@ type args struct { Git *GitCmd `arg:"subcommand:git" help:"git stuff"` 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"` + Clone *CloneCmd `arg:"subcommand:go-clone" help:"go-clone from a gowebd repomap"` 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"` + PB *ProtoCmd `arg:"subcommand:pb" help:"example .pb files"` + Droplet *DropletCmd `arg:"subcommand:drooplet" help:"do things on virtual machines"` Upgrade *UpgradeCmd `arg:"subcommand:upgrade" help:"apt upgrade packages installed from mirrors.wit.com"` Publish *PublishCmd `arg:"subcommand:publish" help:"publish packages"` RepoMap string `arg:"--repomap" help:"location of the repomap"` @@ -51,6 +52,10 @@ type ProtoCmd struct { Identify string `arg:"--identify" help:"identify a .pb file"` } +type DropletCmd struct { + Trim *EmptyCmd `arg:"subcommand:trim" help:"clean out stuff and power off vm"` +} + type LinuxCmd struct { Rdate *EmptyCmd `arg:"subcommand:rdate" help:"rdate: check the time from the network"` } @@ -144,7 +149,10 @@ func (args) ArgvGui() error { } func (a args) DoAutoComplete(pb *prep.Auto) { - base := []string{"--version", "build", "upgrade", "git", "publish", "--force", "--all", "pb", "linux"} + base := []string{"build", "upgrade", "git", "publish", "pb", "linux", "droplet"} + base = append(base, "--version", "--force", "--all") + + // add these only if installed if _, err := fhelp.CheckCmd("zood"); err == nil { base = append(base, "zoo") } @@ -152,7 +160,7 @@ func (a args) DoAutoComplete(pb *prep.Auto) { base = append(base, "forge") } if _, err := fhelp.CheckCmd("go-clone"); err == nil { - base = append(base, "clone") + base = append(base, "go-clone") } if areSuperuser() { base = append(base, "upgrade") diff --git a/doDroplet.go b/doDroplet.go new file mode 100644 index 0000000..eaa0fcc --- /dev/null +++ b/doDroplet.go @@ -0,0 +1,19 @@ +// 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/log" +) + +func doDroplet() (string, error) { + log.Info("apt clean") + log.Info("rm -rf /var/lib/apt/lists/*") + log.Info("rm -rf /var/log/journal/*") + log.Info("fstrim -a -v") + log.Info("poweroff") + log.Info("qemu-img convert -p -O qcow2 sid8gb.lab.wit.org.qcow2 new.qcow2") + + return "todo: make this", nil +} @@ -100,6 +100,10 @@ func main() { doUpgrade() } + if argv.Droplet != nil { + s, err = doDroplet() + } + if argv.Publish != nil { if err := doPublish(); err != nil { me.sh.BadExit("doPublish failed", err) |
