diff options
| author | Jeff Carr <[email protected]> | 2025-10-02 21:15:27 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-02 21:15:27 -0500 |
| commit | 8ff037f0191a0034115a0eada3c8d9ed9557538f (patch) | |
| tree | 81786b0188c4abb58793bf766e3690b866936b03 /doUpgrade.go | |
| parent | 17d8a371af62f2abfd8ce612e79aa34e16ecaec2 (diff) | |
upgrade
Diffstat (limited to 'doUpgrade.go')
| -rw-r--r-- | doUpgrade.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/doUpgrade.go b/doUpgrade.go new file mode 100644 index 0000000..8c271b2 --- /dev/null +++ b/doUpgrade.go @@ -0,0 +1,35 @@ +// Copyright 2017-2025 WIT.COM Inc. All rights reserved. +// Use of this source code is governed by the GPL 3.0 + +package main + +import ( + "fmt" + "os" + + "go.wit.com/lib/gui/shell" + "go.wit.com/lib/protobuf/zoopb" +) + +// exits if not root +func checkSuperuser() { + if os.Getuid() != 0 { + badExit(fmt.Errorf("you must be root")) + } +} + +func doUpgrade() error { + var cmd []string + + checkSuperuser() + + cmd = []string{"apt", "update"} + shell.RunVerbose(cmd) + + cmd = []string{"apt", "install", "wit-tools"} + shell.RunVerbose(cmd) + + me.machine, _ = zoopb.InitMachine() + doAptUpgrade() + return nil +} |
