hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/scripts/setlocalversion
....@@ -62,8 +62,7 @@
6262 fi
6363
6464 # Check for git and a git repo.
65
- if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
66
- head=$(git rev-parse --verify HEAD 2>/dev/null); then
65
+ if head=$(git rev-parse --verify HEAD 2>/dev/null); then
6766
6867 if [ -n "$android_release" ] && [ -n "$kmi_generation" ]; then
6968 printf '%s' "-$android_release-$kmi_generation"
....@@ -73,7 +72,7 @@
7372
7473 # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
7574 # it, because this version is defined in the top level Makefile.
76
- if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
75
+ if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then
7776
7877 # If only the short version is requested, don't bother
7978 # running further git commands
....@@ -105,7 +104,7 @@
105104
106105 # Is this git on svn?
107106 if git config --get svn-remote.svn.url >/dev/null; then
108
- printf -- '-svn%s' "`git svn find-rev $head`"
107
+ printf -- '-svn%s' "$(git svn find-rev $head)"
109108 fi
110109
111110 # Check for uncommitted changes.
....@@ -126,15 +125,15 @@
126125 fi
127126
128127 # Check for mercurial and a mercurial repo.
129
- if test -d .hg && hgid=`hg id 2>/dev/null`; then
128
+ if hgid=$(hg id 2>/dev/null); then
130129 # Do we have an tagged version? If so, latesttagdistance == 1
131
- if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
132
- id=`hg log -r . --template '{latesttag}'`
130
+ if [ "$(hg log -r . --template '{latesttagdistance}')" = "1" ]; then
131
+ id=$(hg log -r . --template '{latesttag}')
133132 printf '%s%s' -hg "$id"
134133 else
135
- tag=`printf '%s' "$hgid" | cut -d' ' -f2`
134
+ tag=$(printf '%s' "$hgid" | cut -d' ' -f2)
136135 if [ -z "$tag" -o "$tag" = tip ]; then
137
- id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
136
+ id=$(printf '%s' "$hgid" | sed 's/[+ ].*//')
138137 printf '%s%s' -hg "$id"
139138 fi
140139 fi
....@@ -150,8 +149,8 @@
150149 fi
151150
152151 # Check for svn and a svn repo.
153
- if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
154
- rev=`echo $rev | awk '{print $NF}'`
152
+ if rev=$(LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
153
+ rev=$(echo $rev | awk '{print $NF}')
155154 printf -- '-svn%s' "$rev"
156155
157156 # All done with svn
....@@ -161,7 +160,7 @@
161160
162161 collect_files()
163162 {
164
- local file res
163
+ local file res=
165164
166165 for file; do
167166 case "$file" in