From patchwork Tue Nov 10 02:22:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397220 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=mBFhEPqg; 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=tn/NB2V0; 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 4CVWsT5ppJz9sSn for ; Tue, 10 Nov 2020 13:24:45 +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=DfSUHvhvEaroqertCdAkOqGH5tJwJ2/RW7uqYCrB6qQ=; b=mBFhEPqgtKyw/CMyqImSukHIF k6LuBq2zuZkeZEfd5CyAtuglbbd9qCoPyisN7B1roRQKhIOYOVawHgxWdz61lnsle3Tx4EfMbQ+e3 rtgcZ1pUssVMlZP7oJ1WXz9TwmZX7OQ9LEYPnCQmlw6NcQxw6b0I4nSU9/sEpDsspzjodBEWWHSqf lBzItAj4AlnJAssab+qFwvNF8ZIQO1PhKf7K1BbsDCXOD98DiW+JhAibXn0TFE5NuxyMECTafggki S+zFl4Yec9TW5oKBh4TNpmxzhj7Gb3aCHFhHgwRAyrtmBTtcd0kDtv7nIo+Oak83K3B7a5U2GgOhC IPry4bI/w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJ5-0005Hv-6P; Tue, 10 Nov 2020 02:22:51 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJIz-0005Fi-HT for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:22:46 +0000 Received: by mail-pg1-x530.google.com with SMTP id m13so665625pgl.7 for ; Mon, 09 Nov 2020 18:22:44 -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=XpE6lu4dABaDupJ8VOshoLPm0YB1wqbgnrWYFOsNN58=; b=tn/NB2V0n+rv2/Lb1dywBJCpXDRB9NEq7+/mz7wYE4ARAfhcPB80Qk3sF9+xeEWLKJ 2Cn/VwGXtY2I+znpRCoH6kHUhxzP0E0xfhkn0UhjwhfZBbA3ddjS1TUkIqzM5XdNmTrp zg99mu/3faNealbWsdxxJc32DHb0FH5oYCF2SCxZfwd2HlRDTvWy2txVFil4U6QsNXI3 atvK01OBHSRhdApa+gFeo8S0BBG/NfcYrFMPDhJOewhjSfl1XKc6G/DkKzgwkeVpzlc+ 2M+yDBws2TGHsJWpsID2uHw8O38pMyQrayi/IsZdaxTIxy03yGKPyQEL2xMBi6e0UOp1 L3FA== 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=XpE6lu4dABaDupJ8VOshoLPm0YB1wqbgnrWYFOsNN58=; b=n+U13G9BKABj/F42UnY+WYYL55joIovP1ExSqBVNM9FD7wMbkuLo9uVjjL2fkOou4+ q0dlH/70M13HZmbLjVzosNGhl4A1ZYnE6f9kkz3zTsXMobRvvSC3crx8zwBQ/MPxfsGl 5wk+MjsKHkWqH6sc0kcAUNb/1zQfeIYj/bfiSHPVB6KiTEi1LQI30gOTnwTrlx8pD5wQ YkF56XX7VTLFox71Gvc6AdBdjoJkwfxrw9nDxO+eLv02+ZfsQUmmwj+af5qyXpvhFwgV RGH4/zP9Qn0PpG/6XWrP+/DW8LnwRe21XOxIXhZ0y5cOrpOl9XaUKsZVUlp1vH3x5QLD ou9g== X-Gm-Message-State: AOAM530ORfSbLMiakHU5y6VDexpzLl2ERE07dEXEoHtO1s3IQEaGVyQy uu45ZlPu0HEl++PP6Ff8SSU= X-Google-Smtp-Source: ABdhPJxRX5pSKCikogKCKDPBgPQcHDOKLXHBO11OCqrQUuyv7Eegdcnxqexsb3LMT1LqafAa9Qss4w== X-Received: by 2002:a65:528a:: with SMTP id y10mr15006026pgp.246.1604974963375; Mon, 09 Nov 2020 18:22:43 -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.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:22:42 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 01/10] base-files: upgrade: log with date prefix Date: Tue, 10 Nov 2020 10:22:14 +0800 Message-Id: <20201110022223.41175-2-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_212245_591893_3AF3CE83 X-CRM114-Status: GOOD ( 12.97 ) 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:530 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 Signed-off-by: Yousong Zhou --- package/base-files/files/lib/upgrade/common.sh | 2 +- package/base-files/files/lib/upgrade/stage2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 2eb26ba44b..c4947e4624 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -64,7 +64,7 @@ ask_bool() { } v() { - [ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$@" + [ -n "$VERBOSE" ] && [ "$VERBOSE" -ge 1 ] && echo "$(date) upgrade: $@" } json_string() { diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index a4fef42134..211a3f4b33 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -42,7 +42,7 @@ switch_to_ramfs() { mtd partx losetup mkfs.ext4 nandwrite flash_erase \ ubiupdatevol ubiattach ubiblock ubiformat \ ubidetach ubirsvol ubirmvol ubimkvol \ - snapshot snapshot_tool \ + snapshot snapshot_tool date \ $RAMFS_COPY_BIN do local file="$(command -v "$binary" 2>/dev/null)" From patchwork Tue Nov 10 02:22:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397221 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=wK6iRH0g; 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=hiUkI1Fb; 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 4CVWsT6DFSz9sTK for ; Tue, 10 Nov 2020 13:24:45 +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=2TWIK6kRAOIQ2iPIGYgpS5WQ5DDWpQAddVdYaf2XVv4=; b=wK6iRH0g6vMsouebjJhQZ/pSF BV5LMHAT2Q+MRwK2aVL9AfOBLyhz4J4uLDWz57BIknMWzc5WDYoiqerNgcQrKOZ3ZuMTvWm29n5rB ROCfpVQZhCwlwJVTdFo68aGbclvApeqA3uqiEGO70DvxntRfrw5+bL5VHvE5DykQhXYpTKMVIgpUK HD36VbIJt1guDOYcfcVIjhMPImW6RzW98INpLvHr7SEj7VQN4f2wX9ZMw/d5J/d7WQztyRmyC8S7d 1cp/50DB2mhGVxWVW+kp13S6eFsSjRedfFDKpaPf5uFZ+a1KE83dcUP2LwD5GX4xSzC5G4LrG/hMk z1GV90f1Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJA-0005Jw-EH; Tue, 10 Nov 2020 02:22:56 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJ1-0005GZ-Sd for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:22:48 +0000 Received: by mail-pf1-x42c.google.com with SMTP id q10so10018481pfn.0 for ; Mon, 09 Nov 2020 18:22:47 -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=fSP3ceFzUKCPBc6clujuYQGqAtZeWANb+bWNdXLlDEY=; b=hiUkI1Fb7mCjDIDx4eMIOP9T6UZWZiOC7Pnkk+jQXQkbj8/aU3nRysmPlE2kZOGJg+ DwKtwlv+Akbt3YnUYDUtIWSppYFV+awM2UwDw5RVWxM+f3gxdMbGN1Y3uuv7nCVw0u3j bHDYnDPaH2ldQaNmy1pUdRK2kZupcNi3O8NdC66+GSrllC6kG1LAY8m/s+Lcf+tInqqJ UpsXDjW2K4AdOKLdvolh9XPY23JfAHd1DbdHUnFJdrG/0Zv3xYBrGbKV2E8Ilz87EOpi n6uVjzGgT8suy8aTI9ELXrKMV84+Nh55QPagBSuepoUPODFMhRcsUz3xWQsyf2kzPb5W t5SQ== 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=fSP3ceFzUKCPBc6clujuYQGqAtZeWANb+bWNdXLlDEY=; b=EksbD+MxmxqjBoSly9sY40KmZFbAjv99v/Lddo8wHbaBXCm52wOxLk7xavt/x1iPQ3 y9P4ttcWyC6T26uqqGB7A3zHdyy/eJFL5KCwqgsf9rapIMtOiqceP67sLgimOJI+Dr6i zfsDNGLLKx0GjgmWUpdvpfXuCWZ91xUyIFGtwsLz02ap4//EhfrFeD028XLX3nCin2qk AACPCbRJI3srDzCN9GNWqc07+KQcW49kaMWLp5R75x6do1l+P2fE4oUOxrhJEChWfcr1 V/+MhXS68/g/3jFY7SAtbhYdVYBdKr/1IxdopSkp0F3ECVElPDfdNe5Sfrg9lqIr0Fje jPLA== X-Gm-Message-State: AOAM530tRCXsFjQFKJI+CAdGtiaBzMkcc4rcLBr3UqZN96pYNgGdvbbX izEJxNUvtKI4E6EIPEQZbVE= X-Google-Smtp-Source: ABdhPJyn7i+8k+cQA/CfwGc5JkFlSihO8v59C5LZIlkX38ycMycmaU/mQzFMJUNy6u/B+4LY6jSZ5w== X-Received: by 2002:a63:6507:: with SMTP id z7mr12471639pgb.86.1604974965960; Mon, 09 Nov 2020 18:22:45 -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.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:22:44 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 02/10] base-files: upgrade: use stdin redirection to replace cat command Date: Tue, 10 Nov 2020 10:22:15 +0800 Message-Id: <20201110022223.41175-3-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_212248_015515_1C07E83A X-CRM114-Status: GOOD ( 12.80 ) 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:42c 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 Signed-off-by: Yousong Zhou --- package/base-files/files/lib/upgrade/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index c4947e4624..e12dfc9678 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -91,7 +91,7 @@ get_image() { # [ ] esac fi - cat "$from" 2>/dev/null | $cmd + $cmd <"$from" } get_magic_word() { From patchwork Tue Nov 10 02:22:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397218 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=RzrN9BtP; 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=meyNICFT; 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 4CVWsR5hshz9sRK for ; Tue, 10 Nov 2020 13:24:43 +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=pKNDEQCpNB6pTeXIgu90kPDdavUY6uhwUhG7ZxguDtA=; b=RzrN9BtPXxBxHYRKm9DmQ5mtj J6Idv/cpohk1PAfeauY/AeTCmm0SAWyv9yY6BvRLOqLAauFS8y1ZzgHLEGnTXCnmVgDl30CDaFpu/ MccVtoqRs7aXhouzyK1L/MnBYSLEqu7HGYno96iszXj4Vbfa1DCRQkURi9GylntVyGgZJC3s+rmHi f0EUarj34mw6h39E6FCEtVzLEdna9XDTMZG90rNQSqHgpvJbqO1cbWSrYRDJYA2b4KctfKkvvB/rj o8MlGtOl0N2LLtAp4Ph2o6bEV14hGuW7+tdlBVB1OOjuoS1hTT6SUu7JonaNgOn1YJ+jBNb4+ZC/p q4ILleg0w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJE-0005LX-W8; Tue, 10 Nov 2020 02:23:01 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJ4-0005HJ-93 for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:22:51 +0000 Received: by mail-pg1-x52c.google.com with SMTP id i13so4038045pgm.9 for ; Mon, 09 Nov 2020 18:22:49 -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=NXJjYToM1gs3xXGXRa/6AOXm7f/kf48mg7mpvhTc66M=; b=meyNICFTkwxnNqdS0AKj2W0EAzAxhhE1kF2EzIPxIJrE+ku/Zgp2oxX3IAPEuVN0k8 QfYW1YNifurds7qinf2Bklrd/rxZ3sDAvibKShBbypwVA9DbeJj0usZQhjYjTT72PUXn jHTQkVYLpAMtJuIvafzfm8iKpFuy5WECBo3NmYPiqlOcNCEeHud8tySOn8rIga/QZ7HZ QchyOvsZyJE77++5ME25tT3+VZTjCznaOVde/Qr2zpqp+SRtu043vfn9/iJfS8ZCdEtD t/+EYSezLl2efY7niZjGKOdPuqN7kCssKOuLg9hyM/0YQS+IpdT+dLHtgpih0p1v+qpJ BRWQ== 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=NXJjYToM1gs3xXGXRa/6AOXm7f/kf48mg7mpvhTc66M=; b=VYLQm5XcBJ+qUwH+/STHr9XmCsR7xN0t5ii0X71PfLd37j+ACdo75TP4KTgJn6OO7M oQwME573Pt7xCTMwBRtRM6Iv+/nnJDGKAISKEihjfMBeMgZTroZBp+gdeC+W39lVlWGS TyVIotE1DEMnmQaf6vk+pZqeDVCNRBZqvX8k2GUbZbvQyODNRqxgDWtqOBGwuoK2h2q1 Rge4A4zPKm7JtHNB4kRTMZRlW8ROU5GzcWebfG5QySe1Qv83UrIPJ2J1xwC8F3gQxNL7 WlrzWNfis7S4jnAwil8DQwOgD8Xw8KpkBMyfI+AnS1VKILywVAinDSi0mRXIXG+L3aud pqEg== X-Gm-Message-State: AOAM531/4WAHwN818OgkAji1xUWG8Uv97pJTTKo8xVgw/VHMzWWizzy9 bu7b1OsqvhQAXeZP89X0Gec= X-Google-Smtp-Source: ABdhPJywNJbsZd7JsjH4yNPMTRf6w7GDdyZpFMs/oIfGfCH6l/nglGivNZdLC3h7fLMSUcopI83g8g== X-Received: by 2002:a63:4006:: with SMTP id n6mr14986412pga.171.1604974968277; Mon, 09 Nov 2020 18:22:48 -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.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:22:47 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 03/10] base-files: upgrade: add get_image_dd() Date: Tue, 10 Nov 2020 10:22:16 +0800 Message-Id: <20201110022223.41175-4-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_212250_410372_31750A4C X-CRM114-Status: GOOD ( 10.52 ) 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:52c 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 This is mainly to handle stderr message "Broken pipe", "F+P records in/out" by common pattern "xcat | dd .." Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3140 Reported-by: Philip Prindeville Signed-off-by: Yousong Zhou --- package/base-files/files/lib/upgrade/common.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index e12dfc9678..6c09908ee3 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -94,6 +94,12 @@ get_image() { # [ ] $cmd <"$from" } +get_image_dd() { + local from="$1"; shift + + ( get_image "$from" | dd "$@" ) 2>&1 | grep -v -E ': Broken pipe| records (in|out)' +} + get_magic_word() { (get_image "$@" | dd bs=2 count=1 | hexdump -v -n 2 -e '1/1 "%02x"') 2>/dev/null } From patchwork Tue Nov 10 02:22:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397219 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=eN+czNMR; 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=JxenqS43; 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 4CVWsS5lgcz9sRK for ; Tue, 10 Nov 2020 13:24:44 +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=3vARgpl75gQps4mTgelZmuEi1EEGHOUuNv3n2huUv8A=; b=eN+czNMR2/kxzBUriwppGSEOL q9ExBm2zIdvFgQVRSliGX7XiwijIlrns10hXVP1SLPYizTQy9yGmb1SgOO0gzZS07OWTij5TFVUi3 ZPfuPfXUdK2sNs4USG6DsS7P2F8WyYNmoeZQ3r2MIUFb9XLiiISgs10/iv4oKiMFZymZeAn3Qh+Qz vxobqLc8cZnVi10zDjLTgbE7pgiJVkVTEojGmhisjmvXWm7mhWwj439mHFuUUAKqZL/QT2qmJ3Yg2 uFYDNah4inSOI1ECSfCQmRcqng/KA6bAMdknma7tp29cBJ1deBzwdt/qlYr4Lm5WrC63wBpN47rhJ o8TLhYq5w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJN-0005OH-8E; Tue, 10 Nov 2020 02:23:09 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJ6-0005I6-ND for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:22:54 +0000 Received: by mail-pg1-x536.google.com with SMTP id r186so8840169pgr.0 for ; Mon, 09 Nov 2020 18:22:52 -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=Z2QpyyXvvbik9QhtGlVXZMnVxFO1qv9geA4I4QBt5xo=; b=JxenqS43bIA0vSOrI433J1NFIX6f0Jc79Yz5BOfUyU+e31/VYwxIh+UuSYQCVwsJJk whOSrfOLbjPMfAbER8bImHs+nTFLfmWDYlyqKWQN+AFOXyor18zQGGP7H4f3ntB+yx/O jDvQSdicHx+HmNX3nq+u0BJqw9+hkSw28K24hotkt49OMbJqlmA/yQdHGugY/u1dW7gS /zzbMVPJ8dAeMk6aR2URS/kbgaaybcYre/G6J9tiZBvAyXBpZdocAJ1Ykz8v461TDV6N McW7Qn7rHumE1ZcggRbIxz3AItPWPN3T87jWFdUcfgbLBKLqV7CM7i6mZp94woCdkLYz ZADA== 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=Z2QpyyXvvbik9QhtGlVXZMnVxFO1qv9geA4I4QBt5xo=; b=Hab/Oew1Cpnrt+r7TDUiBibLTF7f64gcFr+Hxa955KmQ5nmK8+S25G1s8B/8AdSEf3 H0nI09Kt3tzH8MVH8fBl9se6/6qzKA/DzR2gMQGuIhioS9YWalkD2a1AzgpT1iehHgKt GpNS5Wb4xZsXuttkeV6cg7pWxg515wrGrnmMFCFopo8umcjp2NHbEJPvbXM6DVpskxRx X7/5nBDSXTMmZL+TTh0ifbTsj7IRkeVVcfEYv/XG2XUEoU0AUtnHaPVLqsF+mbGImZyv V+WAFqbnjA/YkUs7GM3EQEm8mVsLTaioifMk2+rR2J6VUm3ecC9Aadz1TtVczajbbx2c LB8A== X-Gm-Message-State: AOAM532kLD56/WrdJn/9Kc/G9u210uAY+OzdNZopDVJ+ZrqDWG7E9m8e H9wFJOhAXh0nSFm9NBFZKmE= X-Google-Smtp-Source: ABdhPJwW5u/Pmi8KTmi91B3WACDYS57iQJ0EgiDWc9gK3s5Cv4ZefBYP3UH25RXfjUzlkdfJUW9sKw== X-Received: by 2002:a65:6201:: with SMTP id d1mr14915589pgv.156.1604974970599; Mon, 09 Nov 2020 18:22:50 -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.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:22:49 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 04/10] base-files: upgrade: fwtool.sh: use v for log lines Date: Tue, 10 Nov 2020 10:22:17 +0800 Message-Id: <20201110022223.41175-5-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_212252_823823_81EF87D9 X-CRM114-Status: GOOD ( 13.21 ) 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:536 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 This will have at least the following effects - Log lines will have common prefix - They will be output to stderr instead of stdout Signed-off-by: Yousong Zhou --- .../base-files/files/lib/upgrade/fwtool.sh | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/package/base-files/files/lib/upgrade/fwtool.sh b/package/base-files/files/lib/upgrade/fwtool.sh index 3a74c72bba..d30b37c4f0 100644 --- a/package/base-files/files/lib/upgrade/fwtool.sh +++ b/package/base-files/files/lib/upgrade/fwtool.sh @@ -10,9 +10,9 @@ fwtool_check_signature() { } if ! fwtool -q -s /tmp/sysupgrade.ucert "$1"; then - echo "Image signature not found" + v "Image signature not found" [ "$REQUIRE_IMAGE_SIGNATURE" = 1 -a "$FORCE" != 1 ] && { - echo "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware" + v "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware" } [ "$REQUIRE_IMAGE_SIGNATURE" = 1 ] && return 1 return 0 @@ -30,16 +30,16 @@ fwtool_check_image() { . /usr/share/libubox/jshn.sh if ! fwtool -q -i /tmp/sysupgrade.meta "$1"; then - echo "Image metadata not found" + v "Image metadata not found" [ "$REQUIRE_IMAGE_METADATA" = 1 -a "$FORCE" != 1 ] && { - echo "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware" + v "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware" } [ "$REQUIRE_IMAGE_METADATA" = 1 ] && return 1 return 0 fi json_load "$(cat /tmp/sysupgrade.meta)" || { - echo "Invalid image metadata" + v "Invalid image metadata" return 1 } @@ -64,15 +64,15 @@ fwtool_check_image() { if [ "$dev" = "$device" ]; then # major compat version -> no sysupgrade if [ "${devicecompat%.*}" != "${imagecompat%.*}" ]; then - echo "The device is supported, but this image is incompatible for sysupgrade based on the image version ($devicecompat->$imagecompat)." - [ -n "$compatmessage" ] && echo "$compatmessage" + v "The device is supported, but this image is incompatible for sysupgrade based on the image version ($devicecompat->$imagecompat)." + [ -n "$compatmessage" ] && v "$compatmessage" return 1 fi # minor compat version -> sysupgrade with -n required if [ "${devicecompat#.*}" != "${imagecompat#.*}" ] && [ "$SAVE_CONFIG" = "1" ]; then - echo "The device is supported, but the config is incompatible to the new image ($devicecompat->$imagecompat). Please upgrade without keeping config (sysupgrade -n)." - [ -n "$compatmessage" ] && echo "$compatmessage" + v "The device is supported, but the config is incompatible to the new image ($devicecompat->$imagecompat). Please upgrade without keeping config (sysupgrade -n)." + [ -n "$compatmessage" ] && v "$compatmessage" return 1 fi @@ -80,11 +80,11 @@ fwtool_check_image() { fi done - echo "Device $device not supported by this image" - echo -n "Supported devices:" + v "Device $device not supported by this image" + echo -n "Supported devices:" >&2 for k in $dev_keys; do json_get_var dev "$k" - echo -n " $dev" + echo -n " $dev" >&2 done echo From patchwork Tue Nov 10 02:22:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397225 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=sH4miD/b; 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=Zk00XhH3; 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 4CVWsc2JXXz9sSn for ; Tue, 10 Nov 2020 13:24:52 +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=UAsXXDouycVhl7JAe9En4k430z+byYD8isP00Tm+Kfw=; b=sH4miD/b9hKyImd+rmiXhPpB6 cZ483HSZY0LOEGchbT1I5w3HR6f9qU743d6LzkSTcgWl3N8JP3bY+kWnpg9tYD0T8chCxk4vkzdNT 18qvfcqC7mIs+yzdb5Nt5NFEji5S1BFU7ovfIBkC5sGlLufZ/Wd9F6e3IIfcBpmI+1LqclxBssqTs 9ORVaIlr/6V22Jd2HWGZAryzcnr6Rj8BQ0KPsu9ILe/muSWlxxoHyaLXLXGZa4iFboUUwjHf8oTAJ 9ZlTHIJbOeJr9eL6JyyKc9jr284tcUEWRFU7XWAZZ49ND8OJ9h6ESxPsrv2nWg6jcNLLn3bWRkSof zQEFm/b1g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJS-0005Pn-3A; Tue, 10 Nov 2020 02:23:14 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJ9-0005It-EL for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:22:58 +0000 Received: by mail-pl1-x62e.google.com with SMTP id g11so5687237pll.13 for ; Mon, 09 Nov 2020 18:22:54 -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=a1RxPMGx4amYrlfv1J/+dKMnhbHzPIxcEsZ/drZexmo=; b=Zk00XhH3H7oppqFeegWELGIZaPSgsGw9abRmergkfHKG0HNTcD7qGAp7cxABR9FjUa RASSXLDV8FbeZ8ojFEAhu0AuIF/b7aNz7qfFs/H+5E1ktIEyOXnW8f9FnAmVEpzVEMek qIq22Ps2VR5n6J7F2kwnbptQ961cdzCmctW8hA8dAOoH5jYwHcTDdqD3rzJ0uCLFUV4V cuekSxq+3QTrrDyne7NgxsAbHfo+iwTPGhL+oX0QzwBM+Fwwf+ssZArk2qBLfXVvsoWY RCfAF1VnfH92FMTiMjv8S5qQreFa2DMuzHSgYc+TX/+lnmednfbM+EDuTWTId6otMe0h bySQ== 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=a1RxPMGx4amYrlfv1J/+dKMnhbHzPIxcEsZ/drZexmo=; b=pm041C2NkAFpvN0LpxxENX7vKSDmltXmKzwlqxNKEtSwg8mN8ZFwvvq/qJHOg+WEEG 3FaFlas3ru48yLTVhmhOk79FPvMIL7iR+QWmFKdy4bsxrF8A1wRgg8ADoPbegOp71zVa lG1/dg8qXE+V1GwWXiSCSOsUktuOpFVXbBlp69Zl28Og9UtNvizQAUpaORFISwl+lCiW 6Ug1LQUchnFK3ZnaNL7zwvqppqZciNQIxcGCAbhJyfDqi295AYkKNn40mwWu4kWREm/9 83KzUyVq/f9jyJHmC5HEqbVrK1ANDfFy5FdCAoe1gQIhhinWZeh7o6ZM9VoLBxE1L3Sf MoLQ== X-Gm-Message-State: AOAM533byVGvSVmjZqLiGfmRZYMw7EKaOMXkyRJ5fuqTnlVoYH5ja2C7 5tXMDmBGrpUkpJ6w8jcVV58= X-Google-Smtp-Source: ABdhPJzseRbw2Ssajt7C0c0Ap0SMGWfldExsFIMt4hVFKuOHHPP+8F/Ef8Gj4a5KUkYkH/Dn2JuPXw== X-Received: by 2002:a17:902:900a:b029:d7:d966:1a44 with SMTP id a10-20020a170902900ab02900d7d9661a44mr8593725plp.8.1604974973315; Mon, 09 Nov 2020 18:22:53 -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.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:22:52 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 05/10] base-files: upgrade: fwtool.sh: rewording logs Date: Tue, 10 Nov 2020 10:22:18 +0800 Message-Id: <20201110022223.41175-6-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_212255_607956_E926A76D X-CRM114-Status: GOOD ( 12.82 ) 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:62e 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 The intent is to make it sound more like info level message, not some error like "404 not found". x86 target at the moment makes image with only signature but no metadata (ref commit f8141216 "x86: append metadata to combined images"). Signed-off-by: Yousong Zhou --- package/base-files/files/lib/upgrade/fwtool.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/lib/upgrade/fwtool.sh b/package/base-files/files/lib/upgrade/fwtool.sh index d30b37c4f0..9262b95108 100644 --- a/package/base-files/files/lib/upgrade/fwtool.sh +++ b/package/base-files/files/lib/upgrade/fwtool.sh @@ -10,7 +10,7 @@ fwtool_check_signature() { } if ! fwtool -q -s /tmp/sysupgrade.ucert "$1"; then - v "Image signature not found" + v "Image signature not present" [ "$REQUIRE_IMAGE_SIGNATURE" = 1 -a "$FORCE" != 1 ] && { v "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware" } @@ -30,7 +30,7 @@ fwtool_check_image() { . /usr/share/libubox/jshn.sh if ! fwtool -q -i /tmp/sysupgrade.meta "$1"; then - v "Image metadata not found" + v "Image metadata not present" [ "$REQUIRE_IMAGE_METADATA" = 1 -a "$FORCE" != 1 ] && { v "Use sysupgrade -F to override this check when downgrading or flashing to vendor firmware" } 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 From patchwork Tue Nov 10 02:22:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397226 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=p7PQcekD; 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=YkE6SuLK; 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 4CVWsg1SBjz9sSn for ; Tue, 10 Nov 2020 13:24:55 +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=ONrvZuNjxlK018ys+b6D4jBgy0CEfiD8zqYKmaBTRys=; b=p7PQcekDbxyItwZ49LYSbG6I+ 5XZRBPeP52ethGpffT3pHVCOsGHw8XnpopPNNP93fMNO+ypJAPYHXLi49CMJPjKeKeobsdmWxnkpw mwIGXefMY724Oel71FqBuVPDiHImr5qDOKal1Oc30snWlTeBxbpB6ER/S/OZTtqj2ZbdZLMe45rSA /2DrRx9YVZbtTuDUq7JRZobvrNFMvRbppmiv6tKI1TDa77HF4B2vD/IsQPS/hKnu4EZiRVlDFKcRv HxpbLs6LJFWwDDk1cfWE7bMAveypOBpoY6u2sOy/8lVuKiRi9nzJwHcvq8RxMv23bKLSAeohXP3Hs Vd+bk0Fng==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJd-0005UC-2q; Tue, 10 Nov 2020 02:23:25 +0000 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJE-0005L2-2L for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:23:03 +0000 Received: by mail-pf1-x435.google.com with SMTP id q5so7022554pfk.6 for ; Mon, 09 Nov 2020 18:22:59 -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=EZc48VUwd/JQfEPQQIybtaiO2DNM2QMbBs866KxHGDE=; b=YkE6SuLKydVemExERoN2rUisl3Lq9mi4eqCTo4wd8Dz+AGVJNUBv9otCSmVFIWE9JY DYdti9hccoji9YZZsrF7HPzJLBGicjgoLIwmja3/Wjnm7BF5FJm2Z6uSSuCAj6DYarvE B4aZTPrkhH5Q/06RZ/O5Eq2c5ZQmpC3SCvf0FOnOCWGCYV4pr9LADD9PHLjJNfyKp/9W B5syJjN34efoXZGqwU54Mdq579LwXb1bOtwHluszBHIoA5sLBvc9/HLnFAZbibDgDE7O CYS6xoaDCl8kgV3dTR/KmQMjeZkTxX9OgFNTXjiGd8wOcUFnAW/eMT7M1M3kWS2GQU8g gjHA== 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=EZc48VUwd/JQfEPQQIybtaiO2DNM2QMbBs866KxHGDE=; b=rCnDGDqYUVwihfa6+M8/wbqYkfkol1DR+fKvSBaRCF61ea9GPU8GZM6nARvFUojnba YDi0UtuI+t99jtHQ3Yq+1h7rjWwQiJhuwjQuRAg56sp8AhaTJfxfPHW+eOg6ZmUA+Wa5 YWl7adU2vf1fnJ6vCiF8EzCmQ5ZOTHduDRMUCc0Zsy/MZeFeLPJelXZ2SLY+blYAPAtO zmNcdL6+YLVwdBNoHo5iFhvYvxBWbX8xtxlcEjWQ6OAQ7o4AUaKBx043h+jupLGSP7Hr henMZR7QFzHATYNJIzSU+HKcnjGSfFQ7mbiGMmgnoX+lcIhUvMv5k/qPweEqNomHj5/W +3tw== X-Gm-Message-State: AOAM531HkbYkC9UQR9ZW5FsrTtWIIWJ/DLKuJtLGW4pM17Znz/iYi0u5 y916F9VJonkeBB59nJLN0Z0= X-Google-Smtp-Source: ABdhPJxohCmLtedNVZnLcuiKrOIty+eCnljmYi79bqtjqPSe4wSDAvWC4Gv/tu35xlv+Azohl9JqdQ== X-Received: by 2002:a63:4516:: with SMTP id s22mr14999655pga.45.1604974978043; Mon, 09 Nov 2020 18:22:58 -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.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:22:57 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 07/10] base-files: bump PKG_RELEASE Date: Tue, 10 Nov 2020 10:22:20 +0800 Message-Id: <20201110022223.41175-8-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_212300_174606_3A3442BA X-CRM114-Status: GOOD ( 12.11 ) 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:435 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 Signed-off-by: Yousong Zhou --- package/base-files/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index f63c4db533..b546eb7e0b 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=235 +PKG_RELEASE:=236 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ From patchwork Tue Nov 10 02:22:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397228 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=I5QSwyRt; 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=eBiS5PCK; 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 4CVWsg3Ftwz9sTL for ; Tue, 10 Nov 2020 13:24:55 +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=+5yPLG0KaChkTLjcV9VY4hnZ2wqYFK43f+MfUH1q1Tc=; b=I5QSwyRtLawW/ZWXX6wyDGIdU WCXi++QHYbC66xo1cxGmCyxs6oxDkUgq2OLGUcOEbQuOD6VApedvT6tafnfj1qKPFuiCj7NbpOD1S uA2mjma0b2rJtYLz1/15KrOd8IqSrnjd8aoiyJj4xiV1ABwzXVxtq3xwb2H+y43FOh06aMRiqmEiV POGhdIUjnt5S3fqUxTe5Wu1KptLeqWK0Hpe4O/bm6wiGLA+MNaEm/5oIcB2Mm3dr7db+mYsBgDay5 AGwtSCpyhLlAnbCk88LfvxwxonhhGB8DVI/Cg92R5NjQg3g94okw2WBmMDVeJPPKaL6BZhMw9nU7r 7weGVSKsg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJg-0005W0-TT; Tue, 10 Nov 2020 02:23:28 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJG-0005Li-Nj for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:23:05 +0000 Received: by mail-pl1-x633.google.com with SMTP id g11so5687352pll.13 for ; Mon, 09 Nov 2020 18:23:02 -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=Fcl2JvQjiSLGcWeI3ykKVYR1QQesdP3Hk4YgYVnlVfo=; b=eBiS5PCK1CKPlYfHo2yAJwiL7QjFjPqISqzRwaiDnpRFBA1lsBnbyaaJrF5Wm4IVXI CznOMTz4+I4PSylgOdgm20YopmE1AN55EME3Qvsjym/Vk0Z6mfawQqqyugaJHDmDKYSL 30gBk4Kib5eWkc0cjfX6mua36NIBt1uw1vpPUDcQv3JmT4JAzo/+q4H9XZdfSi9KZVm1 SqvFf8Jrf0aPOeot91jaQjmX2INtY+Os/difkm6i/xRghI9rn7gZwxPVFD3Nmj25KNn8 I9PRJqkx+P4ab2HD5S4sdw4DDh4BDBHRmBdF3RztIZdGN9jtEwd4rkjZJRDTIsfDIsom PHhQ== 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=Fcl2JvQjiSLGcWeI3ykKVYR1QQesdP3Hk4YgYVnlVfo=; b=nA5DNM1meSsDW3jQ7N9ZhgI9ybd8clbZhJj3xFcf06oVHdmSy/umnmlKL5GnylMJUY eiLWr+S1wQsNaavLwskO4O289f0m8znUTz2ehfZNbVM2AEWB7JDsQPJBt5vdrNoay6b6 Q7XuvK2lvFEHbLnvK+bQ53sod4PoVrkgoRF2J2fQkDUT3yhxoPuweOTSH5pV7EGjJxm/ cxtjBe8suIVsN/rQy7B0iOxTW/RtIEc+4n6U8SL2KKrKzY3KcTztTRrWa/NebD+qeGEU tR4n/ARkcvLor925yzjwZJCLj6po+XDfj2d9lE1UdJVoaKgY/+6zquksegdSOnBM9tWI YLHQ== X-Gm-Message-State: AOAM533zb7THn/BQt1Low/zG65Ld0atgKHGImh85fk0zSvUtyEAX6Wds DToPERLp4lU4uXw5Z5Tuwgo= X-Google-Smtp-Source: ABdhPJyS+JYlo1IL7/ls0+dxwlP++WfkXLgKkAjmd0MJxbHKz87aW0dBMBL6dw+tTRlYhia5WNxDkQ== X-Received: by 2002:a17:902:aa06:b029:d6:da66:5048 with SMTP id be6-20020a170902aa06b02900d6da665048mr15594687plb.5.1604974980381; Mon, 09 Nov 2020 18:23:00 -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.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:22:59 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 08/10] x86: upgrade: use v function for writting logs Date: Tue, 10 Nov 2020 10:22:21 +0800 Message-Id: <20201110022223.41175-9-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_212302_876567_D9A5D1E6 X-CRM114-Status: GOOD ( 13.51 ) 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:633 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 Signed-off-by: Yousong Zhou --- .../linux/x86/base-files/lib/upgrade/platform.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index 1bcd492dd7..617b267e68 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -7,13 +7,13 @@ platform_check_image() { case "$(get_magic_word "$1")" in eb48|eb63) ;; *) - echo "Invalid image type" + v "Invalid image type" return 1 ;; esac export_bootdevice && export_partdevice diskdev 0 || { - echo "Unable to determine upgrade device" + v "Unable to determine upgrade device" return 1 } @@ -30,7 +30,7 @@ platform_check_image() { rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image if [ -n "$diff" ]; then - echo "Partition layout has changed. Full image will be written." + v "Partition layout has changed. Full image will be written." ask_bool 0 "Abort" && exit 1 return 0 fi @@ -57,7 +57,7 @@ platform_do_bootloader_upgrade() { echo "(hd0) /dev/$diskdev" > /tmp/device.map part_magic_efi "/dev/$diskdev" && parttable=gpt - echo "Upgrading bootloader on /dev/$diskdev..." + v "Upgrading bootloader on /dev/$diskdev..." grub-bios-setup \ -m "/tmp/device.map" \ -d "/tmp/boot/boot/grub" \ @@ -73,7 +73,7 @@ platform_do_upgrade() { local diskdev partdev diff export_bootdevice && export_partdevice diskdev 0 || { - echo "Unable to determine upgrade device" + v "Unable to determine upgrade device" return 1 } @@ -107,15 +107,15 @@ platform_do_upgrade() { #iterate over each partition from the image and write it to the boot disk while read part start size; do if export_partdevice partdev $part; then - echo "Writing image to /dev/$partdev..." + v "Writing image to /dev/$partdev..." get_image "$@" | dd of="/dev/$partdev" ibs=512 obs=1M skip="$start" count="$size" conv=fsync else - echo "Unable to find partition $part device, skipped." + v "Unable to find partition $part device, skipped." fi done < /tmp/partmap.image #copy partition uuid - echo "Writing new UUID to /dev/$diskdev..." + v "Writing new UUID to /dev/$diskdev..." get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync platform_do_bootloader_upgrade "$diskdev" From patchwork Tue Nov 10 02:22:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397227 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=sms3zzUt; 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=WjGYQ6Z7; 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 4CVWsg1W5Sz9sTK for ; Tue, 10 Nov 2020 13:24:55 +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=liO7BWKePv1IXib0R+R04VXfDzAIqL4pclJhW/KdJbI=; b=sms3zzUteLDNm7in2kxYVniR4 s89+UvufPzRxClTGCDJ025XkcF4+ANA0E7+yHwSuFUvjsEh6mqLGPj9zzJOhJH83CB62QuPcvou56 QvCjVyIpoB+Iw1W9eZ7NdWa3u2g1MpRFPzaP1lwrJxWIGOspGkzoc6bKWweJIIKeMkvx7BLuZZWWL 2N7NTpZYCQJUlD39q98pw3CPGQ1wkSOv8dGwG/HTU4/QAsLDz9yT3u704u0ljMXip7LEhY2NdWZTE UrTp9OJgCWaXE6DdCcrZbpAxjr8TQOkCm6/U6uT7l0D8XLWjBPZZwdFrBegfl3BM3qwDShXcx46aI kmgx3VbHQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJj-0005XK-VJ; Tue, 10 Nov 2020 02:23:32 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJJ-0005Mf-Ie for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:23:07 +0000 Received: by mail-pg1-x542.google.com with SMTP id f38so8831989pgm.2 for ; Mon, 09 Nov 2020 18:23:05 -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=yacUHKKfjmck5cTCAA6En5tPBHMrJh0S1vVweiv+7Bg=; b=WjGYQ6Z7FRRxTFS2FZdWXlKg6cePmXbpNUSVzUrgd6LtTCMeGXfrfYKiQZ9ERVbyXs 5ffdb7fY4KG8RYGhXN9LAeARn3lLRXozh3gqsGTYpyryrhC5fedncCjjyRDlqriUTF7s I+bsBKqe4pK6K1ApzCF2hfch1ThSk/UdRi92Mofr8cFLiL/lENRRYHgdo8dETtXuDv26 A9yWLc5LEYlvPc1aE6Q+clE6lLItv4VpcMF4gR/mNwrsV767HMQN5hQWReM/KQoM9hM4 nzk/D9D/dIQEaI5GZYxUMsqIzKQ8LI40kOwByubyja0MRIWiEZRyyXyPaY/vzD4MzRzN Rl/w== 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=yacUHKKfjmck5cTCAA6En5tPBHMrJh0S1vVweiv+7Bg=; b=HHktNygcemeFqqTBATG2p8jvhyFAQ0LoyT1dGYHsbrpeCD5+TcGP4ApjRnXJ9tW28z IlUvIbs+3vIo3pu/qQCoZPlMi/YxHoLnlm2Z+HCDVPAVX2x5Qx/xpje1tBiWEG5QKKUE Lu1LQ0zv2v9vjadBZ6xj3LdDbngh4J3MXRiIHYm8DqqKRnojzNGKuG+M3E0yZ1m9LlNh NY6LI3+zZAJXjH8k6iytz2NnjAzsoAOO9ppR1B0EvF9IWgaK/f8WVodQAkVTeaSGPqhq br3zHyc5ZTJx/m4hQtHt4e2kS4tVZJrF+XiYYdmSTlVQQ2YNy/dzIxfD3P6nc6FQEYeU vMNQ== X-Gm-Message-State: AOAM533THENUHFZk+6i9wkDhG3Lipv4vg5cpGNKdrTc3lKxgYpNfIgqd 7Ds31rO7kfdtEMkl/TuCxMM= X-Google-Smtp-Source: ABdhPJyXLvlqIrAbabnwksZ44V5zMFtAZG5L6VuvHIBng4G6wsNjMoxwo/G5JeuJYK9q69dRmkcW4w== X-Received: by 2002:a65:610c:: with SMTP id z12mr15531001pgu.64.1604974983664; Mon, 09 Nov 2020 18:23:03 -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.23.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:23:01 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 09/10] x86: upgrade: use get_image_dd Date: Tue, 10 Nov 2020 10:22:22 +0800 Message-Id: <20201110022223.41175-10-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_212306_208839_EFFEB541 X-CRM114-Status: GOOD ( 12.87 ) 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:542 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 Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3140 Reported-by: Philip Prindeville Signed-off-by: Yousong Zhou --- target/linux/x86/base-files/lib/upgrade/platform.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index 617b267e68..0b54caea29 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -20,7 +20,7 @@ platform_check_image() { get_partitions "/dev/$diskdev" bootdisk #extract the boot sector from the image - get_image "$@" | dd of=/tmp/image.bs count=63 bs=512b 2>/dev/null + get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b get_partitions /tmp/image.bs image @@ -83,7 +83,7 @@ platform_do_upgrade() { get_partitions "/dev/$diskdev" bootdisk #extract the boot sector from the image - get_image "$@" | dd of=/tmp/image.bs count=63 bs=512b >/dev/null + get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b get_partitions /tmp/image.bs image @@ -94,7 +94,7 @@ platform_do_upgrade() { fi if [ -n "$diff" ]; then - get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync + get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync # Separate removal and addtion is necessary; otherwise, partition 1 # will be missing if it overlaps with the old partition 2 @@ -108,7 +108,7 @@ platform_do_upgrade() { while read part start size; do if export_partdevice partdev $part; then v "Writing image to /dev/$partdev..." - get_image "$@" | dd of="/dev/$partdev" ibs=512 obs=1M skip="$start" count="$size" conv=fsync + get_image_dd "$1" of="/dev/$partdev" ibs=512 obs=1M skip="$start" count="$size" conv=fsync else v "Unable to find partition $part device, skipped." fi @@ -116,7 +116,7 @@ platform_do_upgrade() { #copy partition uuid v "Writing new UUID to /dev/$diskdev..." - get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync + get_image_dd "$1" of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync platform_do_bootloader_upgrade "$diskdev" local parttype=ext4 From patchwork Tue Nov 10 02:22:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 1397222 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=wKsBa9+7; 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=If8Bb5BA; 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 4CVWsW5jzwz9sRK for ; Tue, 10 Nov 2020 13:24:47 +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=x1kp1MOhXFeJZyFHWOMXpJM0jt1ou5XZd07z6iE1deo=; b=wKsBa9+7rbyCQdoQ/1GE+lAxQ MlzG4qbNNsFpsxLX5QA9SxzBQGnVXRUI7R0xGhwtfncg7aIu13HqhQyrepWvvsRsjy7oVz3jEV2K4 OfSkQXg8BXn/8u6b3wa0JrArI9QPsaeqFlnQgjQd+BFHuKaSLDm8tlBQK2c304LGuR2KtY62y0Wvq qujNMwHf32UEn9ui4+KBmIaqGBPp41Y5dPMsw4NK8sgbRMkNHvTWTAhdkm9MTSMo8S+a1jsRAW+l3 Z6cXn19C7TOZxnsAffSDA4L0lJUArKyQi/SBVoSbYz5n68FRgkCbAXnBi78l3NYkETiDzrlkRp81r 1cU+ui9+g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJq-0005aP-RA; Tue, 10 Nov 2020 02:23:38 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcJJL-0005NR-Re for openwrt-devel@lists.openwrt.org; Tue, 10 Nov 2020 02:23:08 +0000 Received: by mail-pf1-x442.google.com with SMTP id w14so7380347pfd.7 for ; Mon, 09 Nov 2020 18:23:07 -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=WDJu6xkxoq6xji26BY7zx6+qRBUILmLjc82QnaB7NX4=; b=If8Bb5BAJSW/iQ30VsZ7eWDcwmbMlfb5yqjqHRlV9yoGtndnIFvjvY2YyB0RExFnUK ZtpbJCMGqUllaU7EJNlFxy6lKlM+kwes92x0DXV9L1a1if7LeHLbmb2HyX05OLusId+b cl9PE1lSNfIqgpxiWIfX6Pkt5ImKoxI/aeYVzaDSWgWrGzJl71pvWQAVlxEcFi75vDD4 USB02nR8bX9A2BOpHkJfAHqr3ek7xzn9zNIghVta2qJUOg9/AQbIYIz6pXBr18AjLIfJ /hTdpyacJYnVsq5uaxnTzTurtz/cXxjRHaLarJWQS4Ud4S/wgv/Y9bkudvk4VfKOx3Xp sF3g== 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=WDJu6xkxoq6xji26BY7zx6+qRBUILmLjc82QnaB7NX4=; b=Q9glDXo14LN3WNtjEyEIO6fMGtj9x43k15hsXd9DkCWuUOZh7FVzdhWhdS/ct4SWbW BW4soyrJ4fH3OEtl+XxnO1+mR1JHbEH9bPZVzJU0xpTM4Yl60sg531dPEt2KnOa8LaIk TxxDBwRHUGh4mqv1BJC+FBWXey/yPSiYqGwOdHR0aiCY8BVfDkQFuYwwWXl/4yQWQy6v p8wrUEQ/gCP6JQwLkr9FlYyeEje2yux0mFuhYxMcVH+3tVHnonQYqNKbCZJF3h47RUUk TWw+kgrfBkA/b486A+VUS/RaHHJWxtGF5HTF3JOBiEAnavyQDMTZwVOqLqXS2BwU54CI CZrw== X-Gm-Message-State: AOAM532kjCic4+AFYpjxaIQzA4MU+jICI+RdHyhAhjne1odoBmOstnvy +/VV2F/nzhWjDh7Xw1VEc8w= X-Google-Smtp-Source: ABdhPJwmgxcyhVMuSBEAOnG1yWNgk2RqQZfAredAVkRWzhI2ehtZL3wrsKZcsUQ+Th1XmM4mi9wIeA== X-Received: by 2002:a65:528a:: with SMTP id y10mr15007151pgp.246.1604974985933; Mon, 09 Nov 2020 18:23:05 -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.23.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Nov 2020 18:23:05 -0800 (PST) From: Yousong Zhou To: Adrian Schmutzler , Philip Prindeville Subject: [PATCH v2 10/10] x86: upgrade: make code comment appear as log lines Date: Tue, 10 Nov 2020 10:22:23 +0800 Message-Id: <20201110022223.41175-11-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_212307_944295_AD5599DF X-CRM114-Status: GOOD ( 12.07 ) 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:442 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 This is mainly to make it clear records in/out in the following lines are for extracting boot sectors Before == upgrade: Reading partition table from bootdisk... 37+26 records in 37+26 records out == upgrade: Reading partition table from image... After == upgrade: Reading partition table from bootdisk... == upgrade: Extract boot sector from the image 37+26 records in 37+26 records out == upgrade: Reading partition table from image... Signed-off-by: Yousong Zhou --- target/linux/x86/base-files/lib/upgrade/platform.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index 0b54caea29..d8f2eba97e 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -19,7 +19,7 @@ platform_check_image() { get_partitions "/dev/$diskdev" bootdisk - #extract the boot sector from the image + v "Extract boot sector from the image" get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b get_partitions /tmp/image.bs image @@ -82,7 +82,7 @@ platform_do_upgrade() { if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then get_partitions "/dev/$diskdev" bootdisk - #extract the boot sector from the image + v "Extract boot sector from the image" get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b get_partitions /tmp/image.bs image @@ -114,7 +114,6 @@ platform_do_upgrade() { fi done < /tmp/partmap.image - #copy partition uuid v "Writing new UUID to /dev/$diskdev..." get_image_dd "$1" of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync @@ -129,5 +128,4 @@ platform_do_upgrade() { sed -i "s/\(PARTUUID=\)[a-f0-9-]\+/\1$4$3$2$1-$6$5-$8$7-$9/ig" /mnt/boot/grub/grub.cfg umount /mnt fi - }