Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp875422pxf; Wed, 7 Apr 2021 13:54:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmFv9r+r7tGQ8v6eNULO2cyIGhZ7dC3bWDFfRyjGhKAFxOzMao3wX8+kdQY+TzD0UZa3JK X-Received: by 2002:aa7:cf03:: with SMTP id a3mr6800691edy.142.1617828850813; Wed, 07 Apr 2021 13:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617828850; cv=none; d=google.com; s=arc-20160816; b=y2Epx3hdVrVjxDor8Uw2Zm8gPC+biindDPXkMwZeOMiU0g4OkFomj8bwJLSZKaHq3j HbFK2tkYaMUHOIN5ZJ08mvpEldaZe1akeBe6CH2PFJJ5MGX170Muve52/9gx8xcUNjlV ql9ywI2kkTm7KTkTwhqoIFxGOswvdT7UGiNcdheOSHDiNs3hhUKl2HqNHYPt9v+JkAI4 fNe3lI4qvTyrcJOu7dKsZcQC0dh+oU2c6wMhvpUC7QWpuV76rYHBS3i/Snj+GPHGtACF lGgRHbEM53duVZCeOj+6kjXrV6l08mWVmwbvS+o15ugKEHOJU4upukpJ/2BEQtSHdpAJ TWvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=/AJ00JPGT/P/0HrVBZa/+phO7AM3OfqEyfNeG+0qOho=; b=YPMYnXCZJgvXJkNwBuvapEuRrEwzhc0cLbAITXNGxqZI48ayi0YpmAQ99bVWq9Gg1K pOjewOmE+/SN6/lVQoH1TKyC4ytpSIUu0DZCuVD7KQz2+ZoadlGabwXPMRGUFe3DnOJ4 5QDZTYS2+mfEJdtuLA0z13lw/UODIax/boM2t8jnE0/0np9nlNIqKALU6dZDicMx5KqF MInjCzO20vLGk48dJQSf0xBeRnuGT1LbpiKbeTXy3AlMmhPW3RQyz+4fRWCn5ckuJFRK JU4DbIhIsld5TGIPF+pmywvMQ6eoidw0gKdts0b+SRScJirMeMyqUvGtTSgEi0Z011xK Tg5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=rh+Rj4Y1; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o2si19288808ejr.38.2021.04.07.13.53.47; Wed, 07 Apr 2021 13:54:10 -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=@nifty.com header.s=dec2015msa header.b=rh+Rj4Y1; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347215AbhDGLCv (ORCPT + 99 others); Wed, 7 Apr 2021 07:02:51 -0400 Received: from conssluserg-01.nifty.com ([210.131.2.80]:53568 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237959AbhDGLCu (ORCPT ); Wed, 7 Apr 2021 07:02:50 -0400 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 137B24Tv023666; Wed, 7 Apr 2021 20:02:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 137B24Tv023666 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1617793325; bh=/AJ00JPGT/P/0HrVBZa/+phO7AM3OfqEyfNeG+0qOho=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rh+Rj4Y1wZlL3vsup52LPEPJsXhPFCQI5D13W2BIUr7AzsTE3AaR8KnVMathvLBmF WNkdzE5gRwCFQ8oDzBpwXTn/r6NePjuyWWqgphgMxGEC6CNe3Tw1TyUXR654zOrN7I rarVCLoKnjLgPcNvPBq5lRSMN1vVIdoxVzUb+7+NS1TPibFY0fYBOZzAPpR4S89gCN jWoYNbF7V8V/Z18RgK3KGupEtWlVfq/cB+6ed0dxt9VEmIbKMWziNRbZD6MhuhW4Av DEY62h9xLoWbzPxxMtwFtoXGJwqLr4kYLR1oibfNd8V5krCHQADv0L+oCwr/Zqbter 5XOyuLUm8loXQ== X-Nifty-SrcIP: [209.85.214.174] Received: by mail-pl1-f174.google.com with SMTP id p10so4009719pld.0; Wed, 07 Apr 2021 04:02:05 -0700 (PDT) X-Gm-Message-State: AOAM532Vcjc16M9DfGRmwGyYBGLfxOy4mJguPzc1ukb+S2RItIJYRFBe 5vUSEFne78T1zabPdIHbz18D0h7TRqHGb0SOt5o= X-Received: by 2002:a17:90a:f68a:: with SMTP id cl10mr2726619pjb.87.1617793324371; Wed, 07 Apr 2021 04:02:04 -0700 (PDT) MIME-Version: 1.0 References: <20210407053419.449796-1-gregkh@linuxfoundation.org> <20210407053419.449796-4-gregkh@linuxfoundation.org> In-Reply-To: <20210407053419.449796-4-gregkh@linuxfoundation.org> From: Masahiro Yamada Date: Wed, 7 Apr 2021 20:01:27 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 03/20] kbuild: scripts/install.sh: provide a "install" function To: Greg Kroah-Hartman Cc: Michal Marek , Linux Kbuild mailing list , linux-arch , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 7, 2021 at 2:34 PM Greg Kroah-Hartman wrote: > > 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} You double-quoted all variables in 02/20. For consistency and safety here, install_source="${1}" or install_source="$1" so that it will work even if $1 contains spaces. > + > + 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 > -- Best Regards Masahiro Yamada