From eab1857ec12a6e98214945d3e206bfc99e502fb6154b46f8ac06de837ddfef24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 3 May 2024 11:25:05 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main btrfsmaintenance revision 421a033cc98133680ec07d8b518e1864 --- .gitattributes | 23 +++ btrfs-defrag-plugin.sh | Bin 0 -> 3795 bytes btrfsmaintenance-0.5.tar.bz2 | 3 + btrfsmaintenance.changes | 264 +++++++++++++++++++++++++++++++++++ btrfsmaintenance.spec | 122 ++++++++++++++++ 5 files changed, 412 insertions(+) create mode 100644 .gitattributes create mode 100644 btrfs-defrag-plugin.sh create mode 100644 btrfsmaintenance-0.5.tar.bz2 create mode 100644 btrfsmaintenance.changes create mode 100644 btrfsmaintenance.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/btrfs-defrag-plugin.sh b/btrfs-defrag-plugin.sh new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..0c7f20ede7d02559fa1e1464e37a192bd37fc6c7f4fa2721cbf6919e0b92d30b GIT binary patch literal 3795 zcmb_f+j84B5bbOD6L$1w3aiDGEHyefk==Y-FE<+A8S*~r!!>br&tRZByn zu(GG2%Y~Ik?#^XFwvzsMW2|flHdeMT%pvu|)(&O5X+)b7EYI#lKdaSh2D67`q-6u} zo=c;8nUj2P;gyW~Rg%^8=_gm}i$hus{2pvKVnbOa+ETJH_T5V})E4(U+2*P(VN3gy zZ3@CFJkcT4UP>~Z$lx^E+oNx*jdyZ_i>b4?*1fTG|8^yimy|HGGP1uzpfI_c%j}iN z-icD0UfqNTFeYaqs{7Wt697d$l-)N}2vn&@I0%#AzXy=ItvAk)$KK#G zoQk558495rNuBN)LoMXzg^B3%iGtN-_Ort zbZHz#H?OWPE^p3~CpV&Q0gXs17&E>1*;>8tiBu_ARvK0U~PLAUP zT+eDL+M#=LK)*$(4WTV8r7g~F)8(pLFFFcV zY5w+diAT;7LTuh)SUWa1!?T$i+0;*c>N()(t@}HOqFR?@Q25NirX8wZXi6<5Q(8z` z2Bf>Bt#7><2#t&PPh5!!QG+w^pt)`p8ga&C}dW_SIbyE{jtTr z_s7T1K}i3>kfNq&yvsli>e?Wtn1>| zopVX>+*KvP%PyYd2QTnToE%4R9!Rec7>E3jye}$rUF)?u@tN@j{&Sb$)febtZ2q0e z^c?N$%}rJ$+HwqZG`SOp8L~{uT;|iALb)5^KO{BuEpc*OJl7Mqz9&Y2nW&i=Nq3GB zPMiUrW(?{I#4~>H(U`qachi%i9!y0%RgNLRR)y{*l^RvzndX6PF|Ht_=~7UL?HF4D z#O5`x-vzs?Lz9A0dPix2@!)Qalbykh@zoFQ)UCJocz?|MpE_b&?3Y04aJM13hGWBhMydRT{;}Pr&Ut9*(QYgJ=e~&-x=jmV!CBpaReS+qK3$_;cWr6h1N8x#k!C~pln5pH{To)y#WJzjbW{k zXsH?u&$`6CjQYY5KM!ic=2-2~7HF2EXk7tHrstgbYyX3NuITcbq5ZX0l#&cEkp9XgCb)QOL;&8MY!1P*90bjI$q-@F@sJ264r3 zhleq`$N3&ZKcHvN+>@Q?4%`DCmmoc;xzoz~yuS(&E*MM;PN4Z0vUTQA}eVW460B zdvvc@NYK6RT;5j)MCBzcXd-^`giT{tJ9lW_zqd>B+hh|E{Qpx87wjH=1Ipl;3R?&K ztmQr!+5NZ!6H=pd-;Dvwe<>Z>X}g&GHG_YtoC&vAAfB*mh literal 0 HcmV?d00001 diff --git a/btrfsmaintenance-0.5.tar.bz2 b/btrfsmaintenance-0.5.tar.bz2 new file mode 100644 index 0000000..07b5835 --- /dev/null +++ b/btrfsmaintenance-0.5.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37188a4749a969edf539c65c8306e409946ebbe180ae6a62ae47404206ae5475 +size 20990 diff --git a/btrfsmaintenance.changes b/btrfsmaintenance.changes new file mode 100644 index 0000000..b86b9d2 --- /dev/null +++ b/btrfsmaintenance.changes @@ -0,0 +1,264 @@ +------------------------------------------------------------------- +Wed Feb 10 12:49:06 UTC 2021 - Thorsten Kukuk + +- Require libzypp plugin only if zypper is used (Required for e.g. + image based systems). + +------------------------------------------------------------------- +Wed Aug 19 09:01:02 UTC 2020 - Callum Farmer + +- Fixes for %_libexecdir changing to /usr/libexec (bsc#1174075) + +------------------------------------------------------------------- +Thu Jul 30 00:00:00 CEST 2020 - dsterba@suse.cz + +- update to version 0.5 + - sysconfig: + - change defaults of MUSAGE and DUSAGE for balance task to do less work, + with a script to switch from existing unmodified defaults to new ones + - document systemd.timer syntax + - make balance, scrub, and trim mutually exclusive tasks + - service file updates: + - delete Install section + - defrag-plugin: + - switch to python3 + - add alternative shell implementation of the plugin + - installation docs update +- Removed patches (upstream): + - 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 + +------------------------------------------------------------------- +Tue Jun 11 16:34:56 CEST 2019 - dsterba@suse.cz + +- spec: fix typo in macro name + +------------------------------------------------------------------- +Tue Jun 11 12:34:37 UTC 2019 - Dominique Leuenberger + +- BuildRequire pkgconfig(systemd) instead of systemd: allow OBS to + shortcut the build queues by allowing usage of systemd-mini + +------------------------------------------------------------------- +Tue Mar 12 20:37:45 UTC 2019 - jeffm@suse.com + +- 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 + +------------------------------------------------------------------- +Tue Sep 25 00:00:00 CEST 2018 - dsterba@suse.cz + +- update to version 0.4.2 + - CVE-2018-14722: expand auto mountpoints in a safe way + - btrfs-defrag: fix missing function to detect btrfs filesystems (#52) + - btrfs-trim: more verbose fstrim output (#60) + - dist-install: print information about timer unit installation (#58) + +------------------------------------------------------------------- +Fri Apr 13 13:48:40 UTC 2018 - lpechacek@suse.com + +- In openSUSE the defrag plugin must explicitly refer to Python 3. + (bsc#1070322) +- Added patch: python3-support-bsc1070322.diff + +------------------------------------------------------------------- +Thu Mar 15 00:00:00 CET 2018 - dsterba@suse.cz + +- update to version 0.4.1 + - defrag plugin: python2 and 3 compatibility + - defrag plugin: target extent size lowered to 32MiB (#43) + - shell compatibility fixes + - systemd unit type fixes +- Removed patch: python3-support-bsc1070322.diff (upstream) + +------------------------------------------------------------------- +Mon Mar 12 13:39:23 CET 2018 - kukuk@suse.de + +- Add missing btrfsmaintenance-refresh.path [bsc#1084871] +- Use %license [bsc#1082318] + +------------------------------------------------------------------- +Mon Feb 5 15:13:00 UTC 2018 - lpechacek@suse.com + +- Move the defrag plugin over to Python 3. (bsc#1070322) +- Added patch: python3-support-bsc1070322.diff + +------------------------------------------------------------------- +Mon Jan 15 00:00:00 CET 2018 - dsterba@suse.cz + +- update to version 0.4 + - add support for systemd timers and use them by default; the alternative + cron scripts are still present (#29, #36) + - add automatic monitoring (via systemd.path) of the config file, + no manual updates by btrfsmaintenance-refresh.service needed (#38) + - fix RPM database path detection + - spec file cleanups + - documentation updates +- removed patches: + - btrfsmaintenance-0.3.1-fix-rpm-db-path.patch (upstream) + - btrfsmaintenance-switch-to-timer.patch (upstream) + - pull-request-36.patch (upstream) + +------------------------------------------------------------------- +Fri Dec 22 18:42:10 UTC 2017 - antoine.belvire@opensuse.org + +- Fix systemd timers enabled even if period is set to none: + * Micro change in pull-request-36.patch (bsc#1075884) +- Clean spec file: + * Removed support for suse_version <= 1210. + * Removed call to btrfsmaintenance-refresh-cron.sh upon deletion + (not needed anymore since we use systemd timers which are + handled by macros). + * Ran spec-cleaner. + +------------------------------------------------------------------- +Sun Dec 17 12:18:45 CET 2017 - kukuk@suse.de + +- Switch default of btrfsmaintenance-refresh.service to systemd-timer, + too (btrfsmaintenance-switch-to-timer.patch) [bsc#1073204] + +------------------------------------------------------------------- +Wed Dec 6 15:55:53 CET 2017 - kukuk@suse.de + +- pull-request-36.patch: update patch + +------------------------------------------------------------------- +Wed Dec 6 13:39:46 CET 2017 - kukuk@suse.de + +- Don't call btrfsmaintenance-refresh-cron.sh in %post, this is + done already by the systemd macros + +------------------------------------------------------------------- +Tue Dec 5 18:53:08 UTC 2017 - kukuk@suse.com + +- Add patch to use systemd timer instead of cron (pull-request-36.patch) + +------------------------------------------------------------------- +Thu Nov 23 13:44:40 UTC 2017 - rbrown@suse.com + +- Replace references to /var/adm/fillup-templates with new + %_fillupdir macro (boo#1069468) + +------------------------------------------------------------------- +Fri Nov 10 22:12:08 UTC 2017 - antoine.belvire@opensuse.org + +- Fix cron symlinks removal upon package upgrade (boo#904518): + * The problem was in the preun section (in the old RPM). + * This means the symlinks are removed by this update, but won't + be by the next ones. + * Please run 'systemctl start btrfsmaintenance-refresh' one more + time to fix your symlinks. + +------------------------------------------------------------------- +Tue Nov 7 22:06:55 UTC 2017 - antoine.belvire@opensuse.org + +- Add btrfsmaintenance-0.3.1-fix-rpm-db-path.patch: + * Change RPM database path to /usr/lib/sysimage/rpm for + Tumbleweed. + +------------------------------------------------------------------- +Wed Jul 5 09:17:36 UTC 2017 - lnussel@suse.de + +- Require btrfsprogs (bsc#1047226) + +------------------------------------------------------------------- +Fri Apr 7 00:00:00 CEST 2017 - dsterba@suse.cz + +- version 0.3.1 + - dist-install: fix installation paths, install functions + - functions: fix syntax to be compatible with dash + - spec: install functions file + +------------------------------------------------------------------- +Tue Nov 15 00:00:00 CET 2016 - dsterba@suse.cz + +- version 0.3 + - add syslog to logging targets + - add none target (/dev/null) + - autodetect btrfs filesystems for balance, scrub and trim + - detect mixed blockgroups and use correct balance filters + - fix uninstall rules + - fix capturing entire output to the log + - fix when cron files are symlinks + - add generic installation script + - doc updates: retention policy tuning + +------------------------------------------------------------------- +Fri Mar 4 00:00:00 CET 2016 - dsterba@suse.cz + +- version 0.2 + - updated documentation + - support debian-like configuration paths + - no hardcoded paths to external utilities + - fixed logger name typos for 'journal' target + - defrag fixes (sysconfig, find arguments) + +------------------------------------------------------------------- +Thu Oct 8 00:00:00 CEST 2015 - dsterba@suse.cz + +- version 0.1.2 + - change default config for trim: off + - journal loggin should work (fixed a typo) + +------------------------------------------------------------------- +Mon Jul 13 00:00:00 CEST 2015 - dsterba@suse.com + +- version 0.1.1 + - fix typo and make journal logging target work + +------------------------------------------------------------------- +Wed Nov 19 00:00:00 CET 2014 - dsterba@suse.cz + +- cron refresh: remove bashism +- cron refresh: remove debugging messages +- post installation must create the cron links (bsc#904518) +- Removed patches: + * btrfsmaintenance-0.1-fix-bashisms.patch + +------------------------------------------------------------------- +Sat Nov 15 04:55:00 UTC 2014 - Led + +- fix bashism in btrfsmaintenance-refresh-cron.sh script +- add patches: + * btrfsmaintenance-0.1-fix-bashisms.patch + +------------------------------------------------------------------- +Wed Oct 29 00:00:00 CET 2014 - dsterba@suse.cz + +- add COPYING, README.md +- add config option to specify log target (stdout, or journal) + +------------------------------------------------------------------- +Thu Oct 9 18:33:44 CEST 2014 - dsterba@suse.cz + +- clean spec +- add Url tag + +------------------------------------------------------------------- +Thu Oct 9 16:47:46 CEST 2014 - dsterba@suse.cz + +- fix sysconfig file Path: tags + +------------------------------------------------------------------- +Wed Sep 24 13:17:22 CEST 2014 - dsterba@suse.cz + +- initial import 0.1 + diff --git a/btrfsmaintenance.spec b/btrfsmaintenance.spec new file mode 100644 index 0000000..ce2b6f3 --- /dev/null +++ b/btrfsmaintenance.spec @@ -0,0 +1,122 @@ +# +# spec file for package btrfsmaintenance +# +# Copyright (c) 2021 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +#Compat macro for new _fillupdir macro introduced in Nov 2017 +%if ! %{defined _fillupdir} + %define _fillupdir /var/adm/fillup-templates +%endif + +Name: btrfsmaintenance +Version: 0.5 +Release: 0 +Summary: Scripts for btrfs periodic maintenance tasks +License: GPL-2.0-only +Group: System/Base +URL: https://github.com/kdave/btrfsmaintenance +Source0: %{name}-%{version}.tar.bz2 +Source1: btrfs-defrag-plugin.sh +BuildRequires: pkgconfig(systemd) +Requires: btrfsprogs +Requires: (libzypp(plugin:commit) if zypper) +Supplements: btrfsprogs +BuildArch: noarch +%{?systemd_ordering} + +%description +Scripts for btrfs maintenance tasks like periodic scrub, balance, trim or defrag +on selected mountpoints or directories. Hints for periodic snapshot tuning (eg. +for snapper). + +%prep +%setup -q +cp %{SOURCE1} . + +%build + +%install +# scripts +install -m 755 -d %{buildroot}%{_datadir}/%{name} +install -m 755 btrfs-defrag.sh %{buildroot}%{_datadir}/%{name} +install -m 755 btrfs-balance.sh %{buildroot}%{_datadir}/%{name} +install -m 755 btrfs-scrub.sh %{buildroot}%{_datadir}/%{name} +install -m 755 btrfs-trim.sh %{buildroot}%{_datadir}/%{name} +install -m 755 btrfsmaintenance-refresh-cron.sh %{buildroot}%{_datadir}/%{name} +install -m 644 btrfsmaintenance-functions %{buildroot}%{_datadir}/%{name} + +# systemd services and timers +install -m 755 -d %{buildroot}%{_unitdir} +install -m 644 -D btrfsmaintenance-refresh.service %{buildroot}%{_unitdir} +install -m 644 -D btrfsmaintenance-refresh.path %{buildroot}%{_unitdir} +install -m 644 -D btrfs-balance.service %{buildroot}%{_unitdir} +install -m 644 -D btrfs-defrag.service %{buildroot}%{_unitdir} +install -m 644 -D btrfs-scrub.service %{buildroot}%{_unitdir} +install -m 644 -D btrfs-trim.service %{buildroot}%{_unitdir} +install -m 644 -D btrfs-balance.timer %{buildroot}%{_unitdir} +install -m 644 -D btrfs-defrag.timer %{buildroot}%{_unitdir} +install -m 644 -D btrfs-scrub.timer %{buildroot}%{_unitdir} +install -m 644 -D btrfs-trim.timer %{buildroot}%{_unitdir} +install -m 755 -d %{buildroot}%{_sbindir} +ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcbtrfsmaintenance-refresh + +# zypp plugin +install -m 755 -d %{buildroot}%{_prefix}/lib/zypp/plugins/commit +install -m 755 -D btrfs-defrag-plugin.sh %{buildroot}%{_prefix}/lib/zypp/plugins/commit + +# config +install -m 755 -d %{buildroot}%{_fillupdir} +install -m 644 -D sysconfig.btrfsmaintenance %{buildroot}%{_fillupdir} + +%pre +# if the new service files don't exist, we migrate from +# old version with old script, remove cron symlinks +[ ! -f %{_unitdir}/btrfs-balance.timer -a -f %{_datadir}/%{name}/btrfsmaintenance-refresh-cron.sh ] && %{_datadir}/%{name}/btrfsmaintenance-refresh-cron.sh uninstall +%service_add_pre btrfsmaintenance-refresh.service btrfsmaintenance-refresh.path btrfs-balance.service btrfs-balance.timer btrfs-defrag.service btrfs-defrag.timer btrfs-scrub.service btrfs-scrub.timer btrfs-trim.service btrfs-trim.timer + +%post +%service_add_post btrfsmaintenance-refresh.service btrfsmaintenance-refresh.path btrfs-balance.service btrfs-balance.timer btrfs-defrag.service btrfs-defrag.timer btrfs-scrub.service btrfs-scrub.timer btrfs-trim.service btrfs-trim.timer +%{fillup_only btrfsmaintenance} + +%preun +%service_del_preun btrfsmaintenance-refresh.service btrfsmaintenance-refresh.path btrfs-balance.service btrfs-balance.timer btrfs-defrag.service btrfs-defrag.timer btrfs-scrub.service btrfs-scrub.timer btrfs-trim.service btrfs-trim.timer + +%postun +%service_del_postun btrfsmaintenance-refresh.service btrfsmaintenance-refresh.path btrfs-balance.service btrfs-balance.timer btrfs-defrag.service btrfs-defrag.timer btrfs-scrub.service btrfs-scrub.timer btrfs-trim.service btrfs-trim.timer + +%files +%license COPYING +%doc README.md +%{_fillupdir}/sysconfig.btrfsmaintenance +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/* +%dir %{_prefix}/lib/zypp/ +%dir %{_prefix}/lib/zypp/plugins +%dir %{_prefix}/lib/zypp/plugins/commit +%{_prefix}/lib/zypp/plugins/commit/btrfs-defrag-plugin.sh +%{_unitdir}/btrfsmaintenance-refresh.path +%{_unitdir}/btrfsmaintenance-refresh.service +%{_unitdir}/btrfs-balance.service +%{_unitdir}/btrfs-defrag.service +%{_unitdir}/btrfs-scrub.service +%{_unitdir}/btrfs-trim.service +%{_unitdir}/btrfs-balance.timer +%{_unitdir}/btrfs-defrag.timer +%{_unitdir}/btrfs-scrub.timer +%{_unitdir}/btrfs-trim.timer +%{_sbindir}/rcbtrfsmaintenance-refresh + +%changelog