// 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" "go.wit.com/log" ) // exits if not root func checkSuperuser() { if os.Getuid() != 0 { badExit(fmt.Errorf("you must be root")) } } func exitOnError(cmd []string) { var err error log.Info("Running:", cmd) _, err = shell.RunVerbose(cmd) if err != nil { badExit(err) } } func doUpgrade() error { var cmd []string checkSuperuser() cmd = []string{"apt", "update"} exitOnError(cmd) cmd = []string{"apt", "install", "wit-tools"} exitOnError(cmd) me.machine, _ = zoopb.InitMachine() doAptUpgrade() return nil }