]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/logwatch/logwatch-7.5.5-enable-mdadm-sudo.patch
logwatch: mdadm status missing - Fix for Bug 12080
[people/pmueller/ipfire-2.x.git] / src / patches / logwatch / logwatch-7.5.5-enable-mdadm-sudo.patch
1 diff -Naur logwatch-7.5.5-orig/conf/services/mdadm.conf logwatch-7.5.5/conf/services/mdadm.conf
2 --- logwatch-7.5.5-orig/conf/services/mdadm.conf 2021-01-22 21:59:40.000000000 +0100
3 +++ logwatch-7.5.5/conf/services/mdadm.conf 2021-10-04 13:52:30.850057355 +0200
4 @@ -13,7 +13,7 @@
5 # Logwatch will try to find md devices in /etc/mdadm.conf or
6 # /etc/mdadm/mdadm.conf. If none of these files exist it can scan actively
7 # for md devices. Set to 'Yes' to enable active scanning:
8 -$mdadm_enable_scan = No
9 +$mdadm_enable_scan = Yes
10
11 # Logwatch will emit an error for md devices listed in /etc/mdadm.conf
12 # that are not present. If you do not want this (e.g. raid devices may come
13 diff -Naur logwatch-7.5.5-orig/scripts/services/mdadm logwatch-7.5.5/scripts/services/mdadm
14 --- logwatch-7.5.5-orig/scripts/services/mdadm 2021-01-22 21:59:40.000000000 +0100
15 +++ logwatch-7.5.5/scripts/services/mdadm 2021-10-06 11:41:14.800307603 +0200
16 @@ -35,7 +35,7 @@
17 } elsif ( -f "/etc/mdadm/mdadm.conf" ) {
18 open(MDADM,"< /etc/mdadm/mdadm.conf");
19 } elsif ($enable_scan) {
20 - open(MDADM,"mdadm --detail --scan 2>/dev/null|");
21 + open(MDADM,"sudo mdadm --detail --scan 2>/dev/null|");
22 }
23 while (<MDADM>) {
24 if (/^ARRAY/) {
25 @@ -51,7 +51,7 @@
26 next;
27 }
28
29 - open(MDADM,"mdadm --misc --detail $dev 2>&1 |");
30 + open(MDADM,"sudo mdadm --misc --detail $dev 2>&1 |");
31 while (<MDADM>) {
32 if ($_ =~ /cannot open .*: No such file or directory/) {
33 print $_ unless $ignore_missing;
34 @@ -74,7 +74,11 @@
35
36 if ($Detail <= 4) {
37 if (lc($mdhash{'state'}) =~ /clean|active/) {
38 - print "$dev : $mdhash{'state'}\n" if $Detail;
39 + if (lc($mdhash{'state'}) =~ /degraded/) {
40 + print "$dev : $mdhash{'state'}\n";
41 + } else {
42 + print "$dev : $mdhash{'state'}\n" if $Detail;
43 + }
44 } else {
45 print "$dev : $mdhash{'state'}\n";
46 if (defined($mdhash{'middle devices'})) {