kbuild: Make the setlocalversion script POSIX-compliant
The 'source' builtin is a bash alias to the '.' (dot) builtin. While the former is supported only by bash, the latter is specified in POSIX and works fine with all POSIX-compliant shells I am aware of. The '$_' special parameter is specific to bash. It is partially supported in dash too but it always evaluates to the current script path (which causes the script to enter a loop recursively re-executing itself). This is why I have replaced the two occurences of '$_' with the explicit parameter. The 'local' builtin is another example of bash-specific code. Although it is supported by all POSIX-compliant shells I am aware of, it is not part of POSIX specification and thus the code should not rely on it assigning a specific value to the local variable. Moreover, the 'posh' shell has a limited version of 'local' builtin not supporting direct variable assignments. Thus, I have broken one of the 'local' declarations down into a (non-POSIX) 'local' declaration and a plain (POSIX-compliant) variable assignment. Signed-off-by: Michał Górny <gentoo@mgorny.alt.pl> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
Родитель
1c5474a65b
Коммит
6dc0c2f338
|
@ -30,11 +30,12 @@ fi
|
||||||
|
|
||||||
scm_version()
|
scm_version()
|
||||||
{
|
{
|
||||||
local short=false
|
local short
|
||||||
|
short=false
|
||||||
|
|
||||||
cd "$srctree"
|
cd "$srctree"
|
||||||
if test -e .scmversion; then
|
if test -e .scmversion; then
|
||||||
cat "$_"
|
cat .scmversion
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if test "$1" = "--short"; then
|
if test "$1" = "--short"; then
|
||||||
|
@ -136,7 +137,7 @@ if $scm_only; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -e include/config/auto.conf; then
|
if test -e include/config/auto.conf; then
|
||||||
source "$_"
|
. include/config/auto.conf
|
||||||
else
|
else
|
||||||
echo "Error: kernelrelease not valid - run 'make prepare' to update it"
|
echo "Error: kernelrelease not valid - run 'make prepare' to update it"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Загрузка…
Ссылка в новой задаче