aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/mauveclient35
-rwxr-xr-xbin/mauveserver12
-rw-r--r--debian/control4
-rwxr-xr-xdebian/rules16
4 files changed, 38 insertions, 29 deletions
diff --git a/bin/mauveclient b/bin/mauveclient
index 12747fa..77b8506 100755
--- a/bin/mauveclient
+++ b/bin/mauveclient
@@ -158,10 +158,14 @@
#
require 'getoptlong'
-require 'mauve/sender'
-require 'mauve/proto'
-require 'mauve/mauve_time'
-require 'mauve/version'
+
+%w(sender mauve_time version proto).each do |r|
+ begin
+ require "mauve/#{r}"
+ rescue LoadError => ex
+ puts ex.to_s
+ end
+end
NOW = Mauve::MauveTime.now
@@ -205,9 +209,17 @@ def parse_time_spec(spec = "now")
end
begin
- update = Mauve::Proto::AlertUpdate.new
- update.replace = false
- update.alert = []
+ begin
+ update = Mauve::Proto::AlertUpdate.new
+ update.replace = false
+ update.alert = []
+ rescue NameError
+ #
+ # Do nothing .. When generating manpages in the build process we don't need
+ # to have Protobuf available.
+ #
+ update = nil
+ end
message = nil
verbose = 0
help = false
@@ -242,18 +254,22 @@ begin
when '-V'
version = true
when '-p'
+ error "Cannot send update -- not all libraries are available" if update.nil?
update.replace = true
when '-i'
+ error "Cannot send update -- not all libraries are available" if update.nil?
error "Cannot specify the same ID twice in one update -- ID #{arg}" if update.alert.any?{|a| a.id == arg}
message = Mauve::Proto::Alert.new
message.id = arg
update.alert << message
when '-o'
+ error "Cannot send update -- not all libraries are available" if update.nil?
error "Can only specify one source" if update.source
update.source = arg
when '-v'
verbose += 1
else
+ error "Cannot send update -- not all libraries are available" if update.nil?
error "Must specify --id before message" unless message
case opt
when '-s' then message.summary = arg
@@ -281,7 +297,7 @@ begin
break if line.empty?
if help and !found_synopsis
- found_synopsis = (line =~ /^#\s+SYNOPSIS\s*$/) if !found_synopsis
+ found_synopsis = (line =~ /^#\s+SYNOPSIS\s*$/)
next
end
@@ -296,13 +312,12 @@ begin
exit 0 if help or version or manual
+ error "Cannot send update -- not all libraries are available" if update.nil?
error "No alerts specified" unless !update.alert.empty? || update.replace
update.transmission_id = rand(2**63)
Mauve::Sender.new(ARGV).send(update, verbose)
-rescue Protobuf::NotInitializedError => bad
- error "Alert not initialized fully -- you must supply an ID"
rescue ArgumentError => ae
error ae.message
diff --git a/bin/mauveserver b/bin/mauveserver
index 24eb168..921e6b3 100755
--- a/bin/mauveserver
+++ b/bin/mauveserver
@@ -30,12 +30,6 @@ def error(msg)
exit 1
end
-begin
- eval "Proc.new { |a,&b| }"
-rescue SyntaxError => no_blocks_with_procs
- error "mauveserver must have Ruby 1.8.7 or later"
-end
-
help = ARGV.any?{|a| a =~ /-(h|-help)/}
version = ARGV.any?{|a| a =~ /-(V|-version)/}
manual = ARGV.any?{|a| a =~ /-(m|-manual)/}
@@ -71,6 +65,12 @@ puts "#{$0}: version "+Mauve::VERSION if version
exit 0 if help or version or manual
+begin
+ eval "Proc.new { |a,&b| }"
+rescue SyntaxError => no_blocks_with_procs
+ error "mauveserver must have Ruby 1.8.7 or later."
+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)
diff --git a/debian/control b/debian/control
index a78c5e7..2e777c4 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Maintainer: Matthew Bloch <matthew@bytemark.co.uk>
Uploaders: Patrick J Cherry <patrick@bytemark.co.uk>
Section: ruby
Priority: optional
-Build-Depends: ruby1.8, debhelper, cdbs, rdoc, txt2man
+Build-Depends: ruby1.8, debhelper, cdbs, rdoc, txt2man, cdbs
Standards-Version: 3.8.0
Package: mauvealert-client
@@ -24,7 +24,7 @@ Architecture: all
Pre-Depends: libjs-jquery
Depends: mauvealert-common,
adduser,
- ruby1.8,
+ ruby1.8 (>= 1.8.7),
libhaml-ruby1.8,
liblog4r-ruby1.8,
libredcloth-ruby1.8,
diff --git a/debian/rules b/debian/rules
index 061744f..99a63c4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,14 +1,8 @@
#!/usr/bin/make -f
#
-
-build:
- make all
- dh $@
-
-clean:
- make clean
- dh $@
-
-%:
- dh $@
+# Use CDBS, so we can build for etch (ugh)
+#
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/makefile.mk