X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Fsync%2Fcommands.go;h=84a318d79668b8e43118d9981e5d7736db3f766c;hb=1934f1ab83306dff45310d5b45e2a99c97e28c35;hp=abc23bcc42a8af74264df5a8e095416a1433791f;hpb=f2f2bc47e8729548f3c10117f7f008b547c4afc5;p=safcm%2Fsafcm.git diff --git a/cmd/safcm-remote/sync/commands.go b/cmd/safcm-remote/sync/commands.go index abc23bc..84a318d 100644 --- a/cmd/safcm-remote/sync/commands.go +++ b/cmd/safcm-remote/sync/commands.go @@ -40,7 +40,7 @@ func (s *Sync) syncCommands() error { // Regular commands afterwards so they can react on triggers if // necessary for _, x := range s.req.Commands { - err := s.syncCommand(x, "") + err := s.syncCommand(x.Cmd, "") if err != nil { return err } @@ -79,10 +79,15 @@ func (s *Sync) syncCommand(command string, trigger string) error { } func safcmEnviroment(groups []string) []string { + exe, err := os.Executable() + if err != nil { + panic(err) // should not happen on supported systems + } + env := os.Environ() - // Provide additional environment variables so commands can check - // group membership + // Provide additional environment variables env = append(env, + fmt.Sprintf("SAFCM_HELPER=%s", exe), fmt.Sprintf("SAFCM_GROUPS=%s", strings.Join(groups, " "))) for _, x := range groups { env = append(env, fmt.Sprintf("SAFCM_GROUP_%s=%s", x, x))