You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
3.6 KiB

  1. # Enable with systemctl "enable sanoid.timer"
  2. %global _with_systemd 1
  3. Name: sanoid
  4. Version: 2.0.3
  5. Release: 3%{?dist}
  6. BuildArch: noarch
  7. Summary: A policy-driven snapshot management tool for ZFS file systems
  8. Group: Applications/System
  9. License: GPLv3
  10. URL: https://github.com/jimsalterjrs/sanoid
  11. Source0: https://github.com/jimsalterjrs/%{name}/archive/v%{version}/sanoid-%{version}.tar.gz
  12. Requires: perl, mbuffer, lzop, pv, perl-Config-IniFiles, perl-Capture-Tiny
  13. %if 0%{?_with_systemd}
  14. Requires: systemd >= 212
  15. BuildRequires: systemd
  16. %endif
  17. %description
  18. Sanoid is a policy-driven snapshot management
  19. tool for ZFS file systems. You can use Sanoid
  20. to create, automatically thin, and monitor snapshots
  21. and pool health from a single eminently
  22. human-readable TOML configuration file.
  23. %prep
  24. %setup -q
  25. %build
  26. echo "Nothing to build"
  27. %install
  28. %{__install} -D -m 0644 sanoid.defaults.conf %{buildroot}/etc/sanoid/sanoid.defaults.conf
  29. %{__install} -d %{buildroot}%{_sbindir}
  30. %{__install} -m 0755 sanoid syncoid findoid sleepymutex %{buildroot}%{_sbindir}
  31. %if 0%{?_with_systemd}
  32. %{__install} -d %{buildroot}%{_unitdir}
  33. %endif
  34. %if 0%{?fedora}
  35. %{__install} -D -m 0644 sanoid.conf %{buildroot}%{_docdir}/%{name}/examples/sanoid.conf
  36. %endif
  37. %if 0%{?rhel}
  38. %{__install} -D -m 0644 sanoid.conf %{buildroot}%{_docdir}/%{name}-%{version}/examples/sanoid.conf
  39. %endif
  40. %if 0%{?_with_systemd}
  41. cat > %{buildroot}%{_unitdir}/%{name}.service <<EOF
  42. [Unit]
  43. Description=Snapshot ZFS Pool
  44. Requires=zfs.target
  45. After=zfs.target
  46. [Service]
  47. Environment=TZ=UTC
  48. Type=oneshot
  49. ExecStart=%{_sbindir}/sanoid --cron
  50. EOF
  51. cat > %{buildroot}%{_unitdir}/%{name}.timer <<EOF
  52. [Unit]
  53. Description=Run Sanoid
  54. [Timer]
  55. OnCalendar=*:0/1
  56. Persistent=true
  57. [Install]
  58. WantedBy=timers.target
  59. EOF
  60. %else
  61. %if 0%{?fedora}
  62. %{__install} -D -m 0644 sanoid.conf %{buildroot}%{_docdir}/%{name}/examples/sanoid.conf
  63. %endif
  64. %if 0%{?rhel}
  65. echo "* * * * * root %{_sbindir}/sanoid --cron" > %{buildroot}%{_docdir}/%{name}-%{version}/examples/sanoid.cron
  66. %endif
  67. %endif
  68. %post
  69. %{?_with_systemd:%{_bindir}/systemctl daemon-reload}
  70. %postun
  71. %{?_with_systemd:%{_bindir}/systemctl daemon-reload}
  72. %files
  73. %doc CHANGELIST VERSION README.md FREEBSD.readme
  74. %license LICENSE
  75. %{_sbindir}/sanoid
  76. %{_sbindir}/syncoid
  77. %{_sbindir}/findoid
  78. %{_sbindir}/sleepymutex
  79. %dir %{_sysconfdir}/%{name}
  80. %config %{_sysconfdir}/%{name}/sanoid.defaults.conf
  81. %if 0%{?fedora}
  82. %{_docdir}/%{name}
  83. %endif
  84. %if 0%{?rhel}
  85. %{_docdir}/%{name}-%{version}
  86. %endif
  87. %if 0%{?_with_systemd}
  88. %{_unitdir}/%{name}.service
  89. %{_unitdir}/%{name}.timer
  90. %endif
  91. %changelog
  92. * Fri Jan 31 2020 Daniel Berteaud <daniel@firewall-services.com> 2.0.3-3
  93. - Update to 2.0.3 (daniel@firewall-services.com)
  94. * Wed Sep 18 2019 Daniel Berteaud <daniel@firewall-services.com> 2.0.1-2
  95. - Use tito's ReleaseTagger (daniel@firewall-services.com)
  96. - Default timer run every minute (daniel@firewall-services.com)
  97. * Wed Sep 18 2019 Daniel Berteaud <daniel@firewall-services.com> 2.0.1-1
  98. - Build 2.0.1 with tito
  99. * Wed Dec 04 2018 Christoph Klaffl <christoph@phreaker.eu> - 2.0.0
  100. - Bump to 2.0.0
  101. * Sat Apr 28 2018 Dominic Robinson <github@dcrdev.com> - 1.4.18-1
  102. - Bump to 1.4.18
  103. * Thu Aug 31 2017 Dominic Robinson <github@dcrdev.com> - 1.4.14-2
  104. - Add systemd timers
  105. * Wed Aug 30 2017 Dominic Robinson <github@dcrdev.com> - 1.4.14-1
  106. - Version bump
  107. * Wed Jul 12 2017 Thomas M. Lapp <tmlapp@gmail.com> - 1.4.13-1
  108. - Version bump
  109. - Include FREEBSD.readme in docs
  110. * Wed Jul 12 2017 Thomas M. Lapp <tmlapp@gmail.com> - 1.4.9-1
  111. - Version bump
  112. - Clean up variables and macros
  113. - Compatible with both Fedora and Red Hat
  114. * Sat Feb 13 2016 Thomas M. Lapp <tmlapp@gmail.com> - 1.4.4-1
  115. - Initial RPM Package