Accepting request 251798 from home:dsterba:tools

New package, supplements btrfsprogs with cron jobs to do regular maintenance tasks.

OBS-URL: https://build.opensuse.org/request/show/251798
OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsmaintenance?expand=0&rev=1
This commit is contained in:
David Sterba 2014-09-24 11:37:33 +00:00 committed by Git OBS Bridge
commit 09b313508d
5 changed files with 148 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7c990c2dea18aadc4f120b975ab0e41a6f01e643efe553c1598e6443dc2a9a35
size 3621

5
btrfsmaintenance.changes Normal file
View File

@ -0,0 +1,5 @@
-------------------------------------------------------------------
Wed Sep 24 13:17:22 CEST 2014 - dsterba@suse.cz
- initial import 0.1

116
btrfsmaintenance.spec Normal file
View File

@ -0,0 +1,116 @@
#
# spec file for package btrfsmaintenance
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
Name: btrfsmaintenance
Version: 0.1
Release: 0
Summary: Scripts for btrfs periodic maintenance tasks
License: GPL-2.0
Group: System/Base
Source0: %{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Recommends: cron
Requires: zypp-plugin-python
Requires: libzypp(plugin:commit) = 1
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%endif
%{?systemd_requires}
Supplements: btrfsprogs
%description
Scripts for btrfs maintenance taks like periodic scrub, balance, trim or defrag
on selected mountpoints or directories.
%prep
%setup -q
%build
%install
# fix build error on openSUSE and SLE
mkdir -p %{buildroot}%{_sysconfdir}/cron.daily/
mkdir -p %{buildroot}%{_sysconfdir}/cron.weekly/
mkdir -p %{buildroot}%{_sysconfdir}/cron.monthly/
install -m 755 -d %{buildroot}/usr/share/%{name}
install -m 755 btrfs-defrag.sh %{buildroot}/usr/share/%{name}
install -m 755 btrfs-balance.sh %{buildroot}/usr/share/%{name}
install -m 755 btrfs-scrub.sh %{buildroot}/usr/share/%{name}
install -m 755 btrfs-trim.sh %{buildroot}/usr/share/%{name}
install -m 755 btrfsmaintenance-refresh-cron.sh %{buildroot}/usr/share/%{name}
%if 0%{?suse_version} >= 1210
install -m 755 -d %{buildroot}%{_unitdir}
install -m 644 -D btrfsmaintenance-refresh.service %{buildroot}%{_unitdir}
install -m 755 -d %{buildroot}%{_sbindir}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcbtrfsmaintenance-refresh
%else
# just a hack, but sufficient
install -m 755 -d %{buildroot}/etc/cron.hourly
ln -s /usr/share/%{name}/btrfsmaintenance-refresh-cron.sh %{buildroot}/etc/cron.hourly/
%endif
install -m 755 -d %{buildroot}/usr/lib/zypp/plugins/commit
install -m 755 -D btrfs-defrag-plugin.py %{buildroot}/usr/lib/zypp/plugins/commit
install -m 755 -d %{buildroot}%{_localstatedir}/adm/fillup-templates
install -m 644 -D sysconfig.btrfsmaintenance %{buildroot}%{_localstatedir}/adm/fillup-templates
%post
%{fillup_only btrfsmaintenance}
%if 0%{?suse_version} >= 1210
%service_add_post btrfsmaintenance-refresh.service
%endif
%if 0%{?suse_version} >= 1210
%pre
%service_add_pre btrfsmaintenance-refresh.service
%preun
%service_del_preun btrfsmaintenance-refresh.service
/usr/share/%{name}/btrfsmaintenance-refresh-cron.sh uninstall
%postun
%service_del_postun btrfsmaintenance-refresh.service
%endif
%if 0%{?suse_version} < 1210
%preun
/usr/share/%{name}/btrfsmaintenance-refresh-cron.sh uninstall
%endif
%files
%defattr(-,root,root)
%{_localstatedir}/adm/fillup-templates/sysconfig.btrfsmaintenance
%dir /usr/share/%{name}
/usr/share/%{name}/*
%dir /usr/lib/zypp/
%dir /usr/lib/zypp/plugins
%dir /usr/lib/zypp/plugins/commit
/usr/lib/zypp/plugins/commit/btrfs-defrag-plugin.py
%if 0%{?suse_version} >= 1210
%dir %{_unitdir}
%{_unitdir}/btrfsmaintenance-refresh.service
%{_sbindir}/rcbtrfsmaintenance-refresh
%else
/etc/cron.hourly/btrfsmaintenance-refresh-cron.sh
%endif
%changelog