diff --git a/.cvsignore b/.cvsignore index e69de29..7c0c555 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +drbdlinks-1.17.tar.gz diff --git a/drbdlinks-1.17-cron.patch b/drbdlinks-1.17-cron.patch new file mode 100644 index 0000000..a9217d7 --- /dev/null +++ b/drbdlinks-1.17-cron.patch @@ -0,0 +1,15 @@ +Patch by Robert Scheck for drbdlinks <= 1.17, +which corrects the pid file name of cron on SuSE/openSUSE systems. If this +patch is not applied, restarting crond on RHEL/Fedora fails all the time. + +--- drbdlinks-1.17/drbdlinks 2009-05-19 00:49:23.000000000 +0200 ++++ drbdlinks-1.17/drbdlinks.cron 2009-05-19 10:43:40.000000000 +0200 +@@ -79,7 +79,7 @@ + syslogScriptPath = None + for checkInitPath, checkRunPath in [ + ( '/etc/init.d/crond', '/var/run/crond.pid' ), +- ( '/etc/init.d/cron', '/var/run/crond.pid' ), ++ ( '/etc/init.d/cron', '/var/run/cron.pid' ), + ]: + if os.path.exists(checkRunPath): + initScriptPath = checkInitPath diff --git a/drbdlinks.spec b/drbdlinks.spec new file mode 100644 index 0000000..ceac723 --- /dev/null +++ b/drbdlinks.spec @@ -0,0 +1,85 @@ +Summary: A program for managing links into a DRBD shared partition +Name: drbdlinks +Version: 1.17 +Release: 1%{?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 +Patch0: drbdlinks-1.17-cron.patch +Requires: python, heartbeat +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +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 +%patch0 -p1 -b .cron + +%build + +%install +rm -rf $RPM_BUILD_ROOT + +# Create the needed directories +mkdir -p $RPM_BUILD_ROOT{%{_initrddir},%{_sysconfdir}/ha.d/resource.d,%{_mandir}/man8} +mkdir -p $RPM_BUILD_ROOT{%{_sbindir},%{_localstatedir}/run/%{name}/configs-to-clean} + +# Install the files and symlinks +install -p -m 755 %{name} $RPM_BUILD_ROOT%{_sbindir}/%{name} +ln -s ../../..%{_sbindir}/%{name} $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/resource.d/%{name} +install -p -m 644 %{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf +install -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/drbdlinksclean +install -p -m 644 %{name}.8 $RPM_BUILD_ROOT%{_mandir}/man8/%{name}.8 + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +/sbin/chkconfig --add drbdlinksclean + +%preun +if [ $1 -eq 0 ]; then + /sbin/service drbdlinksclean stop > /dev/null 2>&1 || : + /sbin/chkconfig --del drbdlinksclean +fi + +%files +%defattr(-,root,root,-) +%doc LICENSE README WHATSNEW +%{_initrddir}/drbdlinksclean +%config(noreplace) %{_sysconfdir}/%{name}.conf +%{_sbindir}/%{name} +%{_sysconfdir}/ha.d/resource.d/%{name} +%{_mandir}/man8/%{name}.8* +%{_localstatedir}/run/%{name}/ + +%changelog +* Tue May 18 2009 Robert Scheck 1.17-1 +- Upgrade to 1.17 + +* Sun May 17 2009 Robert Scheck 1.16-1 +- Upgrade to 1.16 + +* Sat May 16 2009 Robert Scheck 1.15-1 +- Upgrade to 1.15 +- Initial spec file for Fedora and Red Hat Enterprise Linux diff --git a/drbdlinksclean b/drbdlinksclean new file mode 100644 index 0000000..fd5a2e6 --- /dev/null +++ b/drbdlinksclean @@ -0,0 +1,77 @@ +#!/bin/bash +# +# drbdlinksclean Clean up drbdlinks links on system boot or shutdown +# +# chkconfig: - 74 06 +# description: Calls drbdlinks on initial system boot and shutdown to make \ +# sure that any links set up by drbdlinks are cleaned up when \ +# drbd is not running. +# config: /etc/drbdlinks.conf + +### BEGIN INIT INFO +# Provides: drbdlinksclean +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Short-Description: Clean up drbdlinks links on system boot or shutdown +# Description: Calls drbdlinks on initial system boot and shutdown to make +# sure that any links set up by drbdlinks are cleaned up when +# drbd is not running. +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +RETVAL=0 +FOUNDFILE=0 +drbdlinks=/usr/sbin/drbdlinks + +[ -f /etc/drbdlinks.conf ] && FOUNDFILE=1 + +for FILE in /var/run/drbdlinks/configs-to-clean/*; do + if [ -f "$FILE" ]; then + FOUNDFILE=1 + break + fi +done + +if [ $FOUNDFILE -ne 1 ]; then + echo "No /etc/drbdlinks.conf file, aborting." + exit 1 +fi + +# See how we were called. +case "$1" in + start|stop|restart|force-reload) + echo -n "Cleaning up drbdlinks.conf links..." + + # Main drbdlinks.conf file + if [ -f /etc/drbdlinks.conf ]; then + if grep -q '^mountpoint(' /etc/drbdlinks.conf; then + $drbdlinks stop + RETVAL=$? + else + echo "No mountpoint found in /etc/drbdlinks.conf, skipping." + fi + fi + + # clean up any supplemental config files + for FILE in /var/run/drbdlinks/configs-to-clean/*; do + if [ -f "$FILE" ]; then + echo -n "Cleaning up '${FILE##*/}' links..." + $drbdlinks --config-file "$FILE" stop || RETVAL=$? + fi + done + + [ $RETVAL -eq 0 ] && echo_success || echo_failure + echo + ;; + status) + $drbdlinks status + ;; + *) + echo $"Usage: drbdlinksclean {start|stop|status|restart|force-reload}" + RETVAL=1 + ;; +esac + +exit $RETVAL diff --git a/sources b/sources index e69de29..e603332 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +ac97558cbe52355e06529d5553ba46eb drbdlinks-1.17.tar.gz