Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/smartmontools/
Date: Mon, 31 Dec 2018 10:39:18
Message-Id: 1546252744.58c7d390241abcd498e86f62f2b9183ade7f35e4.polynomial-c@gentoo
commit:     58c7d390241abcd498e86f62f2b9183ade7f35e4
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 31 10:36:35 2018 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Mon Dec 31 10:39:04 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=58c7d390

sys-apps/smartmontools: Bump to version 7.0

Package-Manager: Portage-2.3.53, Repoman-2.3.12
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 sys-apps/smartmontools/Manifest                 |   1 +
 sys-apps/smartmontools/smartmontools-7.0.ebuild | 151 ++++++++++++++++++++++++
 2 files changed, 152 insertions(+)

diff --git a/sys-apps/smartmontools/Manifest b/sys-apps/smartmontools/Manifest
index a027c49ebfb..4637fa2c24a 100644
--- a/sys-apps/smartmontools/Manifest
+++ b/sys-apps/smartmontools/Manifest
@@ -1,3 +1,4 @@
 DIST smartmontools-6.4.tar.gz 822539 BLAKE2B be76ec24cf24b2388a77758a1df5b5b9b19bd455dda26df6c13184051a51feeb0baf164265fcfe15b1d2ac41767d546109dea53cd7ac290d02f6e03b44da454f SHA512 366cd55ec668da1ca8a3d9ba79d5bee6e0c59032936b7f2f161f8fbb1c9f869c505d715cc10562b6241f808bb8b534feaf9d9fd752f6cb1593ee893611742adc
 DIST smartmontools-6.5.tar.gz 855642 BLAKE2B 25f78de8fd58497cf052e75aef746c15af8d56d2694007c1d6e2f8e31cae3b517babfc52ef73d3ae4bc5104a49e4bac16a48f23f3b3145228997bef0aad823dd SHA512 dca7a6363ab7280ee4197155025f624c978886dcc94fc47b524f6f849138b62c471e966c0d4bf59c7bba50519dc122264618e5ded80a406863ddd10b43d928d3
 DIST smartmontools-6.6.tar.gz 903847 BLAKE2B 6c18884cf763c146abceed47587de0e77cd434673df6a17e4527d160f06a5a8762e6ae490fc5ed13a33f819ba23c1924b49dd13620f4a51e6a40dac20a217523 SHA512 64bb533dac29f62ddd662a16a12c97df1af9cbac9ac526ce7af0b3bff9da49cf265a2030d91a7160452b56a67e80d7f34c9b4e45bbb320114f55695e2cb5cfaf
+DIST smartmontools-7.0.tar.gz 944925 BLAKE2B 41b3894efa05471bf358fca4ba87a765e3a54df68c9a617804a9e0853752c57b68fdbaa9d55fa1462a8fa7de1d6cb5630c66929dfe521be38b180944cb80acc9 SHA512 96e18a201182579f699d541539ce393e7bc2191e027cfdf7f87455a63da3a14451574f8fe391232047ac941ace453a017193d0a4987a4edb8f7ed9d5007f0512

