36 lines
868 B
Go
36 lines
868 B
Go
package cli
|
|
|
|
import (
|
|
"os/exec"
|
|
|
|
"coopcloud.tech/abra/cli/internal"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
var RC bool
|
|
var RCFlag = &cli.BoolFlag{
|
|
Name: "rc",
|
|
Value: false,
|
|
Destination: &RC,
|
|
Usage: "Insatll the latest Release Candidate",
|
|
}
|
|
|
|
// UpgradeCommand upgrades abra in-place.
|
|
var UpgradeCommand = &cli.Command{
|
|
Name: "upgrade",
|
|
Usage: "Upgrade abra",
|
|
Flags: []cli.Flag{RCFlag},
|
|
Action: func(c *cli.Context) error {
|
|
cmd := exec.Command("bash", "-c", "curl -s https://install.abra.coopcloud.tech | bash")
|
|
if RC {
|
|
cmd = exec.Command("bash", "-c", "curl -s https://git.coopcloud.tech/coop-cloud/abra/raw/branch/main/scripts/installer/installer | bash -s -- --rc")
|
|
}
|
|
logrus.Debugf("attempting to run '%s'", cmd)
|
|
if err := internal.RunCmd(cmd); err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
return nil
|
|
},
|
|
}
|