aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-07-19 14:07:02 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-07-19 14:07:02 +0100
commitc9f4e03d25e2eb5729c9285437f404ff51781a50 (patch)
tree558ef9f8851f30f653da5592c0d921a416dc4c45 /bin
parent0f7cce6a4b91e01bac806acaf9210c7bd207549b (diff)
Fixed up configuration file search
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mauveconsole8
-rwxr-xr-xbin/mauveserver8
2 files changed, 12 insertions, 4 deletions
diff --git a/bin/mauveconsole b/bin/mauveconsole
index c9a4656..d115642 100755
--- a/bin/mauveconsole
+++ b/bin/mauveconsole
@@ -64,8 +64,12 @@ puts "#{$0}: version "+Mauve::VERSION if version
exit 0 if help or version or manual
configuration_file = ARGV.shift
-configuration_file = [".", "/etc/mauvealert/"].collect{|x| File.join("mauveserver.conf") }.find{|d| File.file?(d)} if configuration_file.nil?
-configuration_file = File.expand_path(configuration_file)
+configuration_file = [".", "/etc/mauvealert/"].collect{|x| File.join(x, "mauveserver.conf") }.find{|d| File.file?(d)} if configuration_file.nil?
+configuration_file = File.expand_path(configuration_file) unless configuration_file.nil?
+
+if configuration_file.nil?
+ error "No configuration file could be found\n"
+end
unless File.file?(configuration_file)
error "Configuration file #{configuration_file} not found\n"
diff --git a/bin/mauveserver b/bin/mauveserver
index 921e6b3..d07aabb 100755
--- a/bin/mauveserver
+++ b/bin/mauveserver
@@ -72,8 +72,12 @@ rescue SyntaxError => no_blocks_with_procs
end
configuration_file = ARGV.shift
-configuration_file = [".", "/etc/mauvealert/"].collect{|x| File.join("mauveserver.conf") }.find{|d| File.file?(d)} if configuration_file.nil?
-configuration_file = File.expand_path(configuration_file)
+configuration_file = [".", "/etc/mauvealert/"].collect{|x| File.join(x, "mauveserver.conf") }.find{|d| File.file?(d)} if configuration_file.nil?
+configuration_file = File.expand_path(configuration_file) unless configuration_file.nil?
+
+if configuration_file.nil?
+ error "No configuration file could be found\n"
+end
unless File.file?(configuration_file)
error "Configuration file #{configuration_file} not found\n"