Browse Source

lvm2-2.03.09-2

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@12411 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop 3 years ago
parent
commit
b6bf6a5104
1 changed files with 169 additions and 13 deletions
  1. 169 13
      l/lvm2/lvm2-vl.spec

+ 169 - 13
l/lvm2/lvm2-vl.spec

@@ -1,6 +1,6 @@
-%define lvm_version 2.03.09
-%define device_mapper_version 1.02.171
+%bcond_with systemd
 
+%define device_mapper_version 1.02.171
 %define _unpackaged_files_terminate_build 1
 
 # Do not reset Release to 1 unless both lvm2 and device-mapper 
@@ -9,28 +9,38 @@
 Summary: Userland logical volume management tools
 Summary(ja): 論理ボリューム管理ツール
 Name: lvm2
-Version: %{lvm_version}
-Release: 1%{?_dist_release}
+Version: 2.03.09
+%global lvm_version %{version}
+Release: 2%{?_dist_release}%{?with_systemd:.systemd}
 Group: System Environment/Base
-
 Distribution: Vine Linux
 Vendor: Project Vine
 Packager: daisuke
 
 License: GPLv2
 URL: http://sourceware.org/lvm2/
-Source0: LVM2.%{lvm_version}.tgz
+Source0: LVM2.%{version}.tgz
 Patch0: lvm2-set-default-preferred_names.patch
 
-BuildRoot: %{_tmppath}/%{name}-%{lvm_version}-%{release}-buildroot
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 BuildRequires: libaio-devel
 BuildRequires: libtermcap-devel
-BuildRequires: libudev-devel
 BuildRequires: ncurses-devel
 BuildRequires: readline-devel
 Requires: device-mapper >= %{device_mapper_version}-%{release}
 Requires: device-mapper-event >= %{device_mapper_version}-%{release}
 Requires: %{name}-libs = %{version}-%{release}
+%if %{with systemd}
+BuildRequires: python3
+BuildRequires: python3-rpm-macros
+BuildRequires: python3-pyudev
+BuildRequires: dbus-python3
+BuildRequires: systemd-devel
+BuildRequires: systemd-units
+%{?systemd_requires}
+%else
+BuildRequires: libudev-devel
+%endif
 Conflicts: lvm
 Obsoletes: lvm
 
@@ -44,6 +54,7 @@ losetup(8)), creating volume groups (kind of virtual disks) from one
 or more physical volumes and creating one or more logical volumes
 (kind of logical partitions) in volume groups.
 
+
 %package devel
 Summary: Development libraries and headers for lvm2
 Summary(ja): LVM2 の開発用ライブラリ及びヘッダファイル
@@ -59,6 +70,7 @@ Requires: pkgconfig
 This package contains files needed to develop applications that use
 the lvm2 libraries.
 
+
 %package libs
 Summary: lvm2 shared libraries
 Summary(ja): LVM2 の共有ライブラリ
@@ -68,6 +80,25 @@ Group: System Environment/Libraries
 %description libs
 This package contains shared lvm2 libraries for applications.
 
+%if %{with systemd}
+%package dbusd
+Summary: LVM2 D-Bus daemon
+Summary(ja): LVM2 D-Bus デーモン
+License: GPLv2
+BuildArch: noarch
+Requires: lvm2 >= %{version}-%{release}
+Requires: dbus
+Requires: dbus-python3
+Requires: python3-pyudev
+Requires: python3-pygobject
+Requires(post): systemd-units >= %{systemd_version}
+Requires(preun): systemd-units >= %{systemd_version}
+Requires(postun): systemd-units >= %{systemd_version}
+
+%description dbusd
+Daemon for access to LVM2 functionality through a D-Bus interface.
+%endif
+
 # device-mapper
 %package -n device-mapper
 Summary: Device mapper utility
@@ -85,6 +116,7 @@ Requires: util-linux-ng >= 2.15
 This package contains the supporting userspace utility, dmsetup,
 for the kernel device-mapper.
 
+
 # device-mapper-devel
 %package -n device-mapper-devel
 Summary: Development libraries and headers for device-mapper
@@ -100,6 +132,7 @@ Requires: device-mapper-libs = %{device_mapper_version}-%{release}
 This package contains files needed to develop applications that use
 the device-mapper libraries.
 
+
 %package -n device-mapper-libs
 Summary: Device-mapper shared library
 Summary(ja): Device-mapper の共有ライブラリ
@@ -112,6 +145,7 @@ Obsoletes: device-mapper < 1.02.30-1
 %description -n device-mapper-libs
 This package contains the device-mapper shared library, libdevmapper.
 
+
 %package -n device-mapper-event
 Summary: Device-mapper event daemon
 Summary(ja): Device-mapper イベントデーモン
@@ -125,6 +159,7 @@ Requires: device-mapper-event-libs = %{device_mapper_version}-%{release}
 This package contains the dmeventd daemon for monitoring the state
 of device-mapper devices.
 
+
 %package -n device-mapper-event-libs
 Summary: Device-mapper event daemon shared library
 Summary(ja): Device-mapper イベントデーモン共有ライブラリ
