aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichał Górny <gentoo@mgorny.alt.pl>2010-07-18 04:26:40 -0400
committerMichal Marek <mmarek@suse.cz>2010-07-20 09:43:27 -0400
commit6dc0c2f3384fe543a805922c6a314c7ad25a92fc (patch)
tree994c4aa6435230b829c6cc41fd771eff7ddd9e54 /scripts
parent1c5474a65bf15a4cb162dfff86d6d0b5a08a740c (diff)
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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/setlocalversion7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index d6a866ed183..a7b9f7607e1 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -30,11 +30,12 @@ fi
30 30
31scm_version() 31scm_version()
32{ 32{
33 local short=false 33 local short
34 short=false
34 35
35 cd "$srctree" 36 cd "$srctree"
36 if test -e .scmversion; then 37 if test -e .scmversion; then
37 cat "$_" 38 cat .scmversion
38 return 39 return
39 fi 40 fi
40 if test "$1" = "--short"; then 41 if test "$1" = "--short"; then
@@ -136,7 +137,7 @@ if $scm_only; then
136fi 137fi
137 138
138if test -e include/config/auto.conf; then 139if test -e include/config/auto.conf; then
139 source "$_" 140 . include/config/auto.conf
140else 141else
141 echo "Error: kernelrelease not valid - run 'make prepare' to update it" 142 echo "Error: kernelrelease not valid - run 'make prepare' to update it"
142 exit 1 143 exit 1