initcmd

package
v1.5.0-beta2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ArchiveOptionsText = "Directory of releases for installation"

Variables

View Source
var InitCmd = &cobra.Command{
	Use:     "init [flags] [USERNAME] [DIRECTORY]",
	GroupID: cmd.GROUP_SUBSYSTEMS,
	Short:   "Initialise a Geneos installation",
	Long: strings.ReplaceAll(`
Initialise a Geneos installation by creating the directory
structure and user configuration file, with the optional username and directory.

- |USERNAME| refers to the Linux username under which the |geneos| utility
  and all Geneos component instances will be run.
- |DIRECTORY| refers to the base / home directory under which all Geneos
  binaries, instances and working directories will be hosted.
  When specified in the |geneos init| command, DIRECTORY:
  - Must be defined as an absolute path.
    This syntax is used to distinguish it from USERNAME which is an
    optional parameter.
	If undefined, |${HOME}/geneos| will be used, or |${HOME}| in case
	the last component of |${HOME}| is equal to |geneos|.
  - Must have a parent directory that is writeable by the user running 
    the |geneos init| command or by the specified USERNAME.
  - Must be a non-existing directory or an empty directory (except for
	the "dot" files).
	**Note**:  In case DIRECTORY is an existing directory, you can use option
	|-F| to force the use of this directory.

The generic command syntax is as follows.
| geneos init [flags] [USERNAME] [DIRECTORY] |

When run with superuser privileges a USERNAME must be supplied and
only the configuration file for that user is created.
| sudo geneos init geneos /opt/itrs |

**Note**:
- The geneos directory hierarchy / structure / layout is defined at
  [Directory Layout](https://github.com/ITRS-Group/cordial/tree/main/tools/geneos#directory-layout).
`, "|", "`"),
	Example: strings.ReplaceAll(`
# To create a Geneos tree under home area
geneos init
# To create a new Geneos tree owned by user |geneos| under |/opt/itrs|
sudo geneos init geneos /opt/itrs
`, "|", "`"),
	SilenceUsage: true,
	Annotations: map[string]string{
		"wildcard":     "false",
		"needshomedir": "false",
	},

	RunE: func(command *cobra.Command, _ []string) (err error) {
		ct, args := cmd.CmdArgs(command)
		log.Debug().Msgf("%s %v", ct, args)

		if ct != nil {
			log.Error().Err(geneos.ErrInvalidArgs).Msg(ct.String())
			return geneos.ErrInvalidArgs
		}

		options, err := initProcessArgs(args)
		if err != nil {
			return err
		}

		if initCmdTemplates {
			return initTemplates(geneos.LOCAL)
		}

		if err = geneos.Init(geneos.LOCAL, options...); err != nil {
			log.Fatal().Err(err).Msg("")
		}

		if err = initMisc(command); err != nil {
			return
		}

		switch {
		case initCmdDemo:
			return initDemo(geneos.LOCAL, options...)
		case initCmdSAN:
			return initSan(geneos.LOCAL, options...)
		case initCmdAll != "":
			initAllCmdLicenseFile = initCmdAll
			return initAll(geneos.LOCAL, options...)
		default:
			return
		}
	},
}

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