]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/commitdiff
smartmontools: Rework package.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 12 Oct 2016 12:40:01 +0000 (14:40 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Oct 2016 17:30:01 +0000 (18:30 +0100)
* Enable useage of libcap-ng.
* Drop support for SELinux.
* Replace hardcoded path values.
* Enable testsuite.
* Add scriptlet for systemd.

Fixes #11229.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
smartmontools/smartmontools.nm

index 222d5d94e6b0e3495d864cd64a556d29c952446e..9e8537582bf75d70834df07c5566fe310ed0649b 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = smartmontools
 version    = 6.5
-release    = 1
+release    = 2
 
 groups     = System/Statistics
 url        = http://smartmontools.sourceforge.net/
@@ -13,11 +13,11 @@ license    = GPLv2
 summary    = A set of tools that watches HDD S.M.A.R.T status.
 
 description
-       The smartmontools package contains two utility programs (smartctl \
-       and smartd) to control and monitor storage systems using the \
-       Self-Monitoring, Analysis and Reporting Technology System (SMART) \
-       built into most modern ATA and SCSI harddisks. In many cases, \
-       these utilities will provide advanced warning of disk degradation \
+       The smartmontools package contains two utility programs (smartctl
+       and smartd) to control and monitor storage systems using the
+       Self-Monitoring, Analysis and Reporting Technology System (SMART)
+       built into most modern ATA and SCSI harddisks. In many cases,
+       these utilities will provide advanced warning of disk degradation
        and failure.
 end
 
@@ -26,21 +26,56 @@ source_dl  = http://sourceforge.net/projects/smartmontools/files/smartmontools/%
 build
        requires
                gcc-c++
-               libselinux-devel
+               libcap-ng-devel
        end
 
        configure_options += \
-               --mandir=/usr/share/man \
-               --sysconfdir=/etc \
-               --with-selinux
+               --mandir=%{mandir} \
+               --sysconfdir=%{sysconfdir}/%{name} \
+               --with-libcap-ng=yes \
+               --with-systemdsystemunitdir=%{unitdir}
+
+       test
+               make check
+       end
 
        install_cmds
+               # Drop old sysvinit script.
                rm -rvf %{BUILDROOT}/etc/rc.d
+
+               # Fix sysconfig path in systemd file.
+               sed -i 's|/etc/smartmontools/sysconfig|/etc/sysconfig|g' \
+                       %{BUILDROOT}%{unitdir}/smartd.service
        end
 end
 
 packages
        package %{name}
+               configfiles
+                       %{sysconfdir}/smartmontools/smartd.conf
+               end
+
+               prerequires
+                       systemd-units
+               end
+
+               script postin
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script preun
+                       systemctl --no-reload disable smartd.service >/dev/null 2>&1 || :
+                       systemctl stop smartd.service >/dev/null 2>&1 || :
+               end
+
+               script postun
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script postup
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+                       systemctl try-restart smartd.service >/dev/null 2>&1 || :
+               end
        end
 
        package %{name}-debuginfo