// InstallWithAptGetIfNeeded ...
514809
func InstallWithAptGetIfNeeded(aptGetDep stepmanModels.AptGetDepModel, isCIMode bool) error {
	isDepInstalled := false
	// First do a "which", to see if the binary is available.
	// Can be available from another source, not just from brew,
	// e.g. it's common to use NVM or similar to install and manage the Node.js version.
	{
		if out, err := command.RunCommandAndReturnCombinedStdoutAndStderr("which", aptGetDep.GetBinaryName()); err != nil {
			if err.Error() == "exit status 1" && out == "" {
				isDepInstalled = false
			} else {
				// unexpected `which` error
				return fmt.Errorf("which (%s) failed -- out: (%s) err: (%s)", aptGetDep.Name, out, err)
			}
		} else if out != "" {
			isDepInstalled = true
		} else {
			// no error but which's output was empty
			return fmt.Errorf("which (%s) failed -- no error (exit code 0) but output was empty", aptGetDep.Name)
		}
	}

	// then do a package manager specific lookup
	{
		if !isDepInstalled {
			// which did not find the binary, also check in brew,
			// whether the package is installed
			isDepInstalled = checkIfAptPackageInstalled(aptGetDep.Name)
		}
	}

	if !isDepInstalled {
		// Tool isn't installed -- install it...
		if !isCIMode {
			log.Infof(`This step requires "%s" to be available, but it is not installed.`, aptGetDep.GetBinaryName())
			allow, err := goinp.AskForBoolWithDefault(`Would you like to install the "`+aptGetDep.Name+`" package with apt-get?`, true)
			if err != nil {
				return err
			}
			if !allow {
				return errors.New("(" + aptGetDep.Name + ") is required for step")
			}
		}

		if !isAptGetUpdated {
			cmd := command.New("sudo", "apt-get", "update")
			log.Infof(cmd.PrintableCommandArgs())
			if err := cmd.SetStdout(os.Stdout).SetStderr(os.Stderr).Run(); err != nil {
				log.Errorf("apt-get update failed, error: %s", err)
			}
			isAptGetUpdated = true
		}

		log.Infof("(%s) isn't installed, installing...", aptGetDep.Name)
		if cmdOut, err := command.RunCommandAndReturnCombinedStdoutAndStderr("sudo", "apt-get", "-y", "install", aptGetDep.Name); err != nil {
			log.Errorf("sudo apt-get -y install %s failed -- out: (%s) err: (%s)", aptGetDep.Name, cmdOut, err)
			return err
		}

		log.Infof(" * "+colorstring.Green("[OK]")+" %s installed", aptGetDep.Name)
	}

	return nil
}
856887
func (i *LocalInstaller) Install() error {
	if !isPlugin(i.Source) {
		return ErrMissingMetadata
	}
	return i.link(i.Source)
}
504701
func Install(plist Plist, wait time.Duration, log Log) error {
	service := NewService(plist.label)
	service.SetLogger(log)
	return service.Install(plist, wait)
}
154617
func InstallInternalLegacyProject(scheme *runtime.Scheme) {
	InstallExternalLegacyProject(scheme)

	schemeBuilder := runtime.NewSchemeBuilder(
		addUngroupifiedInternalProjectTypes,

		addLegacyProjectFieldSelectorKeyConversions,
		projectv1helpers.RegisterDefaults,
		projectv1helpers.RegisterConversions,
	)
	utilruntime.Must(schemeBuilder.AddToScheme(scheme))
}
998778
func (e *endpointDetails) Install(mux oauthserver.Mux, paths ...string) {
	for _, prefix := range paths {
		mux.HandleFunc(path.Join(prefix, urls.RequestTokenEndpoint), e.readyHandler(e.requestToken))
		mux.HandleFunc(path.Join(prefix, urls.DisplayTokenEndpoint), e.readyHandler(e.displayToken))
		mux.HandleFunc(path.Join(prefix, urls.ImplicitTokenEndpoint), e.implicitToken)
	}
}
1131114
func (InstallPluginCommand) handleFetchingPluginInfoFromRepositoriesError(fetchErr actionerror.FetchingPluginInfoFromRepositoryError) error {
	switch clientErr := fetchErr.Err.(type) {
	case pluginerror.RawHTTPStatusError:
		return translatableerror.FetchingPluginInfoFromRepositoriesError{
			Message:        clientErr.Status,
			RepositoryName: fetchErr.RepositoryName,
		}

	case pluginerror.SSLValidationHostnameError:
		return translatableerror.FetchingPluginInfoFromRepositoriesError{
			Message:        clientErr.Error(),
			RepositoryName: fetchErr.RepositoryName,
		}

	case pluginerror.UnverifiedServerError:
		return translatableerror.FetchingPluginInfoFromRepositoriesError{
			Message:        clientErr.Error(),
			RepositoryName: fetchErr.RepositoryName,
		}

	default:
		return clientErr
	}
}
1087183
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(imageapiv1.Install(scheme))
	utilruntime.Must(scheme.SetVersionPriority(imagev1.SchemeGroupVersion))
}
476365
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(userapiv1.Install(scheme))
	utilruntime.Must(scheme.SetVersionPriority(userv1.GroupVersion))
}
1358077
func (s *URLScriptHandler) Install(r *api.InstallResult) error {
	downloadURL, err := url.Parse(r.URL)
	if err != nil {
		return err
	}
	dst := filepath.Join(s.DestinationDir, constants.UploadScripts, r.Script)
	if _, err := s.Download.Download(downloadURL, dst); err != nil {
		if e, ok := err.(s2ierr.Error); ok {
			if e.ErrorCode == s2ierr.ScriptsInsideImageError {
				r.Installed = true
				return nil
			}
		}
		return err
	}
	if err := s.FS.Chmod(dst, 0755); err != nil {
		return err
	}
	r.Installed = true
	r.Downloaded = true
	return nil
}
571997
func InstallInternalLegacyNetwork(scheme *runtime.Scheme) {
	InstallExternalLegacyNetwork(scheme)

	schemeBuilder := runtime.NewSchemeBuilder(
		addUngroupifiedInternalNetworkTypes,

		networkv1helpers.RegisterDefaults,
		networkv1helpers.RegisterConversions,
	)
	utilruntime.Must(schemeBuilder.AddToScheme(scheme))
}
142404
func RunSetupIfNeeded(appVersion string, isFullSetupMode bool) error {
	if !configs.CheckIsSetupWasDoneForVersion(version.VERSION) {
		log.Warnf(colorstring.Yellow("Setup was not performed for this version of bitrise, doing it now..."))
		return RunSetup(version.VERSION, false, false)
	}
	return nil
}
881616
func (m *MockInstaller) Install(arg0 manifest.Manifest, arg1 ui.Stage) (installation.Installation, error) {
	ret := m.ctrl.Call(m, "Install", arg0, arg1)
	ret0, _ := ret[0].(installation.Installation)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
1064575
func (m MetricsWithReset) Install(c *mux.PathRecorderMux) {
	register()
	defaultMetricsHandler := prometheus.Handler().ServeHTTP
	c.HandleFunc("/metrics", func(w http.ResponseWriter, req *http.Request) {
		if req.Method == "DELETE" {
			apimetrics.Reset()
			etcdmetrics.Reset()
			io.WriteString(w, "metrics reset\n")
			return
		}
		defaultMetricsHandler(w, req)
	})
}
1297041
func (s *GenericAPIServer) installAPIResources(apiPrefix string, apiGroupInfo *APIGroupInfo, openAPIModels openapiproto.Models) error {
	for _, groupVersion := range apiGroupInfo.PrioritizedVersions {
		if len(apiGroupInfo.VersionedResourcesStorageMap[groupVersion.Version]) == 0 {
			klog.Warningf("Skipping API %v because it has no resources.", groupVersion)
			continue
		}

		apiGroupVersion := s.getAPIGroupVersion(apiGroupInfo, groupVersion, apiPrefix)
		if apiGroupInfo.OptionsExternalVersion != nil {
			apiGroupVersion.OptionsExternalVersion = apiGroupInfo.OptionsExternalVersion
		}
		apiGroupVersion.OpenAPIModels = openAPIModels
		apiGroupVersion.MaxRequestBodyBytes = s.maxRequestBodyBytes

		if err := apiGroupVersion.InstallREST(s.Handler.GoRestfulContainer); err != nil {
			return fmt.Errorf("unable to setup API %v: %v", apiGroupInfo, err)
		}
	}

	return nil
}
597702
func Install(scheme *runtime.Scheme) {
	example.Install(scheme)
	secondexample.Install(scheme)
}
403058
func (c *Client) Install(ctx context.Context, image Image, opts ...InstallOpts) error {
	var config InstallConfig
	for _, o := range opts {
		o(&config)
	}
	path, err := c.getInstallPath(ctx, config)
	if err != nil {
		return err
	}
	var (
		cs       = image.ContentStore()
		platform = platforms.Default()
	)
	manifest, err := images.Manifest(ctx, cs, image.Target(), platform)
	if err != nil {
		return err
	}
	for _, layer := range manifest.Layers {
		ra, err := cs.ReaderAt(ctx, layer)
		if err != nil {
			return err
		}
		cr := content.NewReader(ra)
		r, err := compression.DecompressStream(cr)
		if err != nil {
			return err
		}
		if _, err := archive.Apply(ctx, path, r, archive.WithFilter(func(hdr *tar.Header) (bool, error) {
			d := filepath.Dir(hdr.Name)
			result := d == "bin"
			if config.Libs {
				result = result || d == "lib"
			}
			if result && !config.Replace {
				if _, err := os.Lstat(filepath.Join(path, hdr.Name)); err == nil {
					return false, errors.Errorf("cannot replace %s in %s", hdr.Name, path)
				}
			}
			return result, nil
		})); err != nil {
			r.Close()
			return err
		}
		r.Close()
	}
	return nil
}
169116
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(node.AddToScheme(scheme))
	utilruntime.Must(v1alpha1.AddToScheme(scheme))
	utilruntime.Must(v1beta1.AddToScheme(scheme))
	utilruntime.Must(scheme.SetVersionPriority(v1beta1.SchemeGroupVersion))
}