diff --git a/sys-apps/smartmontools/smartmontools-7.0.ebuild b/sys-apps/smartmontools/smartmontools-7.0.ebuild
new file mode 100644
index 00000000000..46b1cf2cff3
--- /dev/null
+++ b/sys-apps/smartmontools/smartmontools-7.0.ebuild
@@ -0,0 +1,151 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit autotools flag-o-matic systemd
+if [[ ${PV} == "9999" ]] ; then
+	ESVN_REPO_URI="https://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools"
+	ESVN_PROJECT="smartmontools"
+	inherit subversion
+else
+	SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos"
+fi
+
+DESCRIPTION="Tools to monitor storage systems to provide advanced warning of disk degradation"
+HOMEPAGE="https://www.smartmontools.org"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="caps +daemon selinux static systemd update_drivedb"
+
+DEPEND="
+	caps? (
+		static? ( sys-libs/libcap-ng[static-libs] )
+		!static? ( sys-libs/libcap-ng )
+	)
+	kernel_FreeBSD? (
+		sys-freebsd/freebsd-lib[usb]
+	)
+	selinux? (
+		sys-libs/libselinux
+	)"
+RDEPEND="${DEPEND}
+	daemon? ( virtual/mailx )
+	selinux? ( sec-policy/selinux-smartmon )
+	systemd? ( sys-apps/systemd )
+	update_drivedb? (
+		app-crypt/gnupg
+		|| (
+			net-misc/curl
+			net-misc/wget
+			www-client/lynx
+			dev-vcs/subversion
+		)
+	)
+"
+
+REQUIRED_USE="( caps? ( daemon ) )"
+
+src_prepare() {
+	default
+	eautoreconf
+}
+
+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.
+	myeconfargs=(
+		--with-drivedbdir="${EPREFIX}/var/db/${PN}" #575292
+		--with-initscriptdir="${EPREFIX}/etc/init.d"
+		#--with-smartdscriptdir="${EPREFIX}/usr/share/${PN}"
+		$(use_with caps libcap-ng)
+		$(use_with selinux)
+		$(use_with systemd libsystemd)
+		$(use_with update_drivedb gnupg)
+		$(use_with update_drivedb update-smart-drivedb)
+		$(usex systemd "--with-systemdsystemunitdir=$(systemd_get_systemunitdir)" '')
+	)
+	econf "${myeconfargs[@]}"
+}
+
+src_install() {
+	local db_path="/var/db/${PN}"
+
+	if use daemon; then
+		default
+
+		newinitd "${FILESDIR}"/smartd-r1.rc smartd
+		newconfd "${FILESDIR}"/smartd.confd smartd
+		systemd_newunit "${FILESDIR}"/smartd.systemd smartd.service
+	else
+		dosbin smartctl
+		doman smartctl.8
+
+		local DOCS=( AUTHORS ChangeL* COPYING INSTALL NEWS README TODO )
+		einstalldocs
+	fi
+
+	if use update_drivedb ; then
+		if ! use daemon; then
+			dosbin "${S}"/update-smart-drivedb
+		fi
+
+		exeinto /etc/cron.monthly
+		doexe "${FILESDIR}/${PN}-update-drivedb"
+	fi
+
+	if use daemon || use update_drivedb; then
+		keepdir "${db_path}"
+
+		# Install a copy of the initial drivedb.h to /usr/share/${PN}
+		# so that we can access that file later in pkg_postinst
+		# even when dealing with binary packages (bug #575292)
+		insinto /usr/share/${PN}
+		doins "${S}"/drivedb.h
+	fi
+
+	# Make sure we never install drivedb.h into the db location
+	# of the acutal image so we don't record hashes because user
+	# can modify that file
+	rm -f "${ED%/}${db_path}/drivedb.h" || die
+
+	# Bug #622072
+	find "${ED%/}"/usr/share/doc -type f -exec chmod a-x '{}' \; || die
+}
+
+pkg_postinst() {
+	if use daemon || use update_drivedb; then
+		local initial_db_file="${EPREFIX%/}/usr/share/${PN}/drivedb.h"
+		local db_path="${EPREFIX%/}/var/db/${PN}"
+
+		if [[ ! -f "${db_path}/drivedb.h" ]] ; then
+			# No initial database found
+			cp "${initial_db_file}" "${db_path}" || die
+			einfo "Default drive database which was shipped with this release of ${PN}"
+			einfo "has been installed to '${db_path}'."
+		else
+			ewarn "WARNING: There's already a drive database in '${db_path}'!"
+			ewarn "Because we cannot determine if this database is untouched"
+			ewarn "or was modified by the user you have to manually update the"
+			ewarn "drive database:"
+			ewarn ""
+			ewarn "a) Replace '${db_path}/drivedb.h' by the database shipped with this"
+			ewarn "   release which can be found in '${initial_db_file}', i.e."
+			ewarn ""
+			ewarn "     cp \"${initial_db_file}\" \"${db_path}\""
+			ewarn ""
+			ewarn "b) Run the following command as root:"
+			ewarn ""
+			ewarn "     /usr/sbin/update-smart-drivedb"
+
+			if ! use update_drivedb ; then
+				ewarn ""
+				ewarn "However, 'update-smart-drivedb' requires that you re-emerge ${PN}"
+				ewarn "with USE='update_drivedb'."
+			fi
+		fi
+	fi
+}