From patchwork Tue Nov 10 02:22:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397224 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=IFxeyZVR; 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=CkA0bjv4; 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 4CVWsb5dxBz9sTK for ; Tue, 10 Nov 2020 13:24:51 +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=XZJV8movrkwh3/emdEXCj0KLU/QUiGnFc0d7N+VdQxk=; b=IFxeyZVRbZzobv8+Eb1nzl+Vf eTGeZ3t1enV5x/003hg77apg2CZrLyszO74tzIfzo+dZoDxJtDdNENAgErMU8L8oNtOSx0UR3SMLi gAu7gl9twZtoKVjfzPaXbf3Lxet0uoQWBM/ghscnNNM7pCyuoBkYG7yIsFN6/2nY5fyOGZfzQIhKg qi2GzMy0HUf7XhAjyUEIAtD+FawZO/mQOVYRP4rWz2HrjGFZkVu9IblPMnvX7BqOOtkK3FvHhUKJ8 IhBUJvQohhPalN2BkjtcYt6Y1TQY/EktmVIp318oyFkipg6dSE3Us80O9y3PKzmLBPAEInxP45KDa OK88JsDzA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJX-0005Rh-H2; Tue, 10 Nov 2020 02:23:19 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJB-0005K3-OJ for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:23:01 +0000 Received: by mail-pf1-x42d.google.com with SMTP id c20so10001121pfr.8 for ; Mon, 09 Nov 2020 18:22:57 -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=KcMEnREo6BEd15npJGIBPyTMpmEsaOcO0+cQQ/ep5q8=; b=CkA0bjv4/SBZHstG14Gxmb/N3IosrRp9SCe+6tNsrW+d+tQaVwIG/FdsZzKRQpsoYd nBWlao9TFBFPAAG+u9C5ghScDibjulp1jF3TFodPGWwNDvW5/ZCM4TlwjkPuThTcO7w7 Znot8t+XZtoxy9Tr4pXGa58txly2xQ79pp9SdjZ+46LjDgmndzjcTYGJcsjn9NWDE74q pcybUWAD3Uh44tHGYlotndLbDJYSaPMyjcvoiXH/gBkB+miKuoYwtk4Nfv0ctpg+ohoY psRxGlPnfYhd/yOe+hr/r4Pg/owqS8ku+bBl5yxrOf3PIM5sTLo/2eRYyaL365xc39HO yClw== 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=KcMEnREo6BEd15npJGIBPyTMpmEsaOcO0+cQQ/ep5q8=; b=HFPczd551M90rKTA8jc/yK4bHcC7u0aaIubD5IxaJmJlkWgPUbHls6EGH7mb2mrik7 9FWVnt2TSSqDYdiTrE36S7tJRa7bccQhpc/6cjhKMOmnfUXHnr4adpHHGasrnRgpayGK MCT6U8TEZFmKtLKdAYghDbcg/0x+tleE/patr5d8HTYpL5y8TzS2Sz096lRYRgE1Xx6N unAAbMTlSeNF1zYJAExtusKw3upKia0ZqRJPfBPRMBQXg9ODCcyH/Hu8RsKbcS0HxUPe I3gAI1wjnQ0gV8lNgW5LUUoWTBZN8W4PGAUz1DGHyulhj3+gtYqfo5ZO11qx6yuiYHSP z1PA== X-Gm-Message-State: AOAM5306LH++mk8Z3XQWHkbrsua+ZzQXQrl83NxZDlZIQ9oaG+29uw3M XxnnL7dYwZuPePs1N3bbFT0= X-Google-Smtp-Source: ABdhPJxC9fiSk2vkWGYf05P250aVBlVw2pBdS2mjBnA+iPQrlXzbn7GTw/H3lVcpBOJjGURIpAukgA== X-Received: by 2002:a63:5143:: with SMTP id r3mr9909120pgl.439.1604974975607; Mon, 09 Nov 2020 18:22:55 -0800 (PST) Received: from titan.office.yunion.io ([103.119.177.162]) by smtp.gmail.com with ESMTPSA id ck4sm863197pjb.50.2020.11.09.18.22.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:22:54 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 06/10] base-files: upgrade: stage2: rework log lines Date: Tue, 10 Nov 2020 10:22:19 +0800 Message-Id: <20201110022223.41175-7-yszhou4tech@gmail.com> In-Reply-To: <20201110022223.41175-1-yszhou4tech@gmail.com> References: <20201110022223.41175-1-yszhou4tech@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201109_212257_882871_9D624375 X-CRM114-Status: GOOD ( 13.88 ) 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:42d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 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.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 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 Development List 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 211a3f4b33..f2db08c3be 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