Blob Blame History Raw
Summary:           A program for managing links into a DRBD shared partition
Name:              drbdlinks
Version:           1.27
Release:           4%{?dist}
License:           GPLv2
Group:             Applications/System
URL:               http://www.tummy.com/Community/software/%{name}/
Source0:           ftp://ftp.tummy.com/pub/tummy/%{name}/%{name}-%{version}.tar.gz
Source1:           drbdlinksclean
Source2:           drbdlinks.logrotate
Source3:           drbdlinksclean.service
Source4:           drbdlinksclean-wrapper
Requires:          python
%if 0%{?rhel} > 6 || 0%{?fedora} > 23
Requires(post):    systemd
Requires(preun):   systemd
Requires(postun):  systemd
BuildRequires:     systemd
%else
Requires(post):    /sbin/chkconfig
Requires(preun):   /sbin/chkconfig
%endif
BuildArch:         noarch
BuildRoot:         %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
The drbdlinks program manages links into a DRBD partition which is shared
among several machines. A simple configuration file, "/etc/drbdlinks.conf",
specifies the links. This can be used to manage e.g. links for /etc/httpd,
/var/lib/pgsql and other system directories that need to appear as if they
are local to the system when running applications after the drbd shared
partition has been mounted.

When running drbdlinks with "start" as the mode, drbdlinks will rename the
existing files/directories and then make symbolic links into the DRBD
partition, "stop" does the reverse. By default, rename appends ".drbdlinks"
to the name, but this can be overridden.

An init script is included which runs "stop" before heartbeat starts, and
after heartbeat stops. This is done to try to ensure that when the shared
partition isn't mounted, the links are in their normal state.

%prep
%setup -q

%build

%install
rm -rf $RPM_BUILD_ROOT

install -D -p -m 755 %{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}
mkdir -p $RPM_BUILD_ROOT{%{_sysconfdir}/ha.d/resource.d,/usr/lib/ocf/resource.d/tummy}
ln -s ../../..%{_sbindir}/%{name} $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/resource.d/%{name}
ln -s ../../../../..%{_sbindir}/%{name} $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/tummy/%{name}
install -D -p -m 644 %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
%if 0%{?rhel} > 6 || 0%{?fedora} > 23
install -D -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/drbdlinksclean.service
install -D -p -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/drbdlinksclean
%else
install -D -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/drbdlinksclean
%endif
install -D -p -m 644 %{name}.8 $RPM_BUILD_ROOT%{_mandir}/man8/%{name}.8
install -D -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/configs-to-clean

mv -f README.markdown README

%clean
rm -rf $RPM_BUILD_ROOT

%post
%if 0%{?rhel} > 6 || 0%{?fedora} > 23
%systemd_post drbdlinksclean.service
%else
/sbin/chkconfig --add drbdlinksclean
%endif

%preun
%if 0%{?rhel} > 6 || 0%{?fedora} > 23
%systemd_preun drbdlinksclean.service
%else
if [ $1 -eq 0 ]; then
  /sbin/service drbdlinksclean stop > /dev/null 2>&1 || :
  /sbin/chkconfig --del drbdlinksclean
fi
%endif

%if 0%{?rhel} > 6 || 0%{?fedora} > 23
%postun
%systemd_postun drbdlinksclean.service
%endif

%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc README WHATSNEW
%if 0%{?rhel} > 6 || 0%{?fedora} > 23
%{_unitdir}/drbdlinksclean.service
%{_libexecdir}/drbdlinksclean
%else
%{_sysconfdir}/rc.d/init.d/drbdlinksclean
%endif
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_sbindir}/%{name}
%{_sysconfdir}/ha.d/
/usr/lib/ocf/resource.d/tummy/
%{_mandir}/man8/%{name}.8*
%{_localstatedir}/lib/%{name}/

%changelog
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.27-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Jan 26 2016 Robert Scheck <robert@fedoraproject.org> 1.27-3
- Provide native systemd service

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.27-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Sep 08 2014 Robert Scheck <robert@fedoraproject.org> 1.27-1
- Upgrade to 1.27

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.26-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Mar 02 2014 Robert Scheck <robert@fedoraproject.org> 1.26-1
- Upgrade to 1.26

* Sun Oct 13 2013 Robert Scheck <robert@fedoraproject.org> 1.25-1
- Upgrade to 1.25

* Sun Aug 04 2013 Robert Scheck <robert@fedoraproject.org> 1.23-1
- Upgrade to 1.23

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.22-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.22-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Jul 19 2012 Robert Scheck <robert@fedoraproject.org> 1.22-1
- Upgrade to 1.22

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.20-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.20-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Sat Aug 13 2011 Robert Scheck <robert@fedoraproject.org> 1.20-1
- Upgrade to 1.20

* Sun Jul 17 2011 Robert Scheck <robert@fedoraproject.org> 1.19-2
- Handle visible SELinux range label if mcstrans is not used
- Added configuration file for tmpfiles handling (#656578)
- Added logrotate configuration to ignore possible *.drbdlinks

* Mon May 16 2011 Robert Scheck <robert@fedoraproject.org> 1.19-1
- Upgrade to 1.19

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.18-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.18-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sun May 24 2009 Robert Scheck <robert@fedoraproject.org> 1.18-1
- Upgrade to 1.18

* Tue May 18 2009 Robert Scheck <robert@fedoraproject.org> 1.17-1
- Upgrade to 1.17

* Sun May 17 2009 Robert Scheck <robert@fedoraproject.org> 1.16-1
- Upgrade to 1.16

* Sat May 16 2009 Robert Scheck <robert@fedoraproject.org> 1.15-1
- Upgrade to 1.15
- Initial spec file for Fedora and Red Hat Enterprise Linux