Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp802840pxf; Wed, 7 Apr 2021 11:57:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx92Yrx77zDqu6T+xvQhUB/Z8mFh5zQ9B0lM06SWWqdYzxf1H1jpLuGJNpw6lRYYBKyOrok X-Received: by 2002:a6b:6e06:: with SMTP id d6mr3640339ioh.116.1617821844018; Wed, 07 Apr 2021 11:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617821844; cv=none; d=google.com; s=arc-20160816; b=hGQ6Yi7zvNsAE7LjO7VvZ6O2P6/TPobS/BX6f5VBwydwxU78glXQOJL0gO1NhTrqEv UsGXInti0BnnKOgUG2BlCy8d5CaiIyTEUwkL0KlrVKimJrmmBJSC4tSIsAg5xA9Z4rqR oEa+bDWNqL8Def7DbcdVAkbmQ71VxV+W3tpnRN+TI6zpCaQyxDNGWnzSmdA+7XtpjFDJ 5s2zIVTw8PgaxWwFsgp43ioEaxswUZ0lLjNdaLbVHHegQRF7eenxAfAWnRtUIoD2NfDH qABDjXFd+Yyx5Tlda71fIeqDlFamZFiPJ5lkowBtK5wfEldegLkWi/mJQ3kepmAVHnfx gYcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+ONuTE0Un36fRcV0+eiJ9j+0Aa3qNfFcVMUo+U0xz9o=; b=XWX4v0R5A6Sl7LuzIBhcwWymUgH0Zp5LdUdIc+pDdLuTX/SDUuN3+Mebl/jXY7Xpsg cfzr0JfUJNLTnDtKzF/o5h0VyBImEyc2k6dmpYAYR8DIhVbMq31v40Bw5jQC15UX8vX2 4qbQr+CkE4OlNGS7ywkMyPDNAOsRLesqVRCQ49ZlkhIeCvKEWoxSM7ECfVEyUV7NaxUj 6ZttRFdWUN592KvE/Y/Zt65TL4EaBO4g/irFKByDPOsdaBnTRIRDwt9XRlC8kqDlxAoa 3bQ1/bZoXic586ZO/I6J1hf0p9llZUVkSKs/CpNP44vt8xDGdiiXUp3WVtfhYmFGOFre P3/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zDJNB2hi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q62si23012286jaa.15.2021.04.07.11.57.12; Wed, 07 Apr 2021 11:57:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zDJNB2hi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240294AbhDGFe5 (ORCPT + 99 others); Wed, 7 Apr 2021 01:34:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:38248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345230AbhDGFe4 (ORCPT ); Wed, 7 Apr 2021 01:34:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 65CCF61168; Wed, 7 Apr 2021 05:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617773686; bh=Ap6X9FPkMU0Lq3Uh/N+daHn0QRFCYA0Bh3YUBOeqXvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zDJNB2hiQMshLeFAIxxzwHkK7jXwMfsDHFZal5KRlsyjLWRbVPgxrPVfVpGcEyHHC icS/c2eIoytAOA41UJtHXRMT7QCrr/3sLMnhpt6qUybW8phqpYRBQ+/NcSXZeMWFUx MFNF4XttedJPsMkupgscXzDdzV9qorRUdDnr5dCw= From: Greg Kroah-Hartman To: Masahiro Yamada , Michal Marek Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH 03/20] kbuild: scripts/install.sh: provide a "install" function Date: Wed, 7 Apr 2021 07:34:02 +0200 Message-Id: <20210407053419.449796-4-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210407053419.449796-1-gregkh@linuxfoundation.org> References: <20210407053419.449796-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of open-coding the "test for file, if present make a backup, then copy the file to the new location" in multiple places, make a single function, install(), to do all of this in one place. Note, this does change the default x86 kernel map file saved name from "System.old" to "System.map.old". This brings it into unification with the other architectures as to what they call their backup file for the kernel map file. As this is a text file, and nothing parses this from a backup file, there should not be any operational differences. Signed-off-by: Greg Kroah-Hartman --- scripts/install.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index c183d6ddd00c..af36c0a82f01 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -27,6 +27,19 @@ verify () { fi } +install () { + install_source=${1} + install_target=${2} + + echo "installing '${install_source}' to '${install_target}'" + + # if the target is already present, move it to a .old filename + if [ -f "${install_target}" ]; then + mv "${install_target}" "${install_target}".old + fi + cat "${install_source}" > "${install_target}" +} + # Make sure the files actually exist verify "$2" verify "$3" @@ -37,17 +50,8 @@ if [ -x ~/bin/"${INSTALLKERNEL}" ]; then exec ~/bin/"${INSTALLKERNEL}" "$@"; fi if [ -x /sbin/"${INSTALLKERNEL}" ]; then exec /sbin/"${INSTALLKERNEL}" "$@"; fi # Default install - same as make zlilo - -if [ -f "$4"/vmlinuz ]; then - mv "$4"/vmlinuz "$4"/vmlinuz.old -fi - -if [ -f "$4"/System.map ]; then - mv "$4"/System.map "$4"/System.old -fi - -cat "$2" > "$4"/vmlinuz -cp "$3" "$4"/System.map +install "$2" "$4"/vmlinuz +install "$3" "$4"/System.map if [ -x /sbin/lilo ]; then /sbin/lilo -- 2.31.1