From patchwork Tue Nov 3 12:21:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1393002 X-Patchwork-Delegate: yszhou4tech@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=lk55EaJI; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qY0CA6+2; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CQTVv6My4z9sSs for ; Tue, 3 Nov 2020 23:24:39 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6BDCkuBnqKWLHzkpFIC+kBjW23Iu9Lhjcp4Vs1nG7uQ=; b=lk55EaJIoo1zBz9Sv4zH2bdPN r/7vd3UPNJ2l7QAEKuWeEjD+Qx6LRtDhB920idtCHHQR9ySSY7N+QosLIwdRyZ83HuNDcn6ReKxm8 Q+/kaDnte3xbfGwkCawpWFZWjVPDGZ4fHUGSLVsAbzXIECg1wNyB7e2r/W3bRSzxuf+0tICfw4QOB Z9ovl4e3wlJrlvk9jI6PMeqi+7uOSsk8aF4D6+4zOTmNrI4IN7JJJ/sSQj3BhAwtgj5uTmHTqQVuq aFpuN3ZR5NOZgq+8FoQ1gu4k/M/ioZqPw04GeJ+8lAeTyEMS4O5Sm64jpQ+leJpwUrpPRCIQ5vWKA nGahEQYzw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZvKJ-000135-W6; Tue, 03 Nov 2020 12:22:16 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZvJl-0000uP-4o for openwrt-devel@lists.openwrt.org; Tue, 03 Nov 2020 12:21:42 +0000 Received: by mail-pf1-x434.google.com with SMTP id c20so14035653pfr.8 for ; Tue, 03 Nov 2020 04:21:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W+MuQasLK206eJoHBNqd1MnlO7DtuhoWgkzvvI85EFI=; b=qY0CA6+2bOUeq56ncY1zUn6rzAE8aXWSu2uF3nOOfkAt81NymfGs+beCP//1sq6mvd QFmTlP8V+ciX1pGi/RJpMnCB1pOjCslK6XSdlUXDI5SynLvyPbA53b3hPGTRX4/EMd9C 2YoGz+MvHXG30K1stGdRM56sJiROZ+xtI5+4nso8iuRhKZ2SiwfuH7LysC91bW4fQLYM Lz7cY0ZUGZb0b2bB4v5SLv2l6phDrHpFs02w2f6VKAKsIayjzlcvzgfh3GAAciFcWakR 2J5sFwD9Vhu6tYC7wO0UqC020J1LPTVURc16OcS6d1SQqsX5lZRZRQZx0jf7fuLhcaAw 2o9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W+MuQasLK206eJoHBNqd1MnlO7DtuhoWgkzvvI85EFI=; b=sATWh5dZqTx963uvPGqk06RaYs6hRgY5F9H1LeLVsOHy+8DWsFNyiepRjclPOSttld AhqYr8ObERP5r22SdmWFcOHJX+5kG9PmWVHUFZGKwa2+FzuwfSgxiF9rNKzV2Yzv4Q+f 6NnVHhQuytfnqjuuFLxdhnrfESwLxtrB6UdurxXnce+hSRS0vrRsscOzUXcmkdXP4J92 OsWWAKMm2fdAQnvdzJfRFv7jSXvxXXJZ6CE0PRWHE5HDDFw3KBybmN2WFBq9ef+BqDJK Kuj/xFFlcDAnEQWHCMusW+w+iqeu4F16wJiWIrE+B/NrtLR7L0orfkc1uPUX5ACUiqN5 ci9w== X-Gm-Message-State: AOAM533wPdKfIRtku9CCvhi4N3aP8vMj42mNU6budq/GtBnuMSHPrjo5 tNEYo90THJU7V6dN7gpk6PE= X-Google-Smtp-Source: ABdhPJzDMkg0S6rxLrDdoslFsrd6ZUNBvPg8A9Pbezyo+WVyl4Hur7+zZpyN6CM4j4vEV6sm5zZDZQ== X-Received: by 2002:a62:7f8d:0:b029:164:80a4:18be with SMTP id a135-20020a627f8d0000b029016480a418bemr25281772pfd.46.1604406099080; Tue, 03 Nov 2020 04:21:39 -0800 (PST) Received: from titan.office.yunion.io ([103.119.177.162]) by smtp.gmail.com with ESMTPSA id r17sm17516980pfc.157.2020.11.03.04.21.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 04:21:38 -0800 (PST) From: Yousong Zhou To: Philip Prindeville Subject: [PATCH 06/10] base-files: upgrade: stage2: rework log lines Date: Tue, 3 Nov 2020 20:21:03 +0800 Message-Id: <20201103122107.30400-7-yszhou4tech@gmail.com> In-Reply-To: <20201103122107.30400-1-yszhou4tech@gmail.com> References: <20201103122107.30400-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201103_072141_266594_D65D474A X-CRM114-Status: GOOD ( 13.09 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:434 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [yszhou4tech[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yousong Zhou , openwrt-devel@lists.openwrt.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org - Use common v function when possible - Write log lines to stderr when using echo Signed-off-by: Yousong Zhou --- package/base-files/files/lib/upgrade/stage2 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index a4fef42134..b452590eec 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -53,7 +53,7 @@ switch_to_ramfs() { [ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64 supivot $RAM_ROOT /mnt || { - echo "Failed to switch over to ramfs. Please reboot." + v "Failed to switch over to ramfs. Please reboot." exit 1 } @@ -75,7 +75,7 @@ kill_remaining() { # [ [ ] ] local stat local proc_ppid=$(cut -d' ' -f4 /proc/$$/stat) - echo -n "Sending $sig to remaining processes ... " + echo -n "Sending $sig to remaining processes ... " >&2 while $run; do run=false @@ -95,7 +95,7 @@ kill_remaining() { # [ [ ] ] # Skip kernel threads [ -n "$cmdline" ] || continue - echo -n "$name " + echo -n "$name " >&2 kill -$sig $pid 2>/dev/null [ $loop -eq 1 ] && run=true @@ -104,7 +104,7 @@ kill_remaining() { # [ [ ] ] let loop_limit-- [ $loop_limit -eq 0 ] && { echo - echo "Failed to kill all processes." + v "Failed to kill all processes." exit 1 } done @@ -129,7 +129,7 @@ if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then fi if [ -n "$(rootfs_type)" ]; then - echo "Switching to ramdisk..." + v "Switching to ramdisk..." switch_to_ramfs fi