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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE 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 DE86F72658; Fri, 30 Sep 2022 21:36:08 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 9DDB272655; Fri, 30 Sep 2022 21:36:06 +0000 (UTC) Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by atuin.qyliss.net (Postfix) with ESMTPS id 1BAB4725D5 for ; Fri, 30 Sep 2022 21:36:03 +0000 (UTC) Received: by mail-ed1-x534.google.com with SMTP id u24so7548411edb.11 for ; Fri, 30 Sep 2022 14:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unikie.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=4/E3GFrKKiXBCtmxVcraWODokhIlwXg4UHsa6CQvPGQ=; b=kwkhi94nejOcrTN0gDiwAioZQRwZ/OepDPU4+ZmLcildICXTsTtxtDrzxQUU0IY7V5 n+jvuJEBeobDeNBKhDmjYLhjkr2/bTPFU8s72f4iJubzXCrRMBD0Q1TsntfRMrrZk9tj KmnyrBlv7ilpn7FQ7eClp8AXd8eztniAdsL7DlEsKQLr9LbdrBh6Wf5amMtLg0hYfd5K wbpYQ4OiBgDg+SrORJ8eiFZ7YxzdALpCK/4UBmfP/1gNVEgmJ9eiT/obMuBrni4vF+ZP y6B+qeIqP7zJV0D9ERpAT1JJYNAVJAV+2WIjJSPuA4bFvHMyooWXxX2ZRbEae4DqXKc2 lOXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=4/E3GFrKKiXBCtmxVcraWODokhIlwXg4UHsa6CQvPGQ=; b=Jf15aLGmPGELM/HI/w/VkrM3JiZ28I+AMRlr8FNLb1OYkqsFsvgYvYweuVOLJ5WQeX X0a2QfFkoaf7UBC4VqxHfCwRKWzfqALdCVHCnGVabjyWeJBW09b7/a8mkAMIIyqp4dJ3 20mEiZkb/5Mznricr7fOID/BrGvdV8+JbBY//YSr0wBGu/8g4AJUr3PO88SJ0oyxsIF2 gs0W0yk8xYcv/LSkHK1c4KDYzNxsdLSc480RpxkG/LChdPdrQrf2FbunC/ynjLYO+W6T pRyH00KhLgLEzJEdqp+Rc1DyDbCk2qcnehomMPDR4//aafPiVPrv3A990E/DSSIJjamh iFlg== X-Gm-Message-State: ACrzQf1HeiE1PgA5foHImVgeb6YcUkRF1i7cyWzP0LBhk03TOV6GVm0o yWIFA38hqZrCFWSAwfBcBaDb+jlyVthV1nyK X-Google-Smtp-Source: AMsMyM6qk503Wn2r0wLLj4WjEpTlmRyOHi4bbHdHGUatsfkqtENJlAGViRiEKa/3n3UulGwBVLaOkA== X-Received: by 2002:a05:6402:34cb:b0:451:61c9:a316 with SMTP id w11-20020a05640234cb00b0045161c9a316mr9735832edc.268.1664573762659; Fri, 30 Sep 2022 14:36:02 -0700 (PDT) Received: from x220.qyliss.net (p54b8e692.dip0.t-ipconnect.de. [84.184.230.146]) by smtp.gmail.com with ESMTPSA id f21-20020a50a6d5000000b00457c321454asm2349935edc.37.2022.09.30.14.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 14:36:02 -0700 (PDT) Received: by x220.qyliss.net (Postfix, from userid 1000) id 07D735AB; Fri, 30 Sep 2022 21:36:02 +0000 (UTC) From: Alyssa Ross To: devel@spectrum-os.org Subject: [RFC PATCH v2 02/10] img/app: don't block app startup on network online Date: Fri, 30 Sep 2022 21:35:25 +0000 Message-Id: <20220930213533.1710618-3-alyssa.ross@unikie.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220930213533.1710618-1-alyssa.ross@unikie.com> References: <20220930213533.1710618-1-alyssa.ross@unikie.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: GYXDUZPVT47JWRXEL43ZX23WB7RJHC2R X-Message-ID-Hash: GYXDUZPVT47JWRXEL43ZX23WB7RJHC2R X-MailFrom: alyssa.ross@unikie.com X-Mailman-Rule-Hits: header-match-devel.spectrum-os.org-0 X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1 CC: Puck Meerburg , Ville Ilvonen 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: From: Alyssa Ross 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 --- This patch comes from before I started working on this at Unikie, hence the non-Unikie author email. img/app/Makefile | 2 ++ img/app/etc/mdev/iface | 2 +- 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, 33 insertions(+), 1 deletion(-) 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 c5a4684..a3fefc3 100644 --- a/img/app/Makefile +++ b/img/app/Makefile @@ -47,6 +47,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..4cdc112 100755 --- a/img/app/etc/mdev/iface +++ b/img/app/etc/mdev/iface @@ -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 107ff82..79c5d8b 100644 --- a/vm/app/catgirl.nix +++ b/vm/app/catgirl.nix @@ -10,6 +10,7 @@ import ../../vm-lib/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 8fc3bd6..6abaf9b 100644 --- a/vm/app/lynx.nix +++ b/vm/app/lynx.nix @@ -10,6 +10,7 @@ import ../../vm-lib/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