Exemple #1
0
func main() {
	logger.BeginTracing()
	defer logger.EndTracing()

	if !lib.UniqueOnSystem(grub2.DbusGrub2ExtDest) {
		logger.Warning("There already has an Grub2 daemon running.")
		return
	}

	flag.BoolVar(&argDebug, "d", false, "debug mode")
	flag.BoolVar(&argDebug, "debug", false, "debug mode")
	flag.Parse()
	if argDebug {
		logger.Info("debug mode")
		logger.SetLogLevel(log.LevelDebug)
	}

	ge := grub2.NewGrub2Ext()
	err := dbus.InstallOnSystem(ge)
	if err != nil {
		logger.Errorf("register dbus interface failed: %v", err)
		os.Exit(1)
	}

	dbus.DealWithUnhandledMessage()
	dbus.SetAutoDestroyHandler(10*time.Second, nil)

	if err := dbus.Wait(); err != nil {
		logger.Error("lost dbus session:", err)
		os.Exit(1)
	}
}
Exemple #2
0
func main() {
	err := dbus.InstallOnSystem(&LanguageSelector{})
	if err != nil {
		print("Can't Init LanguageSelector DBus Servier: " + err.Error())
		return
	}
	dbus.DealWithUnhandledMessage()
	dbus.Wait()
}
Exemple #3
0
func (m *Manager) installUsers() {
	m.mapLocker.Lock()
	defer m.mapLocker.Unlock()
	for _, u := range m.usersMap {
		err := dbus.InstallOnSystem(u)
		if err != nil {
			logger.Errorf("Install user '%s' failed: %v",
				u.Uid, err)
			continue
		}
	}
}
Exemple #4
0
func newAgent() (a *agent) {
	a = &agent{}
	a.pendingKeys = make(map[mapKey]chan string)
	a.savedKeys = make(map[mapKey]map[string]map[string]dbus.Variant)

	err := dbus.InstallOnSystem(a)
	if err != nil {
		logger.Error("install network agent failed:", err)
		return
	}

	nmAgentRegister("com.deepin.daemon.Network.agent")
	return
}
Exemple #5
0
func (m *Manager) installUserByPath(userPath string) error {
	u, err := NewUser(userPath)
	if err != nil {
		return err
	}

	err = dbus.InstallOnSystem(u)
	if err != nil {
		return err
	}

	m.mapLocker.Lock()
	defer m.mapLocker.Unlock()
	m.usersMap[userPath] = u

	return nil
}
Exemple #6
0
func main() {
	helper := NewBacklightHelper()
	err := dbus.InstallOnSystem(helper)
	if err != nil {
		logger.Errorf("register dbus interface failed: %v", err)
		os.Exit(1)
	}

	dbus.SetAutoDestroyHandler(time.Second*1, nil)

	dbus.DealWithUnhandledMessage()
	if err := dbus.Wait(); err != nil {
		logger.Errorf("lost dbus session: %v", err)
		os.Exit(1)
	} else {
		os.Exit(0)
	}
}
Exemple #7
0
func Start() {
	if _m != nil {
		return
	}

	logger.BeginTracing()
	_m = NewManager()
	err := dbus.InstallOnSystem(_m)
	if err != nil {
		logger.Error("Install manager dbus failed:", err)
		if _m.watcher != nil {
			_m.watcher.EndWatch()
			_m.watcher = nil
		}
		return
	}

	_m.installUsers()
}