2015-08-25 19:40:54 +00:00
|
|
|
package systemd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
2015-09-24 15:51:33 +00:00
|
|
|
"resin-supervisor/gosuper/Godeps/_workspace/src/github.com/coreos/go-systemd/dbus"
|
2015-09-09 14:32:37 +00:00
|
|
|
"resin-supervisor/gosuper/Godeps/_workspace/src/github.com/coreos/go-systemd/login1"
|
2015-08-25 19:40:54 +00:00
|
|
|
)
|
|
|
|
|
2015-10-06 14:51:04 +00:00
|
|
|
var (
|
|
|
|
// Logind Systemd Login1 connection
|
|
|
|
Logind *login1.Conn
|
|
|
|
// Dbus Systems Dbus connection
|
|
|
|
Dbus *dbus.Conn
|
|
|
|
)
|
2015-09-24 15:51:33 +00:00
|
|
|
|
2015-08-25 19:40:54 +00:00
|
|
|
func init() {
|
2015-09-09 14:32:37 +00:00
|
|
|
var err error
|
|
|
|
if Logind, err = login1.New(); err != nil {
|
2015-10-06 18:16:31 +00:00
|
|
|
log.Fatalf("Failed to connect to host system bus: %s", err)
|
2015-08-25 19:40:54 +00:00
|
|
|
}
|
2015-09-24 15:51:33 +00:00
|
|
|
if Dbus, err = dbus.New(); err != nil {
|
2015-10-06 18:16:31 +00:00
|
|
|
log.Fatalf("Failed to connect to host DBUS: %s", err)
|
2015-09-24 15:51:33 +00:00
|
|
|
}
|
2015-08-25 19:40:54 +00:00
|
|
|
}
|