install

package
v0.24.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:                   "install <service1> <service2> ... (all by default)",
	Short:                 "Install kitsune",
	Long:                  "Install all kitsune services or specifie what you want",
	DisableFlagParsing:    true,
	DisableAutoGenTag:     true,
	DisableFlagsInUseLine: true,
	DisableSuggestions:    true,
	GroupID:               "framework",
	PreRunE: func(cmd *cobra.Command, args []string) error {
		if config.USER.Uid != "0" {
			return fmt.Errorf("require admin access")
		}

		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		argsMap := make(map[string]bool)
		for _, arg := range args {
			argsMap[arg+"-"+runtime.GOOS+"-"+runtime.GOARCH] = true
		}

		logger.Message("looking for latest version " + color.CyanString(latest().TagName))
		var err error = nil

		for _, asset := range latest().Assets {
			isKitsune := strings.Contains(asset.Name, "kitsune-"+runtime.GOOS+"-"+runtime.GOARCH)
			isService := strings.Contains(asset.Name, runtime.GOOS+"-"+runtime.GOARCH)

			if len(args) == 0 || argsMap[asset.Name] || isKitsune {
				if isKitsune {
					err = asset.Download(config.PATH_BIN)
				} else if isService {
					err = asset.Download(config.PATH_SERVICES)
				}

				if err != nil {
					return err
				}
			}
		}

		return err
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL