diff options
author | Erick Reyes <erickreyes@google.com> | 2018-08-16 14:55:40 -0700 |
---|---|---|
committer | Erick Reyes <erickreyes@google.com> | 2018-08-16 14:55:40 -0700 |
commit | 104ab647a5f77ba15f3673a969fa4f677a2d4a4d (patch) | |
tree | 25de3ed2a3e000cea1e8bddfdef644ae83b50f02 | |
parent | 240ce0744e86a1226111fff50382b62957ea3d3e (diff) | |
download | adeb-104ab647a5f77ba15f3673a969fa4f677a2d4a4d.tar.gz |
kernel headers sanity check
Print out an error if the user is trying to use kernel headers for a
different major version
Signed-off-by: Erick Reyes <erickreyes@google.com>
-rw-r--r-- | addons/bashrc.common | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/bashrc.common b/addons/bashrc.common index f357b6f..14e09d3 100644 --- a/addons/bashrc.common +++ b/addons/bashrc.common @@ -17,6 +17,16 @@ if [ -d /kernel-headers/ ]; then if [ $this_vers -eq $h_vers ]; then override_vers=0 + else + this_major=$(($this_vers / (256 * 256))) + this_minor=$(($this_vers / 256 % 256)) + h_major=$(($h_vers / (256 * 256))) + h_minor=$(($h_vers / 256 % 256)) + if [ $this_major -ne $h_major ] || [ $this_minor -ne $h_minor ]; then + echo "Error: kernel version does not match installed headers ($this_major.$this_minor <> $h_major.$h_minor)" + echo "BCC will not work" + override_vers=0 + fi fi fi |