Skip to content

Commit

Permalink
build system: properly parse "uname -r" output
Browse files Browse the repository at this point in the history
Also handle "MAJOR.MINOR-SUB" types of strings

(cherry picked from commit 999364e)
  • Loading branch information
liviuchircu committed May 11, 2015
1 parent 9c066e6 commit f894ed0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile.defs
Expand Up @@ -130,7 +130,7 @@ OSREL = $(shell uname -r)
# numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C)
OSREL_N= $(shell echo $(OSREL) | sed -e 's/^[^0-9]*//' \
-e 's/^\([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*$$/\1/g' | \
(IFS=. read A B C D; R=0; \
(IFS=. read A B C D; [ -z "$$B" ] && B=0; [ -z "$$C" ] && C=0; R=0; \
[ -n "$$A" ] && R=`expr $$R \* 1000 + $$A` && \
[ -n "$$B" ] && R=`expr $$R \* 1000 + $$B` && \
[ -n "$$C" ] && R=`expr $$R \* 1000 + $$C`; echo $$R ) )
Expand Down

0 comments on commit f894ed0

Please sign in to comment.