Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cmd/lima-guestagent/install_systemd_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ func installSystemdAction(cmd *cobra.Command, _ []string) error {
if err != nil {
return err
}
unit, err := generateSystemdUnit(vsockPort, virtioPort)
debug, err := cmd.Flags().GetBool("debug")
if err != nil {
return err
}
unit, err := generateSystemdUnit(vsockPort, virtioPort, debug)
if err != nil {
return err
}
Expand Down Expand Up @@ -77,7 +81,7 @@ func installSystemdAction(cmd *cobra.Command, _ []string) error {
//go:embed lima-guestagent.TEMPLATE.service
var systemdUnitTemplate string

func generateSystemdUnit(vsockPort int, virtioPort string) ([]byte, error) {
func generateSystemdUnit(vsockPort int, virtioPort string, debug bool) ([]byte, error) {
selfExeAbs, err := os.Executable()
if err != nil {
return nil, err
Expand All @@ -90,6 +94,9 @@ func generateSystemdUnit(vsockPort int, virtioPort string) ([]byte, error) {
if virtioPort != "" {
args = append(args, fmt.Sprintf("--virtio-port %s", virtioPort))
}
if debug {
args = append(args, "--debug")
}

m := map[string]string{
"Binary": selfExeAbs,
Expand Down
6 changes: 3 additions & 3 deletions pkg/cidata/cidata.TEMPLATE.d/boot/25-guestagent-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ else
rm -f "${LIMA_CIDATA_HOME}/.config/systemd/user/lima-guestagent.service"

if [ "${LIMA_CIDATA_VSOCK_PORT}" != "0" ]; then
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --vsock-port "${LIMA_CIDATA_VSOCK_PORT}"
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --debug="${LIMA_CIDATA_DEBUG}" --vsock-port "${LIMA_CIDATA_VSOCK_PORT}"
elif [ "${LIMA_CIDATA_VIRTIO_PORT}" != "" ]; then
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --virtio-port "${LIMA_CIDATA_VIRTIO_PORT}"
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --debug="${LIMA_CIDATA_DEBUG}" --virtio-port "${LIMA_CIDATA_VIRTIO_PORT}"
else
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --debug="${LIMA_CIDATA_DEBUG}"
fi
fi