btrfsmaintenance/0004-btrfsmaintenance-refresh-cron.sh-validate-periods-fo.patch
David Sterba 49700386d0 Accepting request 684484 from home:jeff_mahoney:branches:filesystems
- Document and adjust balance thresholds and periods (FATE#325529 jsc#SLE-3188).
  * README: document impact of balance + quota groups
  * sysconfig: reduce default balance usage thresholds
  * sysconfig: document using systemd.time(7) for frequency of operations
  * btrfsmaintenance-refresh-cron.sh: validate periods for cron-based systems
- Remove python dependency (FATE#326736 jsc#SLE-4130).
  * btrfs-defrag-plugin: remove dependency on zypp-plugin-python
- Added patches:
  * 0001-README-document-impact-of-balance-quota-groups.patch
  * 0002-sysconfig-reduce-default-balance-usage-thresholds-fa.patch
  * 0003-sysconfig-document-using-systemd.time-7-for-frequenc.patch
  * 0004-btrfsmaintenance-refresh-cron.sh-validate-periods-fo.patch
  * 0005-btrfs-defrag-plugin-remove-dependency-on-zypp-plugin.patch
- Added source:
  * btrfs-defrag-plugin.sh
- Removed patch:
  * python3-support-bsc1070322.diff

OBS-URL: https://build.opensuse.org/request/show/684484
OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsmaintenance?expand=0&rev=44
2019-03-18 17:09:34 +00:00

40 lines
1.2 KiB
Diff

From 7851de9a30610885f7fc2f8238128f1c4f2d3593 Mon Sep 17 00:00:00 2001
From: Jeff Mahoney <jeffm@suse.com>
Date: Fri, 25 Jan 2019 14:08:13 -0500
Subject: btrfsmaintenance-refresh-cron.sh: validate periods for cron-based systems
References: fate#325529 jsc#SLE-3188
Now that we accept systemd.time(7) calendar events, ensure that we don't
try to use them on cron-based systems. Instead of removing all existing
jobs silently, refuse to change the period and print an error.
---
btrfsmaintenance-refresh-cron.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/btrfsmaintenance-refresh-cron.sh b/btrfsmaintenance-refresh-cron.sh
index 2bf5f8e..10db054 100755
--- a/btrfsmaintenance-refresh-cron.sh
+++ b/btrfsmaintenance-refresh-cron.sh
@@ -35,6 +35,18 @@ refresh_cron() {
SCRIPT="$2"
echo "Refresh script $SCRIPT for $EXPECTED"
+ valid=false
+ for PERIOD in daily weekly monthly none uninstall; do
+ if [ "$PERIOD" = "$EXPECTED" ]; then
+ valid=true
+ fi
+ done
+
+ if ! $valid; then
+ echo "$EXPECTED is not a valid period for cron. Not changing."
+ return
+ fi
+
for PERIOD in daily weekly monthly; do
# NOTE: debian does not allow filenames with dots in /etc/cron.*
LINK="${SCRIPT%.*}"
--
2.16.4