]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - debian/patches/0001-e2scrub-stop-cron-spam-if-lvm2-is-not-installed.patch
Merge tag 'v1.45.2' into debian/master
[thirdparty/e2fsprogs.git] / debian / patches / 0001-e2scrub-stop-cron-spam-if-lvm2-is-not-installed.patch
CommitLineData
a25c9ad6
TT
1From 9d41a057d9643505942628c919869a7019646276 Mon Sep 17 00:00:00 2001
2From: Theodore Ts'o <tytso@mit.edu>
3Date: Thu, 16 May 2019 14:56:37 -0400
4Subject: [PATCH 1/2] e2scrub: stop cron spam if lvm2 is not installed.
5
6Addresses-Debian-Bug: #928977
7
8Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9---
10 scrub/e2scrub_all.cron.in | 2 +-
11 scrub/e2scrub_all.in | 12 ++++++++++--
12 scrub/e2scrub_all.service.in | 2 +-
13 scrub/e2scrub_all_cron.in | 2 +-
14 scrub/e2scrub_reap.service.in | 2 +-
15 5 files changed, 14 insertions(+), 6 deletions(-)
16
17diff --git a/scrub/e2scrub_all.cron.in b/scrub/e2scrub_all.cron.in
18index 7d42c3f2e..5bf83ec97 100644
19--- a/scrub/e2scrub_all.cron.in
20+++ b/scrub/e2scrub_all.cron.in
21@@ -1,2 +1,2 @@
22 30 3 * * 0 root test -e /run/systemd/system || @pkglibdir@/e2scrub_all_cron
23-10 3 * * * root test -e /run/systemd/system || @root_sbindir@/e2scrub_all -A -r
24+10 3 * * * root test -e /run/systemd/system || @root_sbindir@/e2scrub_all -C -A -r
25diff --git a/scrub/e2scrub_all.in b/scrub/e2scrub_all.in
26index 31ebc7970..7ee653158 100644
27--- a/scrub/e2scrub_all.in
28+++ b/scrub/e2scrub_all.in
29@@ -26,6 +26,7 @@ if (( $EUID != 0 )); then
30 fi
31
32 scrub_all=0
33+run_from_cron=0
34 snap_size_mb=256
35 reap=0
36 conffile="@root_sysconfdir@/e2scrub.conf"
37@@ -73,6 +74,7 @@ while getopts "nrAV" opt; do
38 "n") DBG="echo Would execute: " ;;
39 "r") scrub_args="${scrub_args} -r"; reap=1;;
40 "A") scrub_all=1;;
41+ "C") run_from_cron=1;;
42 "V") print_version; exitcode 0;;
43 *) print_help; exitcode 2;;
44 esac
45@@ -84,13 +86,19 @@ shift "$((OPTIND - 1))"
46 # when e2scrub_all is run out of cron or a systemd timer.
47
48 if ! type lsblk >& /dev/null ; then
49+ if [ "${run_from_cron}" -eq 1 ] ; then
50+ exitcode 0
51+ fi
52 echo "e2scrub_all: can't find lsblk --- is util-linux installed?"
53- exitcode 0
54+ exitcode 1
55 fi
56
57 if ! type lvcreate >& /dev/null ; then
58+ if [ "${run_from_cron}" -eq 1 ] ; then
59+ exitcode 0
60+ fi
61 echo "e2scrub_all: can't find lvcreate --- is lvm2 installed?"
62- exitcode 0
63+ exitcode 1
64 fi
65
66 # Find scrub targets, make sure we only do this once.
67diff --git a/scrub/e2scrub_all.service.in b/scrub/e2scrub_all.service.in
68index 20f42bfe3..77b6ad599 100644
69--- a/scrub/e2scrub_all.service.in
70+++ b/scrub/e2scrub_all.service.in
71@@ -8,5 +8,5 @@ Documentation=man:e2scrub_all(8)
72 [Service]
73 Type=oneshot
74 Environment=SERVICE_MODE=1
75-ExecStart=@root_sbindir@/e2scrub_all
76+ExecStart=@root_sbindir@/e2scrub_all -C
77 SyslogIdentifier=e2scrub_all
78diff --git a/scrub/e2scrub_all_cron.in b/scrub/e2scrub_all_cron.in
79index f9cff878c..bc26fee3d 100644
80--- a/scrub/e2scrub_all_cron.in
81+++ b/scrub/e2scrub_all_cron.in
82@@ -65,4 +65,4 @@ on_ac_power() {
83 test -e /run/systemd/system && exit 0
84 on_ac_power || exit 0
85
86-exec @root_sbindir@/e2scrub_all
87+exec @root_sbindir@/e2scrub_all -C
88diff --git a/scrub/e2scrub_reap.service.in b/scrub/e2scrub_reap.service.in
89index cf26437cd..40511f735 100644
90--- a/scrub/e2scrub_reap.service.in
91+++ b/scrub/e2scrub_reap.service.in
92@@ -16,7 +16,7 @@ NoNewPrivileges=yes
93 User=root
94 IOSchedulingClass=idle
95 CPUSchedulingPolicy=idle
96-ExecStart=@root_sbindir@/e2scrub_all -A -r
97+ExecStart=@root_sbindir@/e2scrub_all -C -A -r
98 SyslogIdentifier=%N
99 RemainAfterExit=no
100
101--
1022.19.1
103