1 // MsgInfoReq: collect information about the remote host
3 // SPDX-License-Identifier: GPL-3.0-or-later
4 // Copyright (C) 2021-2024 Simon Ruderich
12 "ruderich.org/simon/safcm"
13 "ruderich.org/simon/safcm/remote/log"
14 "ruderich.org/simon/safcm/remote/run"
19 resp safcm.MsgInfoResp
25 func Handle(req safcm.MsgInfoReq,
26 runner run.Runner, fun log.LogFunc) safcm.MsgInfoResp {
30 logger: log.NewLogger(fun),
32 i.cmd = run.NewCmd(runner, i.logger)
36 i.resp.Error = fmt.Sprintf("%v", err)
41 func (i *Info) handle() error {
42 i.resp.Goos = runtime.GOOS
43 i.resp.Goarch = runtime.GOARCH
45 for _, x := range i.req.DetectGroups {
46 stdout, _, err := i.cmd.Run("detect group",
51 i.resp.Output = append(i.resp.Output, string(stdout))