Exemple #1
0
// Install will install the launchd service
func (s Service) Install(p Plist) (err error) {
	if _, err := os.Stat(p.binPath); os.IsNotExist(err) {
		return err
	}
	plist := p.plist()
	plistDest := s.plistDestination()

	log.Info("Saving %s", plistDest)
	file := libkb.NewFile(plistDest, []byte(plist), 0644)
	err = file.Save()
	if err != nil {
		return
	}

	err = s.Load(true)
	return
}
Exemple #2
0
// Install will install the launchd service
func (s Service) Install(p Plist) error {
	if _, ferr := os.Stat(p.binPath); os.IsNotExist(ferr) {
		return fmt.Errorf("%s doesn't exist", p.binPath)
	}
	plist := p.plistXML()
	plistDest := s.plistDestination()

	// See GH issue: https://github.com/keybase/client/pull/1399#issuecomment-164810645
	if err := libkb.MakeParentDirs(plistDest); err != nil {
		return err
	}

	s.info("Saving %s", plistDest)
	file := libkb.NewFile(plistDest, []byte(plist), 0644)
	if err := file.Save(); err != nil {
		return err
	}

	return s.Start()
}
Exemple #3
0
func (s Service) install(p Plist, plistDest string, wait time.Duration) error {
	if _, ferr := os.Stat(p.binPath); os.IsNotExist(ferr) {
		return fmt.Errorf("%s doesn't exist", p.binPath)
	}
	plist := p.plistXML()

	// Plist directory (~/Library/LaunchAgents/) might not exist on clean OS installs
	// See GH issue: https://github.com/keybase/client/pull/1399#issuecomment-164810645
	if err := libkb.MakeParentDirs(plistDest); err != nil {
		return err
	}

	s.log.Info("Saving %s", plistDest)
	file := libkb.NewFile(plistDest, []byte(plist), 0644)
	if err := file.Save(); err != nil {
		return err
	}

	return s.Start(wait)
}