summaryrefslogtreecommitdiff
path: root/bin/locmaint
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-06-19 22:00:40 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-06-20 17:49:52 -0700
commit6a2060d3013d0fe1f5042517bf0e9d4a382648a1 (patch)
tree5793805c93e4a820654c0adbe66aff64df23c4b0 /bin/locmaint
parent188dce8c09ff9d49b2dec8001c831ea98947a5b1 (diff)
downloaddotfiles-6a2060d3013d0fe1f5042517bf0e9d4a382648a1.tar.gz
locmaint: mailq: add support for nullmailer
Diffstat (limited to 'bin/locmaint')
-rwxr-xr-xbin/locmaint35
1 files changed, 19 insertions, 16 deletions
diff --git a/bin/locmaint b/bin/locmaint
index f6bf2c56..668440a8 100755
--- a/bin/locmaint
+++ b/bin/locmaint
@@ -574,22 +574,25 @@ sub do_sysmaint {
);
my $mailq = executable_find "mailq";
- if (-x $mailq) {
- chomp(my $owner = `dpkg-query -S $mailq`);
- $owner =~ s/: $mailq\z//;
- # this check is only for systems running postfix
- interactive_ensure_subroutine(
- sub { system_pty_capture("mailq") },
- sub {
- my $result = shift;
- chomp($result->{output});
- if ($result->{output} =~ /Mail queue is empty/) {
- return 1;
- } else {
- say_bold("uh oh, expected an empty mail queue");
- return 0;
- }
- }) if $owner eq 'postfix';
+ if (-x $mailq and -x executable_find "dpkg-query") {
+ `dpkg-query -S $mailq` =~ /: $mailq/;
+ if ($` eq "postfix") {
+ interactive_ensure_subroutine(
+ sub { system_pty_capture("mailq") },
+ sub {
+ my $result = shift;
+ chomp($result->{output});
+ if ($result->{output} =~ /Mail queue is empty/) {
+ return 1;
+ } else {
+ say_bold("uh oh, expected an empty mail queue");
+ return 0;
+ }
+ });
+ } elsif ($` eq "nullmailer") {
+ interactive_ensure_subroutine_no_output(
+ sub { system_pty_capture("mailq") });
+ }
}
my %obsolete_conffiles;