From patchwork Tue May 23 17:23:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6908 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4d4jbHz3wls for ; Tue, 23 May 2023 17:24:01 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4c5ZPYz1bD; Tue, 23 May 2023 17:24:00 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4c4nbgz2ypP; Tue, 23 May 2023 17:24:00 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4Y6tkJz2ySG for ; Tue, 23 May 2023 17:23:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4Y5hkvzfB; Tue, 23 May 2023 17:23:57 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G0yFDW5kRyy3sg3bwM0t6wCsrMo6eodShJuBigH7wTQ=; b=Dn6OfRMRXNEw8UTTc2DkifcZF7LyQJrCOIsse2BSlwrVMxd3hZDmjgOUZa7jPLfiSuHoBk 1JigpV8i88NhjSDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G0yFDW5kRyy3sg3bwM0t6wCsrMo6eodShJuBigH7wTQ=; b=jY1wCoKmlrlxcaUFMs8lq+jdrk/m+Kq0Wk8O+pPAAP79NDs4iEPdptjFj4NBv7PKV2trEe tEzsHUXlhJSFD9Lj2u6JOVedZeBXC7I3AXP7VpfxKH6SDdy157Gar2Ns0L/JNZFTlPLlIp O/voZstv08oKDOE3wAlvBbb+mQs4n8wuA17GwOCE3NR8B2cY+YMr/xFfYjFFYi4T55b/KL 1POxQPlBUKCQZYZ6IgPQYn7n/XoLL6Olpo9uuLdyWhpNpYhYO1I0c4txugC4vp5aXZCUri nJIgCCfzPUV+UWnoI2SBSWXdiJFT1VIvKhChc50miXyEVC58/0r2BaC1Hq34iA== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 09/15] network startup: check for correct action at start Date: Tue, 23 May 2023 19:23:09 +0200 Message-Id: <20230523172314.7826-10-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" If we check this at the end, we already do some calculation in the next line. For example checking if the devices are correct. This is not necessary as we can already stop when we get an "stoop" or something like: /etc/init.d/network green stop This currently ends in an infinite loop, which gets fixed by this change. Signed-off-by: Jonatan Schlag --- src/initscripts/system/network | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 9694165f2..06240f53c 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -26,6 +26,11 @@ eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) DO="${1}" shift +if ! [[ "${DO}" == "start" || "${DO}" == "restart" || "${DO}" == "stop" ]]; then + echo "Usage: ${0} {start|stop|restart} [device(s)]" + exit 1 +fi + if [ -n "${1}" ]; then ALL=0 for i in green red blue orange; do @@ -100,9 +105,4 @@ case "${DO}" in sleep 1 ${0} start ${ARGS} ;; - - *) - echo "Usage: ${0} {start|stop|restart} [device(s)]" - exit 1 - ;; esac