Skip to content

Commit

Permalink
Stop hardcoding /run as the runtime path
Browse files Browse the repository at this point in the history
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
  • Loading branch information
afbjorklund committed Oct 5, 2023
1 parent 2748225 commit 9d7f541
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/lima-guestagent/daemon_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func newDaemonCommand() *cobra.Command {

func daemonAction(cmd *cobra.Command, _ []string) error {
socket := "/run/lima-guestagent.sock"
{ // runtime.GOOS == "freebsd"
socket = "/var" + socket
}
tick, err := cmd.Flags().GetDuration("tick")
if err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions pkg/hostagent/hostagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ func (a *HostAgent) watchGuestAgentEvents(ctx context.Context) {

localUnix := filepath.Join(a.instDir, filenames.GuestAgentSock)
remoteUnix := "/run/lima-guestagent.sock"
if *a.y.OS == limayaml.FREEBSD {
remoteUnix = "/var" + remoteUnix
}

a.onClose = append(a.onClose, func() error {
logrus.Debugf("Stop forwarding unix sockets")
Expand Down
6 changes: 5 additions & 1 deletion pkg/hostagent/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,15 @@ A possible workaround is to run "lima-guestagent install-systemd" in the guest.
`,
})
} else {
run := "/run"
if *a.y.OS == limayaml.FREEBSD {
run = "/var" + run
}
req = append(req, requirement{
description: "the guest agent to be running",
script: `#!/bin/bash
set -eux -o pipefail
sock="/run/lima-guestagent.sock"
sock="` + run + `/lima-guestagent.sock"
if ! timeout 30s bash -c "until [ -S \"${sock}\" ]; do sleep 3; done"; then
echo >&2 "lima-guestagent is not installed yet"
exit 1
Expand Down

0 comments on commit 9d7f541

Please sign in to comment.