summaryrefslogtreecommitdiff
path: root/debian/echolot.config
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-08-11 18:46:21 +0000
committerPeter Palfrader <peter@palfrader.org>2002-08-11 18:46:21 +0000
commite3806b2546f03be8c8b1827e375a6e349045c1c9 (patch)
treed26dbdffcd59eff0c22e2e636286262a7aa4643d /debian/echolot.config
parent0177fd75ae790bb049be879cfb6bb5dc8bc0c0d3 (diff)
Initial import
Diffstat (limited to 'debian/echolot.config')
-rwxr-xr-xdebian/echolot.config93
1 files changed, 93 insertions, 0 deletions
diff --git a/debian/echolot.config b/debian/echolot.config
new file mode 100755
index 0000000..e2d8938
--- /dev/null
+++ b/debian/echolot.config
@@ -0,0 +1,93 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Debconf::Client::ConfModule;
+use English;
+
+my $address;
+my $operator;
+my $sitename;
+
+if ( -e '/etc/echolot/pingd.conf' ) {
+ my $CONFIG;
+ {
+ local $/ = undef;
+ open(CONFIGCODE, '/etc/echolot/pingd.conf') or
+ die ("Cannot open /etc/echolot/pingd.conf: $!");
+ my $config_code = <CONFIGCODE>;
+ close (CONFIGCODE);
+ ($config_code) = $config_code =~ /^(.*)$/s;
+ eval ($config_code);
+ ($EVAL_ERROR) and
+ die("Evaling config code from /etc/echolot/pingd.conf returned error: $EVAL_ERROR");
+ }
+
+ $sitename = $CONFIG->{'my_localpart'}.'@'.$CONFIG->{'my_domain'} if (defined $CONFIG->{'my_localpart'} && defined $CONFIG->{'my_domain'});
+ $operator = $CONFIG->{'operator_address'} if (defined $CONFIG->{'operator_address'});
+ $sitename = $CONFIG->{'sitename'} if (defined $CONFIG->{'sitename'});
+};
+
+my $mailname;
+$mailname = `cat /etc/mailname` if ( -e '/etc/mailname' );
+$mailname = `hostname` unless ( defined $mailname );
+$mailname = 'example.org' unless ( defined $mailname );
+chomp $mailname;
+
+$address = 'echolot@'.$mailname unless defined $address;
+$operator = 'abuse@'.$mailname unless defined $operator;
+$sitename = $mailname unless defined $sitename;
+
+Debconf::Client::ConfModule::set('echolot/address', $address);
+Debconf::Client::ConfModule::set('echolot/operator', $operator);
+Debconf::Client::ConfModule::set('echolot/sitename', $sitename);
+
+
+my $state = 1;
+my $numerr = 0;
+
+Debconf::Client::ConfModule::version('2.0');
+Debconf::Client::ConfModule::capb('backup');
+while (1) {
+ if ($state == 0) {
+ $state = 1;
+ } elsif ($state == 1) {
+ Debconf::Client::ConfModule::input('high', 'echolot/address');
+ my @return = Debconf::Client::ConfModule::go();
+
+ $address = Debconf::Client::ConfModule::get('echolot/address');
+ unless ($address =~ /@/) {
+ $address .= '@'.$mailname;
+ Debconf::Client::ConfModule::set('echolot/address', $address);
+ $numerr++;
+ next if ($numerr <= 5);
+ };
+
+ if ($return[0] == 30) {
+ $numerr = 0;
+ $state--;
+ } else {
+ $numerr = 0;
+ $state++;
+ };
+ next;
+ } elsif ($state == 2) {
+ Debconf::Client::ConfModule::input('high', 'echolot/operator');
+ Debconf::Client::ConfModule::input('high', 'echolot/sitename');
+ Debconf::Client::ConfModule::input('medium', 'echolot/addnow');
+ } elsif ($state == 3) {
+ last;
+ } else {
+ die ("Unknown state $state");
+ };
+
+ my @return = Debconf::Client::ConfModule::go();
+ if ($return[0] == 30) {
+ $state--;
+ } else {
+ $state++;
+ };
+};
+
+# vim:set ts=4:
+# vim:set shiftwidth=4: