summaryrefslogtreecommitdiffstats
path: root/main.cxx
diff options
context:
space:
mode:
authorKent Sebastian <ksebasti@redhat.com>2009-04-17 16:20:09 -0400
committerKent Sebastian <ksebasti@redhat.com>2009-04-17 16:20:09 -0400
commit755cdd9b9c502b54324a3c56d8fda7fc1ad1fa88 (patch)
tree058f146733e14e24454acfd21107cb645ee629cd /main.cxx
parent9831040e54178a1b6eb4637213bb3c81f6ed254b (diff)
downloadsystemtap-steved-755cdd9b9c502b54324a3c56d8fda7fc1ad1fa88.tar.gz
systemtap-steved-755cdd9b9c502b54324a3c56d8fda7fc1ad1fa88.tar.xz
systemtap-steved-755cdd9b9c502b54324a3c56d8fda7fc1ad1fa88.zip
PR10082: add environment variable to pass -r RELEASE/PATH option
Diffstat (limited to 'main.cxx')
-rw-r--r--main.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/main.cxx b/main.cxx
index 794a5891..37c5b135 100644
--- a/main.cxx
+++ b/main.cxx
@@ -425,6 +425,36 @@ main (int argc, char * const argv [])
if (s_tc != NULL)
s.tapset_compile_coverage = true;
+ const char* s_kr = getenv ("SYSTEMTAP_RELEASE");
+ if (s_kr != NULL) {
+ if (s_kr[0] == '/') // fully specified path
+ {
+ s.kernel_build_tree = s_kr;
+ string version_file_name = s.kernel_build_tree + "/include/config/kernel.release";
+ // The file include/config/kernel.release within the
+ // build tree is used to pull out the version information
+ ifstream version_file (version_file_name.c_str());
+ if (version_file.fail ())
+ {
+ cerr << "Missing " << version_file_name << endl;
+ exit(1);
+ }
+ else
+ {
+ char c;
+ s.kernel_release = "";
+ while (version_file.get(c) && c != '\n')
+ s.kernel_release.push_back(c);
+ }
+ }
+ else
+ {
+ s.kernel_release = string (s_kr);
+ s.kernel_build_tree = "/lib/modules/" + s.kernel_release + "/build";
+ }
+ }
+
+
while (true)
{
int long_opt;