@@ -137,6 +172,7 @@ Group: System Environment/Libraries
 This package contains the device-mapper event daemon shared library,
 libdevmapper-event.
 
+
 %package -n device-mapper-event-devel
 Summary: Development libraries and headers for the device-mapper event daemon
 Summary(ja): Device-mapper イベントデーモンの開発用ライブラリ及びヘッダファイル
@@ -151,10 +187,12 @@ Requires: pkgconfig
 This package contains files needed to develop applications that use
 the device-mapper event library.
 
+
 %prep
 %setup -q -n LVM2.%{lvm_version}
 %patch0 -p1 -b .preferred_names
 
+
 %build
 %define _exec_prefix /
 %define _bindir /bin
@@ -162,6 +200,12 @@ the device-mapper event library.
 %define _libdir /%{_lib}
 %define _udevbasedir /lib/udev
 %define _udevdir %{_udevbasedir}/rules.d
+%if %{with systemd}
+%global _default_pid_dir /run
+%global _default_dm_run_dir /run
+%global _default_run_dir /run/lvm
+%global _default_locking_dir /run/lock/lvm
+%endif
 
 %configure \
   --enable-readline \
@@ -180,38 +224,113 @@ the device-mapper event library.
   --enable-applib \
   --enable-cmdlib \
   --enable-dmeventd \
-  --enable-udev_sync
+  --enable-udev_sync \
+%if %{with systemd}
+  --with-default-dm-run-dir=%{_default_dm_run_dir} \
+  --with-default-run-dir=%{_default_run_dir} \
+  --with-default-pid-dir=%{_default_pid_dir} \
+  --with-default-locking-dir=%{_default_locking_dir} \
+  --enable-dmfilemapd \
+  --enable-lvmpolld \
+  --enable-dbus-service --enable-notify-dbus \
+  --with-cache=internal \
+  --with-writecache=internal \
+  --with-vdo=internal --with-vdo-format=%{_bindir}/vdoformat \
+%endif
+  --disable-silent-rules
 
 make %{?_smp_mflags}
 
+
 %install
 rm -rf $RPM_BUILD_ROOT
 make install DESTDIR=$RPM_BUILD_ROOT
+%if %{with systemd}
+make install_system_dirs DESTDIR=$RPM_BUILD_ROOT
+make install_systemd_units DESTDIR=$RPM_BUILD_ROOT
+make install_systemd_generators DESTDIR=$RPM_BUILD_ROOT
+make install_tmpfiles_configuration DESTDIR=$RPM_BUILD_ROOT
+%else
+mkdir -p -m755 $RPM_BUILD_ROOT/etc/rc.d/init.d
+install -m 0755 scripts/lvm2_monitoring_init_red_hat $RPM_BUILD_ROOT/etc/rc.d/init.d/lvm2-monitor
+%endif
+
 install -m 0700 -d $RPM_BUILD_ROOT/etc/lvm/archive
 install -m 0700 -d $RPM_BUILD_ROOT/etc/lvm/backup
 install -m 0700 -d $RPM_BUILD_ROOT/etc/lvm/cache
 install -m 0700 -d $RPM_BUILD_ROOT/var/lock/lvm
 install -m 0600 /dev/null $RPM_BUILD_ROOT/etc/lvm/cache/.cache
-mkdir -p -m755 $RPM_BUILD_ROOT/etc/rc.d/init.d
-install -m 0755 scripts/lvm2_monitoring_init_red_hat $RPM_BUILD_ROOT/etc/rc.d/init.d/lvm2-monitor
 
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+
 %post
 /sbin/ldconfig
+%if %{with systemd}
+%systemd_post blk-availability.service lvm2-monitor.service
+if [ "$1" = "1" ] ; then
+    # FIXME: what to do with this? We do not want to start it in a container/chroot
+    # enable and start lvm2-monitor.service on completely new installation only, not on upgrades
+    systemctl enable lvm2-monitor.service
+    systemctl start lvm2-monitor.service >/dev/null 2>&1 || :
+fi
+%systemd_post lvm2-lvmpolld.socket
+# lvm2-lvmpolld socket is always enabled and started and ready to serve if lvmpolld is used
+# replace direct systemctl calls with systemd rpm macro once this is provided in the macro:
+# http://cgit.freedesktop.org/systemd/systemd/commit/?id=57ab2eabb8f92fad5239c7d4492e9c6e23ee0678
+systemctl enable lvm2-lvmpolld.socket
+systemctl start lvm2-lvmpolld.socket >/dev/null 2>&1 || :
+%else
 /sbin/chkconfig --add lvm2-monitor
+%endif
 
 %preun
-if [ "$1" = 0 ]; then
+%if %{with systemd}
+%systemd_preun blk-availability.service lvm2-monitor.service
+%systemd_preun lvm2-lvmpolld.service lvm2-lvmpolld.socket
+%else
+if [ "$1" = 0 -o -x /bin/systemctl ]; then
 	/sbin/chkconfig --del lvm2-monitor
 fi
