sys-apps/smartmontools: Revbump to fix bugs #575292 and #580424
authorLars Wendler <polynomial-c@gentoo.org>
Mon, 18 Apr 2016 13:44:31 +0000 (15:44 +0200)
committerLars Wendler <polynomial-c@gentoo.org>
Mon, 18 Apr 2016 13:56:23 +0000 (15:56 +0200)
Don't install drivedb.h into /usr and don't add it to the PM's file
database (#575292). Fix download location of latest drivedb.h file
(#580424).

Package-Manager: portage-2.2.28
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
sys-apps/smartmontools/files/smartd-r1.rc
sys-apps/smartmontools/files/smartmontools-update-drivedb [new file with mode: 0644]
sys-apps/smartmontools/smartmontools-6.4-r1.ebuild [new file with mode: 0644]
sys-apps/smartmontools/smartmontools-9999.ebuild

index 336bc4ea9be994f52d0bb9710d5e9e5ef5c49650..32e12b720b2fb9ea946301ceeab5e1121bdeebfc 100644 (file)
@@ -1,5 +1,5 @@
-#!/sbin/runscript
-# Copyright 1999-2014 Gentoo Foundation
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
diff --git a/sys-apps/smartmontools/files/smartmontools-update-drivedb b/sys-apps/smartmontools/files/smartmontools-update-drivedb
new file mode 100644 (file)
index 0000000..831f1e6
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/usr/sbin/update-smart-drivedb
diff --git a/sys-apps/smartmontools/smartmontools-6.4-r1.ebuild b/sys-apps/smartmontools/smartmontools-6.4-r1.ebuild
new file mode 100644 (file)
index 0000000..9b4bce3
--- /dev/null
@@ -0,0 +1,93 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit flag-o-matic systemd
+if [[ ${PV} == "9999" ]] ; then
+       ESVN_REPO_URI="https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk/smartmontools"
+       ESVN_PROJECT="smartmontools"
+       inherit subversion autotools
+else
+       SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+       KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~x64-macos"
+fi
+
+DESCRIPTION="Self-Monitoring, Analysis and Reporting Technology System (S.M.A.R.T.) monitoring tools"
+HOMEPAGE="https://www.smartmontools.org"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="caps minimal selinux static"
+
+DEPEND="
+       caps? (
+               static? ( sys-libs/libcap-ng[static-libs] )
+               !static? ( sys-libs/libcap-ng )
+       )
+       selinux? (
+               sys-libs/libselinux
+       )"
+RDEPEND="${DEPEND}
+       !minimal? ( virtual/mailx )
+       selinux? ( sec-policy/selinux-smartmon )
+"
+
+src_prepare() {
+       # 580424
+       sed '/^SRCEXPR/s@http:@https:@' \
+               -i update-smart-drivedb.in \
+               || die
+       if [[ ${PV} == "9999" ]] ; then
+               eautoreconf
+       fi
+}
+
+src_configure() {
+       use minimal && einfo "Skipping the monitoring daemon for minimal build."
+       use static && append-ldflags -static
+       # The build installs /etc/init.d/smartd, but we clobber it
+       # in our src_install, so no need to manually delete it.
+       myeconfargs=(
+               --docdir="${EPREFIX}/usr/share/doc/${PF}"
+               --with-drivedbdir=/var/db/${PN} #575292
+               --with-initscriptdir="${EPREFIX}/etc/init.d"
+               $(use_with caps libcap-ng)
+               $(use_with selinux)
+               $(systemd_with_unitdir)
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       if use minimal ; then
+               dosbin smartctl
+               doman smartctl.8
+       else
+               default
+               newinitd "${FILESDIR}"/smartd-r1.rc smartd
+               newconfd "${FILESDIR}"/smartd.confd smartd
+       fi
+
+       # Move drivedb.h file out of PM's sight (bug #575292)
+       mv "${ED}"/var/db/${PN}/drivedb.h "${T}" || die
+
+       exeinto /etc/cron.monthly
+       doexe "${FILESDIR}"/${PN}-update-drivedb
+}
+
+pkg_postinst() {
+       local db_path="/var/db/${PN}"
+
+       if [[ -f "${db_path}/drivedb.h" ]] ; then
+               ewarn "WARNING! The drive database file has been replaced with the version that"
+               ewarn "got shipped with this release of ${PN}. You may want to update the"
+               ewarn "database by running the following command as root:"
+               ewarn ""
+               ewarn "/usr/sbin/update-smart-drivedb"
+       fi
+
+       # Move drivedb.h to /var/db/${PN} (bug #575292)
+       mv "${T}"/drivedb.h ${db_path} || die
+}
index 241fec4f456a5ae6a885125c89cc74a0a071a0ab..9b4bce3b1fa32eb2a17c863bfa8caf3844ed99d1 100644 (file)
@@ -1,8 +1,8 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-EAPI="4"
+EAPI=5
 
 inherit flag-o-matic systemd
 if [[ ${PV} == "9999" ]] ; then
@@ -11,17 +11,21 @@ if [[ ${PV} == "9999" ]] ; then
        inherit subversion autotools
 else
        SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
-       KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~arm-linux ~ia64-linux ~x86-freebsd ~x86-linux ~x64-macos"
+       KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~x64-macos"
 fi
 
 DESCRIPTION="Self-Monitoring, Analysis and Reporting Technology System (S.M.A.R.T.) monitoring tools"
-HOMEPAGE="http://smartmontools.sourceforge.net/"
+HOMEPAGE="https://www.smartmontools.org"
 
 LICENSE="GPL-2"
 SLOT="0"
 IUSE="caps minimal selinux static"
 
-DEPEND="caps? ( sys-libs/libcap-ng )
+DEPEND="
+       caps? (
+               static? ( sys-libs/libcap-ng[static-libs] )
+               !static? ( sys-libs/libcap-ng )
+       )
        selinux? (
                sys-libs/libselinux
        )"
@@ -31,8 +35,11 @@ RDEPEND="${DEPEND}
 "
 
 src_prepare() {
+       # 580424
+       sed '/^SRCEXPR/s@http:@https:@' \
+               -i update-smart-drivedb.in \
+               || die
        if [[ ${PV} == "9999" ]] ; then
-               #./autogen.sh
                eautoreconf
        fi
 }
@@ -42,12 +49,15 @@ src_configure() {
        use static && append-ldflags -static
        # The build installs /etc/init.d/smartd, but we clobber it
        # in our src_install, so no need to manually delete it.
-       econf \
-               --docdir="${EPREFIX}/usr/share/doc/${PF}" \
-               --with-initscriptdir="${EPREFIX}/etc/init.d" \
-               $(use_with caps libcap-ng) \
-               $(use_with selinux) \
+       myeconfargs=(
+               --docdir="${EPREFIX}/usr/share/doc/${PF}"
+               --with-drivedbdir=/var/db/${PN} #575292
+               --with-initscriptdir="${EPREFIX}/etc/init.d"
+               $(use_with caps libcap-ng)
+               $(use_with selinux)
                $(systemd_with_unitdir)
+       )
+       econf "${myeconfargs[@]}"
 }
 
 src_install() {
@@ -59,4 +69,25 @@ src_install() {
                newinitd "${FILESDIR}"/smartd-r1.rc smartd
                newconfd "${FILESDIR}"/smartd.confd smartd
        fi
+
+       # Move drivedb.h file out of PM's sight (bug #575292)
+       mv "${ED}"/var/db/${PN}/drivedb.h "${T}" || die
+
+       exeinto /etc/cron.monthly
+       doexe "${FILESDIR}"/${PN}-update-drivedb
+}
+
+pkg_postinst() {
+       local db_path="/var/db/${PN}"
+
+       if [[ -f "${db_path}/drivedb.h" ]] ; then
+               ewarn "WARNING! The drive database file has been replaced with the version that"
+               ewarn "got shipped with this release of ${PN}. You may want to update the"
+               ewarn "database by running the following command as root:"
+               ewarn ""
+               ewarn "/usr/sbin/update-smart-drivedb"
+       fi
+
+       # Move drivedb.h to /var/db/${PN} (bug #575292)
+       mv "${T}"/drivedb.h ${db_path} || die
 }