app-admin/google-guest-agent: Enable service for all wanted by services

This change enables google-guest-agent for all the services its WantedBy from the unit file, even the ones that don't exist in COS. eg. network.service and Networking.service. Normally this should be fine, but there could be an issue if someone manually installs one of these services.

BUG=b/329159019
TEST=presubmit, validation tests
RELEASE_NOTE=Fix bug in google-guest-agent service enablement.

cos-patch: bug
Change-Id: Ib654cc6cb22295f9a98598697910a9df78ed7e92
Reviewed-on: https://cos-review.googlesource.com/c/cos/overlays/board-overlays/+/67610
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Main-Branch-Verified: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
(cherry picked from commit dba7978b0b03d9dbd1e510c78d9dcb6d1f5dc7c0)
Reviewed-on: https://cos-review.googlesource.com/c/cos/overlays/board-overlays/+/67971
diff --git a/project-lakitu/app-admin/google-guest-agent/google-guest-agent-20230330.00-r4.ebuild b/project-lakitu/app-admin/google-guest-agent/google-guest-agent-20230330.00-r4.ebuild
new file mode 120000
index 0000000..820e6e8
--- /dev/null
+++ b/project-lakitu/app-admin/google-guest-agent/google-guest-agent-20230330.00-r4.ebuild
@@ -0,0 +1 @@
+google-guest-agent-20230330.00.ebuild
\ No newline at end of file
diff --git a/project-lakitu/app-admin/google-guest-agent/google-guest-agent-20230330.00.ebuild b/project-lakitu/app-admin/google-guest-agent/google-guest-agent-20230330.00.ebuild
index 624397a..d73d4f4 100644
--- a/project-lakitu/app-admin/google-guest-agent/google-guest-agent-20230330.00.ebuild
+++ b/project-lakitu/app-admin/google-guest-agent/google-guest-agent-20230330.00.ebuild
@@ -722,7 +722,13 @@
 	systemd_dounit google-guest-agent.service
 	systemd_dounit google-startup-scripts.service
 	systemd_dounit google-shutdown-scripts.service
-	systemd_enable_service multi-user.target google-guest-agent.service
+
+	# Parse the unit file and enable google-guest-agent service for all the
+	# services it is wanted by.
+	sed -n 's/^WantedBy=//p' google-guest-agent.service | tr ' ' '\n' | while read -r target; do
+		systemd_enable_service "${target}" google-guest-agent.service || die "error enabling for ${target}"
+	done
+
 	systemd_enable_service multi-user.target google-startup-scripts.service
 	systemd_enable_service multi-user.target google-shutdown-scripts.service