+%endif
+
+%if %{with systemd}
+%postun
+%systemd_postun lvm2-monitor.service
+%systemd_postun_with_restart lvm2-lvmpolld.service
+%endif
 
 %post libs -p /sbin/ldconfig
 
 %postun libs -p /sbin/ldconfig
 
+%if %{with systemd}
+%post dbusd
+%systemd_post lvm2-lvmdbusd.service
+
+%preun dbusd
+%systemd_preun lvm2-lvmdbusd.service
+
+%postun dbusd
+%systemd_postun lvm2-lvmdbusd.service
+
+%post -n device-mapper-event
+%systemd_post dm-event.socket
+# dm-event.socket is always enabled and started and ready to serve if dmeventd is used
+# replace direct systemctl calls with systemd rpm macro once this is provided in the macro:
+# http://cgit.freedesktop.org/systemd/systemd/commit/?id=57ab2eabb8f92fad5239c7d4492e9c6e23ee0678
+systemctl enable dm-event.socket
+systemctl start dm-event.socket >/dev/null 2>&1 || :
+if [ -e %{_default_pid_dir}/dmeventd.pid ]; then
+        %{_sbindir}/dmeventd -R || echo "Failed to restart dmeventd daemon. Please, try manual restart."
+fi
+
+%preun -n device-mapper-event
+%systemd_preun dm-event.service dm-event.socket
+%endif
+
 %post -n device-mapper-libs -p /sbin/ldconfig
 
 %postun -n device-mapper-libs -p /sbin/ldconfig
@@ -339,7 +458,20 @@ fi
 %dir /var/lock/lvm
 %dir /etc/lvm/profile
 /etc/lvm/profile/*.profile
+%if %{with systemd}
+%{_sbindir}/lvmpolld
+%{_mandir}/man8/lvmpolld.8*
+%{_mandir}/man8/lvm2-activation-generator.8*
+%{_tmpfilesdir}/lvm2.conf
+%{_unitdir}/blk-availability.service
+%{_unitdir}/lvm2-lvmpolld.service
+%{_unitdir}/lvm2-lvmpolld.socket
+%{_unitdir}/lvm2-monitor.service
+%{_unitdir}/lvm2-pvscan@.service
+%attr(555, -, -) /lib/systemd/system-generators/lvm2-activation-generator
+%else
 /etc/rc.d/init.d/lvm2-monitor
+%endif
 
 %files devel
 %defattr(-,root,root,-)
@@ -362,13 +494,26 @@ fi
 %{_libdir}/libdevmapper-event-lvm2thin.so
 %{_libdir}/libdevmapper-event-lvm2vdo.so
 
+%if %{with systemd}
+%files dbusd
+%defattr(555,root,root,-)
+%{_sbindir}/lvmdbusd
+%defattr(444,root,root,-)
+%{_sysconfdir}/dbus-1/system.d/com.redhat.lvmdbus1.conf
+%{_datadir}/dbus-1/system-services/com.redhat.lvmdbus1.service
+%{_mandir}/man8/lvmdbusd.8*
+%{_unitdir}/lvm2-lvmdbusd.service
+%dir %{python3_sitelib}/lvmdbusd
+%{python3_sitelib}/lvmdbusd/*
+%endif
+
 %files -n device-mapper
 %defattr(-,root,root,-)
 %license COPYING COPYING.LIB
 %doc WHATS_NEW_DM VERSION_DM README INSTALL udev/12-dm-permissions.rules
 %attr(755,root,root) /sbin/blkdeactivate
 %attr(755,root,root) /sbin/dmsetup
-%attr(755,root,root) /sbin/dmstats
+/sbin/dmstats
 %{_mandir}/man8/blkdeactivate.8.gz
 %{_mandir}/man8/dmsetup.8.gz
 %{_mandir}/man8/dmstats.8.gz
@@ -377,6 +522,10 @@ fi
 %{_udevdir}/10-dm.rules
 %{_udevdir}/13-dm-disk.rules
 %{_udevdir}/95-dm-notify.rules
+%if %{with systemd}
+/sbin/dmfilemapd
+%{_mandir}/man8/dmfilemapd.8*
+%endif
 
 %files -n device-mapper-devel
 %defattr(-,root,root,-)
@@ -391,6 +540,10 @@ fi
 %defattr(-,root,root,-)
 %{_sbindir}/dmeventd
 %{_mandir}/man8/dmeventd.8.gz
+%if %{with systemd}
+%{_unitdir}/dm-event.service
+%{_unitdir}/dm-event.socket
+%endif
 
 %files -n device-mapper-event-libs
 %{_libdir}/libdevmapper-event.so.*
@@ -402,6 +555,9 @@ fi
 /usr%{_libdir}/pkgconfig/devmapper-event.pc
 
 %changelog
+* Wed May 20 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.03.09-2
+- added systemd support (disabled as default).
+
 * Sun Mar 29 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.03.09-1
 - new upstream release.
 - dropped Patch1, 2 and 10.