lakitu: make systemd-networkd do not wait

when interface is using persistent naming and no 99-default.network
applies. The interface is unmanaged, but systemd-networkd-wait-online
will wait forever, which blocks cloud-init eventually. Looks this is a
well known issue since Anthos OnPrem already tried to workaround the
problem by disabling systemd-networkd-wait-online. However, I do think
this maybe a bug of systemd, and will dig deeper by asking systemd
community. For now, let's use --any parameter to workaround it.

BUG=b/178100689
TEST=presubmit and manually test on vsphere, cloud-init comes up fine.
RELEASE_NOTE=None

Change-Id: Ieeb084a0850920b5df26d1dbd2159aa4b86b4150
Reviewed-on: https://cos-review.googlesource.com/c/cos/overlays/board-overlays/+/11270
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
diff --git a/project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/chromeos-bsp-lakitu-common-0.0.1-r1.ebuild b/project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/chromeos-bsp-lakitu-common-0.0.1-r2.ebuild
similarity index 100%
rename from project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/chromeos-bsp-lakitu-common-0.0.1-r1.ebuild
rename to project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/chromeos-bsp-lakitu-common-0.0.1-r2.ebuild
diff --git a/project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/chromeos-bsp-lakitu-common-0.0.1.ebuild b/project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/chromeos-bsp-lakitu-common-0.0.1.ebuild
index c8efa0b..7b621ba 100644
--- a/project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/chromeos-bsp-lakitu-common-0.0.1.ebuild
+++ b/project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/chromeos-bsp-lakitu-common-0.0.1.ebuild
@@ -12,7 +12,7 @@
 LICENSE="BSD-Google"
 SLOT="0"
 KEYWORDS="-* amd64 arm64 arm"
-IUSE="crash_reporting platform_gcp"
+IUSE="crash_reporting platform_gcp +networkd-wait-online"
 
 RDEPEND="
 	sys-apps/baselayout
@@ -33,7 +33,11 @@
 	fi
 
 	insinto "$(systemd_get_unitdir)/systemd-networkd-wait-online.service.d"
-	doins "${FILESDIR}"/networkd-no-timeout.conf
+	if use networkd-wait-online; then
+		doins "${FILESDIR}"/networkd-no-timeout.conf
+	else
+		doins "${FILESDIR}"/networkd-no-wait-online.conf
+	fi
 
 	insinto /etc/profile.d/
 	doins ${FILESDIR}/editor.sh
diff --git a/project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/files/networkd-no-wait-online.conf b/project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/files/networkd-no-wait-online.conf
new file mode 100644
index 0000000..a943cc4
--- /dev/null
+++ b/project-lakitu/chromeos-base/chromeos-bsp-lakitu-common/files/networkd-no-wait-online.conf
@@ -0,0 +1,18 @@
+#
+# Copyright 2021 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+[Service]
+ExecStart=
+ExecStart=/usr/lib/systemd/systemd-networkd-wait-online --any --timeout=0
diff --git a/project-lakitu/profiles/platform/vsphere/make.defaults b/project-lakitu/profiles/platform/vsphere/make.defaults
index 4e182fd..d2fca6e 100644
--- a/project-lakitu/profiles/platform/vsphere/make.defaults
+++ b/project-lakitu/profiles/platform/vsphere/make.defaults
@@ -21,6 +21,9 @@
 # Enable predictable interface name
 USE="${USE} predictable-interface-name"
 
+# Disable systemd-network-wait-online via --any option
+USE="${USE} -networkd-wait-online"
+
 # Disable cri-tools
 USE="${USE} -cri_tools"