Skip to content

Commit 14dcebd

Browse files
authored
Merge pull request #3723 from stek29/guestagent-debug
guestagent cidata: pass debug flag to guestagent systemd unit
2 parents 9757942 + b866e4c commit 14dcebd

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

cmd/lima-guestagent/install_systemd_linux.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ func installSystemdAction(cmd *cobra.Command, _ []string) error {
3838
if err != nil {
3939
return err
4040
}
41-
unit, err := generateSystemdUnit(vsockPort, virtioPort)
41+
debug, err := cmd.Flags().GetBool("debug")
42+
if err != nil {
43+
return err
44+
}
45+
unit, err := generateSystemdUnit(vsockPort, virtioPort, debug)
4246
if err != nil {
4347
return err
4448
}
@@ -77,7 +81,7 @@ func installSystemdAction(cmd *cobra.Command, _ []string) error {
7781
//go:embed lima-guestagent.TEMPLATE.service
7882
var systemdUnitTemplate string
7983

80-
func generateSystemdUnit(vsockPort int, virtioPort string) ([]byte, error) {
84+
func generateSystemdUnit(vsockPort int, virtioPort string, debug bool) ([]byte, error) {
8185
selfExeAbs, err := os.Executable()
8286
if err != nil {
8387
return nil, err
@@ -90,6 +94,9 @@ func generateSystemdUnit(vsockPort int, virtioPort string) ([]byte, error) {
9094
if virtioPort != "" {
9195
args = append(args, fmt.Sprintf("--virtio-port %s", virtioPort))
9296
}
97+
if debug {
98+
args = append(args, "--debug")
99+
}
93100

94101
m := map[string]string{
95102
"Binary": selfExeAbs,

pkg/cidata/cidata.TEMPLATE.d/boot/25-guestagent-base.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ else
5454
rm -f "${LIMA_CIDATA_HOME}/.config/systemd/user/lima-guestagent.service"
5555

5656
if [ "${LIMA_CIDATA_VSOCK_PORT}" != "0" ]; then
57-
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --vsock-port "${LIMA_CIDATA_VSOCK_PORT}"
57+
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --debug="${LIMA_CIDATA_DEBUG}" --vsock-port "${LIMA_CIDATA_VSOCK_PORT}"
5858
elif [ "${LIMA_CIDATA_VIRTIO_PORT}" != "" ]; then
59-
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --virtio-port "${LIMA_CIDATA_VIRTIO_PORT}"
59+
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --debug="${LIMA_CIDATA_DEBUG}" --virtio-port "${LIMA_CIDATA_VIRTIO_PORT}"
6060
else
61-
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd
61+
sudo "${LIMA_CIDATA_GUEST_INSTALL_PREFIX}"/bin/lima-guestagent install-systemd --debug="${LIMA_CIDATA_DEBUG}"
6262
fi
6363
fi

0 commit comments

Comments
 (0)