diff --git a/boot.dmraid b/boot.dmraid deleted file mode 100644 index 9cae764..0000000 --- a/boot.dmraid +++ /dev/null @@ -1,67 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 2007 SuSE GmbH Nuernberg, Germany. All rights reserved. -# -# /etc/init.d/boot.dmraid -# -### BEGIN INIT INFO -# Provides: boot.dmraid -# Required-Start: boot.udev boot.rootfsck -# Should-Start: boot.device-mapper boot.multipath boot.md boot.scsidev -# X-Start-Before: boot.localfs -# Required-Stop: boot.udev boot.rootfsck -# Should-Stop: boot.multipath boot.md boot.scsidev -# X-Stop-Before: boot.localfs -# Default-Start: B -# Default-Stop: -# Short-Description: start dmraid -# Description: start dmraid -### END INIT INFO - -. /etc/rc.status -. /etc/sysconfig/dmraid - -DMRAID=/sbin/dmraid -test -x $DMRAID || { echo "dmraid not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -# udev interaction -if [ -x /sbin/udevadm ]; then - [ -z "$DMRAID_DEVICE_TIMEOUT" ] && DMRAID_DEVICE_TIMEOUT=60 -else - DMRAID_DEVICE_TIMEOUT=0 -fi - -# make sure /run/lock exists as /run is tmpfs -[ -d /run/lock ] || mkdir -p /run/lock >/dev/null 2>&1 - -rc_reset - -case "$1" in - start) - # Waiting for udev to settle - if [ "$DMRAID_DEVICE_TIMEOUT" -gt 0 ] ; then - echo "Waiting for udev to settle..." - /sbin/udevadm settle --timeout=$DMRAID_DEVICE_TIMEOUT - fi - echo "Activating dmraid..." - $DMRAID -ay -p $DMRAID_START_OPTIONS - - rc_status -v -r - ;; - stop) - $DMRAID -an $DMRAID_STOP_OPTIONS - rc_status -v - ;; - status) - rc_failed 4 - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status}" - exit 1 - ;; -esac - -rc_exit diff --git a/dmraid-activation.service b/dmraid-activation.service new file mode 100644 index 0000000..7156f15 --- /dev/null +++ b/dmraid-activation.service @@ -0,0 +1,15 @@ +[Unit] +Description=Activation of DM RAID sets +DefaultDependencies=no +Conflicts=shutdown.target +After=systemd-udev-settle.service +Before=lvm2-activation-early.service cryptsetup.target local-fs.target shutdown.target +Wants=systemd-udev-settle.service + +[Service] +EnvironmentFile=-/etc/sysconfig/dmraid +ExecStart=/sbin/dmraid -ay -p $DMRAID_START_OPTIONS +Type=oneshot + +[Install] +WantedBy=sysinit.target diff --git a/dmraid-destdir.patch b/dmraid-destdir.patch new file mode 100644 index 0000000..839d021 --- /dev/null +++ b/dmraid-destdir.patch @@ -0,0 +1,65 @@ +--- 1.0.0.rc16.orig/include/Makefile.in ++++ 1.0.0.rc16/include/Makefile.in +@@ -17,8 +17,8 @@ include $(top_srcdir)/make.tmpl + + install_dmraid_headers: $(HEADERS) + @echo "Installing $(HEADERS) in $(includedir)/dmraid" +- mkdir -p $(includedir)/dmraid +- $(INSTALL) $(STRIP) $(HEADERS) $(includedir)/dmraid ++ mkdir -p $(DESTDIR)$(includedir)/dmraid ++ $(INSTALL) $(STRIP) $(HEADERS) $(DESTDIR)$(includedir)/dmraid + + install: install_dmraid_headers + +--- 1.0.0.rc16.orig/lib/Makefile.in ++++ 1.0.0.rc16/lib/Makefile.in +@@ -78,16 +78,16 @@ $(LIB_EVENTS_SHARED): + + install_dmraid_libs: $(INSTALL_TARGETS) + @echo "Installing $(INSTALL_TARGETS) in $(libdir)"; \ +- mkdir -p $(libdir); \ ++ mkdir -p $(DESTDIR)$(libdir); \ + for f in $(INSTALL_TARGETS); \ + do \ + n=$$(basename $${f}) ; \ + if [[ "$$n" =~ .so$$ && ! "$$n" =~ libdmraid-events-.* ]]; then \ + $(INSTALL) -m 555 $(STRIP) \ +- $$f $(libdir)/$${n}.@DMRAID_LIB_VERSION@; \ +- $(LN_S) -f $${n}.@DMRAID_LIB_VERSION@ $(libdir)/$${n}; \ ++ $$f $(DESTDIR)$(libdir)/$${n}.@DMRAID_LIB_VERSION@; \ ++ $(LN_S) -f $${n}.@DMRAID_LIB_VERSION@ $(DESTDIR)$(libdir)/$${n}; \ + else \ +- $(INSTALL) -m 555 $(STRIP) $$f $(libdir)/$${n}; \ ++ $(INSTALL) -m 555 $(STRIP) $$f $(DESTDIR)$(libdir)/$${n}; \ + fi \ + done + +--- 1.0.0.rc16.orig/tools/Makefile.in ++++ 1.0.0.rc16/tools/Makefile.in +@@ -80,8 +80,8 @@ dmevent_tool: $(top_srcdir)/lib/libdmrai + + install_dmraid_tools: $(TARGETS) + @echo "Installing $(TARGETS) in $(sbindir)"; \ +- mkdir -p $(sbindir); \ +- $(INSTALL) $(STRIP) $(TARGETS) $(sbindir) ++ mkdir -p $(DESTDIR)$(sbindir); \ ++ $(INSTALL) $(STRIP) $(TARGETS) $(DESTDIR)$(sbindir) + + install: install_dmraid_tools + +--- 1.0.0.rc16.orig/man/Makefile.in ++++ 1.0.0.rc16/man/Makefile.in +@@ -17,11 +17,11 @@ include $(top_srcdir)/make.tmpl + + install_dmraid_man: + @echo "Installing $(MAN8) in $(MAN8DIR)"; \ +- mkdir -p $(MAN8DIR); \ ++ mkdir -p $(DESTDIR)$(MAN8DIR); \ + for f in $(MAN8); \ + do \ + $(RM) $(MAN8DIR)/$$f; \ +- @INSTALL@ -D -m 444 $$f $(MAN8DIR)/$$f; \ ++ @INSTALL@ -D -m 444 $$f $(DESTDIR)$(MAN8DIR)/$$f; \ + done + + install: install_dmraid_man diff --git a/dmraid.changes b/dmraid.changes index 3cb9ab2..b9cdde7 100644 --- a/dmraid.changes +++ b/dmraid.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Sep 13 20:04:57 UTC 2013 - crrodriguez@opensuse.org + +- Fix Makefiles so they support DESTDIR +- add tmpfiles.d so runtime directories are properly created +- Remove sysvinit support and replace it for native systemd support. + ------------------------------------------------------------------- Tue Jul 23 14:38:15 CEST 2013 - ohering@suse.de diff --git a/dmraid.spec b/dmraid.spec index cbd46cb..9cf7337 100644 --- a/dmraid.spec +++ b/dmraid.spec @@ -21,6 +21,7 @@ BuildRequires: autoconf BuildRequires: automake BuildRequires: device-mapper-devel BuildRequires: libselinux-devel +BuildRequires: systemd-rpm-macros BuildRequires: zlib-devel Requires: aaa_base Requires: kpartx @@ -32,10 +33,10 @@ Version: 1.0.0.rc16 Release: 0 Source: ftp://people.redhat.com/heinzm/sw/dmraid/src/dmraid-%{version}.tar.bz2 Source1: sysconfig.dmraid -Source2: boot.dmraid Source3: README.SuSE Source4: mkinitrd-setup.sh Source5: mkinitrd-boot.sh +Source6: dmraid-activation.service Patch1: dmraid-1.0.0.rc16-cvs-2010-02-02.patch Patch2: dmraid-1.0.0.rc13-geometry.patch Patch3: lib-install.patch @@ -44,8 +45,10 @@ Patch5: remove_trylock Patch6: rebuild.fix Patch7: ddf-erase Patch8: dmraid-move-var-lock-to-run-lock.patch +Patch9: dmraid-destdir.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: %fillup_prereq +%{systemd_requires} %description This software discovers, activates, deactivates, and displays @@ -83,21 +86,16 @@ Authors: %patch6 -p1 %patch7 -p1 %patch8 -p1 +%patch9 -p1 cp %{SOURCE3} . %build #rm -f aclocal.m4 autoreconf -fi rm -r autom4te.cache -# Update config.{guess,sub} -%{?suse_update_config} -export CFLAGS="$RPM_OPT_FLAGS" -./configure --prefix=$RPM_BUILD_ROOT%{_prefix} \ - --infodir=$RPM_BUILD_ROOT%{_infodir} \ - --libdir=$RPM_BUILD_ROOT/%_lib \ - --mandir=$RPM_BUILD_ROOT%{_mandir} \ - --includedir=$RPM_BUILD_ROOT%{_includedir} \ - --sbindir=$RPM_BUILD_ROOT/sbin \ +%configure \ + --libdir=/%_lib \ + --sbindir=/sbin \ --with-user=`id -nu` --with-group=`id -ng` \ --enable-libselinux --enable-libsepol make @@ -110,26 +108,27 @@ rm $RPM_BUILD_ROOT/%_lib/libdmraid.so mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates install -m644 %{SOURCE1} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.dmraid mkdir -p $RPM_BUILD_ROOT/etc/init.d -install -m744 %{SOURCE2} $RPM_BUILD_ROOT/etc/init.d/boot.dmraid install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts install -m 755 %{S:4} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-dmraid.sh install -m 755 %{S:5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-dmraid.sh +install -D -m 0644 %{S:6} %{buildroot}%{_unitdir}/dmraid-activation.service +install -d %{buildroot}%{_tmpfilesdir} +echo 'd /run/lock/dmraid 0700 root root -' > %{buildroot}%{_tmpfilesdir}/dmraid.conf + +%preun +%service_del_preun dmraid-activation.service %post +/sbin/ldconfig +%service_add_post dmraid-activation.service [ -x /sbin/mkinitrd_setup ] && mkinitrd_setup %{fillup_only} %postun +/sbin/ldconfig [ -x /sbin/mkinitrd_setup ] && mkinitrd_setup %{insserv_cleanup} -%preun -%stop_on_removal - -%clean -[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] \ - && rm -rf $RPM_BUILD_ROOT - %files %defattr(-, root, root) /sbin/dmraid @@ -137,12 +136,13 @@ install -m 755 %{S:5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-dmraid.sh %{_mandir}/man8/* %doc LICENSE LICENSE_GPL LICENSE_LGPL README README.SuSE TODO doc/* /var/adm/fillup-templates/sysconfig.dmraid -/etc/init.d/boot.dmraid %dir /lib/mkinitrd %dir /lib/mkinitrd/scripts /lib/mkinitrd/scripts/setup-dmraid.sh /lib/mkinitrd/scripts/boot-dmraid.sh /%{_lib}/libdmraid-events-isw.so /%{_lib}/libdmraid.so.1.0.0.rc16-3 +%{_tmpfilesdir}/dmraid.conf +%{_unitdir}/dmraid-activation.service %changelog