[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNARm=SQyue3mpYjLs=RFG087_SpyM=YZuCOmeyya4ppmUw@mail.gmail.com>
Date: Wed, 7 Apr 2021 20:01:27 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Michal Marek <michal.lkml@...kovi.net>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
linux-arch <linux-arch@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 03/20] kbuild: scripts/install.sh: provide a "install" function
On Wed, Apr 7, 2021 at 2:34 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> 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 <gregkh@...uxfoundation.org>
> ---
> 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
Powered by blists - more mailing lists