Message ID | 20210407053419.449796-8-gregkh@linuxfoundation.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kbuild: unify the install.sh script usage | expand |
On Wed, Apr 7, 2021 at 2:35 PM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > Some architectures put the version number by default at the end of the > files that are copied, so add support for this to be set by arch type. > > Odds are one day we should change this for x86, but let's not break > anyone's systems just yet. > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > --- > scripts/install.sh | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/scripts/install.sh b/scripts/install.sh > index 72dc4c81013e..934619f81119 100644 > --- a/scripts/install.sh > +++ b/scripts/install.sh > @@ -60,8 +60,19 @@ else > base=vmlinux > fi > > -install "$2" "$4"/"$base" > -install "$3" "$4"/System.map > +# Some architectures name their files based on version number, and > +# others do not. Call out the ones that do not to make it obvious. > +case "${ARCH}" in > + x86) > + version="" > + ;; > + *) > + version="-${1}" > + ;; > +esac > + > +install "$2" "$4"/"$base""$version" Too many quotes are eye sore. install "$2" "$4/$base$version" looks cleaner in my opinion. Shell correctly understands the end of each variable because a slash or a dollar cannot be a part of a variable name. > +install "$3" "$4"/System.map"$version" > sync > > # Some architectures like to call specific bootloader "helper" programs: > -- > 2.31.1 > -- Best Regards Masahiro Yamada
On Wed, Apr 07, 2021 at 08:05:23PM +0900, Masahiro Yamada wrote: > On Wed, Apr 7, 2021 at 2:35 PM Greg Kroah-Hartman > <gregkh@linuxfoundation.org> wrote: > > > > Some architectures put the version number by default at the end of the > > files that are copied, so add support for this to be set by arch type. > > > > Odds are one day we should change this for x86, but let's not break > > anyone's systems just yet. > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > --- > > scripts/install.sh | 15 +++++++++++++-- > > 1 file changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/scripts/install.sh b/scripts/install.sh > > index 72dc4c81013e..934619f81119 100644 > > --- a/scripts/install.sh > > +++ b/scripts/install.sh > > @@ -60,8 +60,19 @@ else > > base=vmlinux > > fi > > > > -install "$2" "$4"/"$base" > > -install "$3" "$4"/System.map > > +# Some architectures name their files based on version number, and > > +# others do not. Call out the ones that do not to make it obvious. > > +case "${ARCH}" in > > + x86) > > + version="" > > + ;; > > + *) > > + version="-${1}" > > + ;; > > +esac > > + > > +install "$2" "$4"/"$base""$version" > > > Too many quotes are eye sore. > > > install "$2" "$4/$base$version" > > looks cleaner in my opinion. > > Shell correctly understands the end of each > variable because a slash or a dollar > cannot be a part of a variable name. Good idea, I usually just default to "quote everything!" when dealing with bash variables. I'll fix this up. Oh, any preference for "$2" vs. "${2}"? I don't care either way but I couldn't tell what is the normal kernel style these days. thanks for all of the review, much appreciated! greg k-h
On Wed, Apr 7, 2021 at 10:04 PM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > On Wed, Apr 07, 2021 at 08:05:23PM +0900, Masahiro Yamada wrote: > > On Wed, Apr 7, 2021 at 2:35 PM Greg Kroah-Hartman > > <gregkh@linuxfoundation.org> wrote: > > > > > > Some architectures put the version number by default at the end of the > > > files that are copied, so add support for this to be set by arch type. > > > > > > Odds are one day we should change this for x86, but let's not break > > > anyone's systems just yet. > > > > > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > > --- > > > scripts/install.sh | 15 +++++++++++++-- > > > 1 file changed, 13 insertions(+), 2 deletions(-) > > > > > > diff --git a/scripts/install.sh b/scripts/install.sh > > > index 72dc4c81013e..934619f81119 100644 > > > --- a/scripts/install.sh > > > +++ b/scripts/install.sh > > > @@ -60,8 +60,19 @@ else > > > base=vmlinux > > > fi > > > > > > -install "$2" "$4"/"$base" > > > -install "$3" "$4"/System.map > > > +# Some architectures name their files based on version number, and > > > +# others do not. Call out the ones that do not to make it obvious. > > > +case "${ARCH}" in > > > + x86) > > > + version="" > > > + ;; > > > + *) > > > + version="-${1}" > > > + ;; > > > +esac > > > + > > > +install "$2" "$4"/"$base""$version" > > > > > > Too many quotes are eye sore. > > > > > > install "$2" "$4/$base$version" > > > > looks cleaner in my opinion. > > > > Shell correctly understands the end of each > > variable because a slash or a dollar > > cannot be a part of a variable name. > > Good idea, I usually just default to "quote everything!" when dealing > with bash variables. I'll fix this up. > > Oh, any preference for "$2" vs. "${2}"? I don't care either way but I > couldn't tell what is the normal kernel style these days. I do not see a well-defined coding style guideline for shell scripts. If you want to know my personal preference, I use "$2" without braces. Thanks. > > thanks for all of the review, much appreciated! My pleasure. > > greg k-h
diff --git a/scripts/install.sh b/scripts/install.sh index 72dc4c81013e..934619f81119 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -60,8 +60,19 @@ else base=vmlinux fi -install "$2" "$4"/"$base" -install "$3" "$4"/System.map +# Some architectures name their files based on version number, and +# others do not. Call out the ones that do not to make it obvious. +case "${ARCH}" in + x86) + version="" + ;; + *) + version="-${1}" + ;; +esac + +install "$2" "$4"/"$base""$version" +install "$3" "$4"/System.map"$version" sync # Some architectures like to call specific bootloader "helper" programs:
Some architectures put the version number by default at the end of the files that are copied, so add support for this to be set by arch type. Odds are one day we should change this for x86, but let's not break anyone's systems just yet. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- scripts/install.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)