lakitu: disable systemd-networkd-wait-online.service

when interface is unconfigured, systemd-networkd-waiting-online
will stuck. This patch can be reverted when we upgrade systemd
version to 241 and above.

BUG=b/181810570
TEST=presubmit
RELEASE_NOTE=None

Change-Id: I98181481704cce59e10fffa850484c9ea58358b6
Reviewed-on: https://cos-review.googlesource.com/c/cos/overlays/board-overlays/+/13655
Reviewed-by: Varsha Teratipally <teratipally@google.com>
Tested-by: Roy Yang <royyang@google.com>
diff --git a/project-lakitu/sys-apps/systemd/systemd-239-r21.ebuild b/project-lakitu/sys-apps/systemd/systemd-239-r22.ebuild
similarity index 100%
rename from project-lakitu/sys-apps/systemd/systemd-239-r21.ebuild
rename to project-lakitu/sys-apps/systemd/systemd-239-r22.ebuild
diff --git a/project-lakitu/sys-apps/systemd/systemd-239.ebuild b/project-lakitu/sys-apps/systemd/systemd-239.ebuild
index ccd281a..f14089b 100644
--- a/project-lakitu/sys-apps/systemd/systemd-239.ebuild
+++ b/project-lakitu/sys-apps/systemd/systemd-239.ebuild
@@ -23,7 +23,7 @@
 SLOT="0/2"
 
 # lakitu: Added "doc" USE flag to conditionalize the installation of docs.
-IUSE="acl apparmor audit build cryptsetup curl doc elfutils +gcrypt gnuefi http idn importd +kmod libidn2 +lz4 lzma nat pam pcre policykit qrcode +resolvconf +seccomp selinux +split-usr ssl +sysv-utils test vanilla vtconsole xkb predictable-interface-name"
+IUSE="acl apparmor audit build cryptsetup curl doc elfutils +gcrypt gnuefi http idn importd +kmod libidn2 +lz4 lzma nat pam pcre policykit qrcode +resolvconf +seccomp selinux +split-usr ssl +sysv-utils test vanilla vtconsole xkb predictable-interface-name +networkd-wait-online"
 
 REQUIRED_USE="importd? ( curl gcrypt lzma )"
 RESTRICT="!test? ( test )"
@@ -396,6 +396,13 @@
 		rm  -f "${D}"/etc/systemd/system/getty.target.wants/getty@tty1.service
 	fi
 
+	# lakitu: Disable systemd-networkd-wait-line if networkd-wait-online is not enabled.
+	# TODO: Remove this patch when we upgraded systemd to version greater
+	# than 241.
+	if ! use networkd-wait-online; then
+		rm  -f "${D}"/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service
+	fi
+
 	# Install network files.
 	insinto /usr/lib/systemd/network
 	doins "${FILESDIR}"/*.network