code: 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)
  }
docs: // install installs the agent, starts it, and configures auto-start on reboot.