func Install(srcURL, pack, name, tmpDir string) error {
	log.WithFields(log.Fields{
		"tmp-dir": tmpDir,
		"pack":    pack,
		"name":    name,
	}).Debugln("downloading the package")

	// if the target dir does not exist, it gets created
	if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
		if err := os.MkdirAll(tmpDir, 0755); err != nil {
			return err
		}
		log.Debugf("created %s folder\n", tmpDir)
	}

	// artifact is the fully qualified path to the release
	artifact := path.Join(tmpDir, pack, name)
	log.WithField("artifact", artifact).Debugln("fully qualified name calculated")

	client := &getter.Client{
		Ctx:  context.Background(),
		Dst:  tmpDir,
		Mode: getter.ClientModeAny,
		Src:  srcURL,
	}

	if err := client.Get(); err != nil {
		return err
	}

	// checking that the file has been unpacked correctly and is available on
	// the tmp folder
	if _, err := os.Stat(artifact); os.IsNotExist(err) {
		return errors.New("download failed")
	}

	if _, err := ExecCmd("/bin/mv", artifact, "/usr/local/bin/"); err != nil {
		return fmt.Errorf("error in moving %s to /usr/local/bin: %v", artifact, err)
	}

	return nil
}
// Install downloads a package, decompress it and moves it into the path (at
// /usr/local/bin)
Install downloads a package, decompress it and moves it into the path (at
/usr/local/bin)
// Install downloads a package decompress it and moves it into the path ( at // / usr / local / bin )
func Install(srcURL, pack, name, tmpDir string) error {
	log.WithFields(log.Fields{
		"tmp-dir": tmpDir,
		"pack":    pack,
		"name":    name,
	}).Debugln("downloading the package")
	if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
		if err := os.MkdirAll(tmpDir, 0755); err != nil {
			return err
		}
		log.Debugf("created %s folder\n", tmpDir)
	}
	artifact := path.Join(tmpDir, pack, name)
	log.WithField("artifact", artifact).Debugln("fully qualified name calculated")
	client := &getter.Client{
		Ctx:  context.Background(),
		Dst:  tmpDir,
		Mode: getter.ClientModeAny,
		Src:  srcURL,
	}
	if err := client.Get(); err != nil {
		return err
	}
	if _, err := os.Stat(artifact); os.IsNotExist(err) {
		return errors.New("download failed")
	}
	if _, err := ExecCmd("/bin/mv", artifact, "/usr/local/bin/"); err != nil {
		return fmt.Errorf("error in moving %s to /usr/local/bin: %v", artifact, err)
	}
	return nil
}
func Install ( srcURL , pack , name , tmpDir string ) error { log . WithFields ( log . Fields { " " : tmpDir , " " : pack , " " : name , } ) . Debugln ( " " ) if _ , err := os . Stat ( tmpDir ) ; os . IsNotExist ( err ) { if err := os . MkdirAll ( tmpDir , 0755 ) ; err != nil { return err } log . Debugf ( " \n " , tmpDir ) } artifact := path . Join ( tmpDir , pack , name ) log . WithField ( " " , artifact ) . Debugln ( " " ) client := & getter . Client { Ctx : context . Background ( ) , Dst : tmpDir , Mode : getter . ClientModeAny , Src : srcURL , } if err := client . Get ( ) ; err != nil { return err } if _ , err := os . Stat ( artifact ) ; os . IsNotExist ( err ) { return errors . New ( " " ) } if _ , err := ExecCmd ( " " , artifact , " " ) ; err != nil { return fmt . Errorf ( " " , artifact , err ) } return nil }
Install downloads a package, decompress it and moves it into the path (at
usr/local/bin)
Install downloads a package decompress it and moves it into the path ( at usr / local / bin )
// if the target dir does not exist, it gets created // artifact is the fully qualified path to the release // checking that the file has been unpacked correctly and is available on // the tmp folder