forked from toolshed/abra
		
	
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package cli
 | 
						|
 | 
						|
import (
 | 
						|
	"fmt"
 | 
						|
	"os/exec"
 | 
						|
 | 
						|
	"coopcloud.tech/abra/cli/internal"
 | 
						|
	"github.com/sirupsen/logrus"
 | 
						|
	"github.com/urfave/cli/v2"
 | 
						|
)
 | 
						|
 | 
						|
var mainURL = "https://install.abra.coopcloud.tech"
 | 
						|
 | 
						|
var releaseCandidateURL = "https://git.coopcloud.tech/coop-cloud/abra/raw/branch/main/scripts/installer/installer"
 | 
						|
 | 
						|
// UpgradeCommand upgrades abra in-place.
 | 
						|
var UpgradeCommand = &cli.Command{
 | 
						|
	Name:  "upgrade",
 | 
						|
	Usage: "Upgrade Abra",
 | 
						|
	Description: `
 | 
						|
This command allows you to upgrade Abra in-place with the latest stable or
 | 
						|
release candidate.
 | 
						|
 | 
						|
If you would like to install the latest release candidate, please pass the
 | 
						|
"--rc" option. Please bear in mind that the latest release candidate may have
 | 
						|
some catastrophic bugs contained in it. In any case, thank you very much for
 | 
						|
testing efforts!
 | 
						|
`,
 | 
						|
	Flags: []cli.Flag{internal.RCFlag},
 | 
						|
	Action: func(c *cli.Context) error {
 | 
						|
		cmd := exec.Command("bash", "-c", fmt.Sprintf("curl -s %s | bash", mainURL))
 | 
						|
		if internal.RC {
 | 
						|
			cmd = exec.Command("bash", "-c", fmt.Sprintf("curl -s %s | bash -s -- --rc", releaseCandidateURL))
 | 
						|
		}
 | 
						|
 | 
						|
		logrus.Debugf("attempting to run '%s'", cmd)
 | 
						|
 | 
						|
		if err := internal.RunCmd(cmd); err != nil {
 | 
						|
			logrus.Fatal(err)
 | 
						|
		}
 | 
						|
 | 
						|
		return nil
 | 
						|
	},
 | 
						|
}
 |