From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id B693490362; Mon, 10 Oct 2022 23:32:43 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 2C0B79017B; Mon, 10 Oct 2022 23:32:26 +0000 (UTC) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by atuin.qyliss.net (Postfix) with ESMTPS id 28575900CB for ; Mon, 10 Oct 2022 23:32:13 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 242145C01AE for ; Mon, 10 Oct 2022 19:32:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 10 Oct 2022 19:32:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1665444729; x=1665531129; bh=bA 2QXQGNqcRyOCMl67H5QUf2pjcssyewXh83U/WagSU=; b=PVQC+4HWnfl4aiEJJY tW7EkjztoL1jJbVr9cc4QgOzWO0YmYl5W5MK0dV/YeLevfEgfr8nZta8gfvdDJI9 NFh/M9xmLizS0J0JM57HIGkGctVou92j/O/d5gy/5qCoc3IrpfoFcry5KHNC29F/ 1XuW1PrMivxEck9bkFrW1CqIlWYXckOQTKsonHJm921Py3I4yJFmGoKAmKevm7rT BD5LwuzfznZ6ptBSqlJrjhl25COxJubseKshyKcLC5YWJTeQzUmWMBCwe3rAZNnU cklpaeaySUIY9XEyspj3CqifrJyFPsccjeysTB/gdISj/hu/49MU3s+S0UKYm/qh Osbw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1665444729; x=1665531129; bh=bA2QXQGNqcRyO CMl67H5QUf2pjcssyewXh83U/WagSU=; b=Vt/n5t05gZJZPWSl8tPWeb/7Zbfq6 TfY6Elw8pu0r7zxvzsZbFgP3cbAFFZKxw0jzNWqNkxnSEDTPqEwD8i7gTZjS2kaI oeuChoHGZyU9PREzqox2TqXiLylaQ2Hg6TfXvsqXcg+RVC0G45bJ1ApyRkUdqnvr NuvEqh5JqAR+8C1Kn5PaETrq9unAUyI6F2y6FZiPFEOtsRkIV0iAYuy5VEk+WhCU xH5hZfViL5CUiEK+VDajNGIUeRwpeNtJKMnO4Xqc9+43QuhftbLBLiog4kU5cd7f hMLslrVf0Igf9RhGBtOR2Nsn9jSu5EGGV1q/0Ki2HQMWW0MhbJe2IcQBA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeejhedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhi sheqnecuggftrfgrthhtvghrnhepvdevkeeuudehvdevkeffteduhedvheeivdeifedvie dtueeuvdeiffejgfeuveeunecuffhomhgrihhnpehlihgsvghrrgdrtghhrghtpdhsphgv tghtrhhumhdqohhsrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepqhihlhhishhsseigvddvtddrqhihlhhishhsrdhnvght X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 10 Oct 2022 19:32:08 -0400 (EDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id 4AF58BB7; Mon, 10 Oct 2022 23:32:06 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org Subject: [PATCH 07/22] img/app: don't block app startup on network online Date: Mon, 10 Oct 2022 23:28:47 +0000 Message-Id: <20221010232909.1953738-8-hi@alyssa.is> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221010232909.1953738-1-hi@alyssa.is> References: <20221010232909.1953738-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: KNSCNIYGRXFJ2IEL2UZLVZ2ENPPCBGCL X-Message-ID-Hash: KNSCNIYGRXFJ2IEL2UZLVZ2ENPPCBGCL X-MailFrom: qyliss@x220.qyliss.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.5 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Not all VMs will even have networking! So it makes more sense to put waiting for the network in the application-specific part. The "listen" and "wait" scripts are copied from the host system. Signed-off-by: Alyssa Ross --- img/app/Makefile | 2 ++ img/app/etc/mdev/iface | 4 ++-- img/app/etc/mdev/listen | 12 ++++++++++++ img/app/etc/mdev/wait | 15 +++++++++++++++ img/app/etc/s6-rc/ok-all/contents | 1 + vm/app/catgirl.nix | 1 + vm/app/lynx.nix | 1 + 7 files changed, 34 insertions(+), 2 deletions(-) create mode 100755 img/app/etc/mdev/listen create mode 100755 img/app/etc/mdev/wait diff --git a/img/app/Makefile b/img/app/Makefile index 7d8e1c1..9aae612 100644 --- a/img/app/Makefile +++ b/img/app/Makefile @@ -50,6 +50,8 @@ VM_FILES = \ etc/init \ etc/mdev.conf \ etc/mdev/iface \ + etc/mdev/listen \ + etc/mdev/wait \ etc/passwd \ etc/resolv.conf \ etc/s6-linux-init/scripts/rc.init diff --git a/img/app/etc/mdev/iface b/img/app/etc/mdev/iface index d8ceda5..93a12eb 100755 --- a/img/app/etc/mdev/iface +++ b/img/app/etc/mdev/iface @@ -1,6 +1,6 @@ #!/bin/execlineb -P # SPDX-License-Identifier: EUPL-1.2+ -# SPDX-FileCopyrightText: 2020-2021 Alyssa Ross +# SPDX-FileCopyrightText: 2020-2022 Alyssa Ross importas -i INTERFACE INTERFACE @@ -33,4 +33,4 @@ foreground { } } -s6-rc -u change app +/etc/mdev/listen network-online diff --git a/img/app/etc/mdev/listen b/img/app/etc/mdev/listen new file mode 100755 index 0000000..6bc6f2c --- /dev/null +++ b/img/app/etc/mdev/listen @@ -0,0 +1,12 @@ +#!/bin/execlineb -s1 +# SPDX-License-Identifier: EUPL-1.2+ +# SPDX-FileCopyrightText: 2021 Alyssa Ross + +foreground { + redirfd -w 2 /dev/null + foreground { mkdir /run/wait } + mkfifo /run/wait/${1} +} + +redirfd -w 1 /run/wait/${1} +echo diff --git a/img/app/etc/mdev/wait b/img/app/etc/mdev/wait new file mode 100755 index 0000000..3b85de8 --- /dev/null +++ b/img/app/etc/mdev/wait @@ -0,0 +1,15 @@ +#!/bin/execlineb -s1 +# SPDX-License-Identifier: EUPL-1.2+ +# SPDX-FileCopyrightText: 2021 Alyssa Ross + +foreground { + redirfd -w 2 /dev/null + foreground { mkdir /run/wait } + mkfifo /run/wait/${1} +} + +foreground { + redirfd -w 1 /dev/null + head -1 /run/wait/${1} +} +rm /run/wait/${1} diff --git a/img/app/etc/s6-rc/ok-all/contents b/img/app/etc/s6-rc/ok-all/contents index c4ea84f..92f3ef1 100644 --- a/img/app/etc/s6-rc/ok-all/contents +++ b/img/app/etc/s6-rc/ok-all/contents @@ -2,3 +2,4 @@ # SPDX-FileCopyrightText: 2021 Alyssa Ross # mdevd-coldplug +app diff --git a/vm/app/catgirl.nix b/vm/app/catgirl.nix index a4c05e3..54181c5 100644 --- a/vm/app/catgirl.nix +++ b/vm/app/catgirl.nix @@ -9,6 +9,7 @@ import ../make-vm.nix { inherit config; } { { writeScript, catgirl }: writeScript "run-catgirl" '' #!/bin/execlineb -P + if { /etc/mdev/wait network-online } foreground { printf "IRC nick (to join #spectrum): " } backtick -E nick { head -1 } ${catgirl}/bin/catgirl -h irc.libera.chat -j "#spectrum" -n $nick diff --git a/vm/app/lynx.nix b/vm/app/lynx.nix index 00d449e..af25df8 100644 --- a/vm/app/lynx.nix +++ b/vm/app/lynx.nix @@ -9,6 +9,7 @@ import ../make-vm.nix { inherit config; } { { writeScript, lynx }: writeScript "run-lynx" '' #!/bin/execlineb -P + if { /etc/mdev/wait network-online } ${lynx}/bin/lynx https://spectrum-os.org '' ) { }; -- 2.37.1