// Install on Windows ignores the provided user and always installs in the
// CURRET_USER context, writing the JSON adjacent to the binary path.
492265
func (w *whitelistRegistry) Install(_ User, app AppManifest) error {
	// We assume that the parentDir already exists, where the binary lives.
	jsonPath, keyPath := w.paths(app)
	if err := w.writeJSON(jsonPath, app); err != nil {
		return err
	}

	scope := registry.CURRENT_USER
	k, _, err := registry.CreateKey(scope, keyPath, registry.SET_VALUE|registry.CREATE_SUB_KEY|registry.WRITE)
	if err != nil {
		return err
	}
	defer k.Close()

	return k.SetStringValue("", jsonPath)
}
1282881
func (i *VCSInstaller) Install() error {
	if err := i.sync(i.Repo); err != nil {
		return err
	}

	ref, err := i.solveVersion(i.Repo)
	if err != nil {
		return err
	}
	if ref != "" {
		if err := i.setVersion(i.Repo, ref); err != nil {
			return err
		}
	}

	if !isPlugin(i.Repo.LocalPath()) {
		return ErrMissingMetadata
	}

	return i.link(i.Repo.LocalPath())
}
993848
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(sdnapiv1.Install(scheme))
	utilruntime.Must(scheme.SetVersionPriority(networkv1.GroupVersion))
}
597702
func Install(scheme *runtime.Scheme) {
	example.Install(scheme)
	secondexample.Install(scheme)
}
752654
func AutoInstall(context Context, binPath string, force bool, timeout time.Duration, log Log) (bool, error) {
	return false, nil
}
520436
func (agent *Agent) install(ctx context.Context) error {
	exe, err := os.Executable()
	if err != nil {
		return err
	}

	substitutions := map[string]string{
		"Agent":          exe,
		"Server":         agent.server,
		"ServiceAccount": agent.serviceAccount,
		"User":           agent.swarmingUser,
	}
	content, err := substituteAsset(ctx, agent.agentAutoStartTemplate, substitutions)
	if err != nil {
		return err
	}
	path, err := substitute(ctx, agent.agentAutoStartPath, substitutions)
	if err != nil {
		return err
	}

	_, err = os.Stat(path)
	if err == nil || os.IsExist(err) {
		bytes, err := ioutil.ReadFile(path)
		if err != nil {
			return err
		}
		if string(bytes) == content {
			logging.Infof(ctx, "Already installed: %s.", path)
			return nil
		}
		logging.Infof(ctx, "Reinstalling: %s.", path)
		if err = agent.strategy.stop(ctx); err != nil {
			return err
		}
	} else {
		logging.Infof(ctx, "Installing: %s.", path)
	}
	if err = ioutil.WriteFile(path, []byte(content), 0644); err != nil {
		return err
	}
	return agent.strategy.start(ctx, path)
}
967138
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(oauthapiv1.Install(scheme))
	utilruntime.Must(scheme.SetVersionPriority(oauthv1.GroupVersion))
}
169469
func (a *APIInstaller) Install() ([]metav1.APIResource, *restful.WebService, []error) {
	var apiResources []metav1.APIResource
	var errors []error
	ws := a.newWebService()

	// Register the paths in a deterministic (sorted) order to get a deterministic swagger spec.
	paths := make([]string, len(a.group.Storage))
	var i int = 0
	for path := range a.group.Storage {
		paths[i] = path
		i++
	}
	sort.Strings(paths)
	for _, path := range paths {
		apiResource, err := a.registerResourceHandlers(path, a.group.Storage[path], ws)
		if err != nil {
			errors = append(errors, fmt.Errorf("error in registering resource: %s, %v", path, err))
		}
		if apiResource != nil {
			apiResources = append(apiResources, *apiResource)
		}
	}
	return apiResources, ws, errors
}
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)
	})
}
70220
func (darwin *darwinRecord) Install(args ...string) (string, error) {
	installAction := "Install " + darwin.description + ":"

	if ok, err := checkPrivileges(); !ok {
		return installAction + failed, err
	}

	srvPath := darwin.servicePath()

	if darwin.isInstalled() {
		return installAction + failed, ErrAlreadyInstalled
	}

	file, err := os.Create(srvPath)
	if err != nil {
		return installAction + failed, err
	}
	defer file.Close()

	execPatch, err := executablePath(darwin.name)
	if err != nil {
		return installAction + failed, err
	}

	templ, err := template.New("propertyList").Parse(propertyList)
	if err != nil {
		return installAction + failed, err
	}

	if err := templ.Execute(
		file,
		&struct {
			Name, Path string
			Args       []string
		}{darwin.name, execPatch, args},
	); err != nil {
		return installAction + failed, err
	}

	return installAction + success, nil
}
1181158
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(authorizationapi.Install(scheme))
	utilruntime.Must(rbacconversion.AddToScheme(scheme))
	utilruntime.Must(authorizationapiv1.Install(scheme))
	utilruntime.Must(scheme.SetVersionPriority(authorizationv1.GroupVersion))
}
244083
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(routeapiv1.Install(scheme))
	utilruntime.Must(scheme.SetVersionPriority(routev1.GroupVersion))
}
1258557
func (s Service) Installed() (bool, error) {
	installed, _, _, err := s.status()
	if err != nil {
		return false, errors.Trace(err)
	}
	return installed, nil
}
1155405
func (m *MesosMessenger) Install(handler MessageHandler, msg proto.Message) error {
	// Check if the message is a pointer.
	mtype := reflect.TypeOf(msg)
	if mtype.Kind() != reflect.Ptr {
		return fmt.Errorf("Message %v is not a Ptr type", msg)
	}

	// Check if the message is already installed.
	name := getMessageName(msg)
	if _, ok := m.installedMessages[name]; ok {
		return fmt.Errorf("Message %v is already installed", name)
	}

	m.guardHandlers.Lock()
	defer m.guardHandlers.Unlock()

	m.installedMessages[name] = mtype.Elem()
	m.installedHandlers[name] = handler
	m.tr.Install(name)
	return nil
}
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
}
316396
func (s *Service) Installed() (bool, error) {
	names, err := ListServices()
	if err != nil {
		return false, s.errorf(err, "failed to list services")
	}
	for _, name := range names {
		if name == s.Service.Name {
			return true, nil
		}
	}
	return false, nil
}
504701
func Install(plist Plist, wait time.Duration, log Log) error {
	service := NewService(plist.label)
	service.SetLogger(log)
	return service.Install(plist, wait)
}