Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/smartmontools/
Date: Tue, 31 Oct 2017 21:55:22
Message-Id: 1509486898.2e30c20f28ed66d57cc2af664acd7a0fcc0cc853.whissi@gentoo
1 commit: 2e30c20f28ed66d57cc2af664acd7a0fcc0cc853
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 31 21:54:58 2017 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 31 21:54:58 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e30c20f
7
8 sys-apps/smartmontools: Update live ebuild
9
10 Incorporate changes from commit ad8950f967e37dcff1fb1ab9fcd2e0b4001b0a69.
11
12 Package-Manager: Portage-2.3.13, Repoman-2.3.4
13
14 sys-apps/smartmontools/smartmontools-9999.ebuild | 115 ++++++++++++++++-------
15 1 file changed, 80 insertions(+), 35 deletions(-)
16
17 diff --git a/sys-apps/smartmontools/smartmontools-9999.ebuild b/sys-apps/smartmontools/smartmontools-9999.ebuild
18 index dfe72e1dfdd..499584db4c3 100644
19 --- a/sys-apps/smartmontools/smartmontools-9999.ebuild
20 +++ b/sys-apps/smartmontools/smartmontools-9999.ebuild
21 @@ -1,13 +1,13 @@
22 # Copyright 1999-2017 Gentoo Foundation
23 # Distributed under the terms of the GNU General Public License v2
24
25 -EAPI=5
26 +EAPI="6"
27
28 -inherit flag-o-matic systemd
29 +inherit autotools flag-o-matic systemd
30 if [[ ${PV} == "9999" ]] ; then
31 ESVN_REPO_URI="https://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools"
32 ESVN_PROJECT="smartmontools"
33 - inherit subversion autotools
34 + inherit subversion
35 else
36 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
37 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos"
38 @@ -18,29 +18,41 @@ HOMEPAGE="https://www.smartmontools.org"
39
40 LICENSE="GPL-2"
41 SLOT="0"
42 -IUSE="caps minimal selinux static update_drivedb"
43 +IUSE="caps +daemon selinux static update_drivedb"
44
45 DEPEND="
46 caps? (
47 static? ( sys-libs/libcap-ng[static-libs] )
48 !static? ( sys-libs/libcap-ng )
49 )
50 + kernel_FreeBSD? (
51 + sys-freebsd/freebsd-lib[usb]
52 + )
53 selinux? (
54 sys-libs/libselinux
55 )"
56 RDEPEND="${DEPEND}
57 - !minimal? ( virtual/mailx )
58 + daemon? ( virtual/mailx )
59 selinux? ( sec-policy/selinux-smartmon )
60 + update_drivedb? (
61 + || (
62 + net-misc/curl
63 + net-misc/wget
64 + www-client/lynx
65 + dev-vcs/subversion
66 + )
67 + )
68 "
69
70 +REQUIRED_USE="( caps? ( daemon ) )"
71 +
72 src_prepare() {
73 - if [[ ${PV} == "9999" ]] ; then
74 - eautoreconf
75 - fi
76 + default
77 +
78 + eautoreconf
79 }
80
81 src_configure() {
82 - use minimal && einfo "Skipping the monitoring daemon for minimal build."
83 use static && append-ldflags -static
84 # The build installs /etc/init.d/smartd, but we clobber it
85 # in our src_install, so no need to manually delete it.
86 @@ -50,7 +62,7 @@ src_configure() {
87 --with-initscriptdir="${EPREFIX}/etc/init.d"
88 $(use_with caps libcap-ng)
89 $(use_with selinux)
90 - $(systemd_with_unitdir)
91 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
92 $(use_with update_drivedb update-smart-drivedb)
93 )
94 econf "${myeconfargs[@]}"
95 @@ -59,45 +71,78 @@ src_configure() {
96 src_install() {
97 local db_path="/var/db/${PN}"
98
99 - if use minimal ; then
100 - dosbin smartctl
101 - doman smartctl.8
102 - else
103 + if use daemon; then
104 default
105 +
106 newinitd "${FILESDIR}"/smartd-r1.rc smartd
107 newconfd "${FILESDIR}"/smartd.confd smartd
108 + systemd_newunit "${FILESDIR}"/smartd.systemd smartd.service
109 + else
110 + dosbin smartctl
111 + doman smartctl.8
112
113 - keepdir "${db_path}"
114 - if use update_drivedb ; then
115 - # Move drivedb.h file out of PM's sight (bug #575292)
116 - mv "${ED}${db_path}/drivedb.h" "${T}" || die
117 + local DOCS=( AUTHORS ChangeL* COPYING INSTALL NEWS README TODO )
118 + einstalldocs
119 + fi
120
121 - exeinto /etc/cron.monthly
122 - doexe "${FILESDIR}/${PN}-update-drivedb"
123 + if use update_drivedb ; then
124 + if ! use daemon; then
125 + dosbin "${S}"/update-smart-drivedb
126 fi
127 +
128 + exeinto /etc/cron.monthly
129 + doexe "${FILESDIR}/${PN}-update-drivedb"
130 fi
131 +
132 + if use daemon || use update_drivedb; then
133 + keepdir "${db_path}"
134 +
135 + # Install a copy of the initial drivedb.h to /usr/share/${PN}
136 + # so that we can access that file later in pkg_postinst
137 + # even when dealing with binary packages (bug #575292)
138 + insinto /usr/share/${PN}
139 + doins "${S}"/drivedb.h
140 + fi
141 +
142 + # Make sure we never install drivedb.h into the db location
143 + # of the acutal image so we don't record hashes because user
144 + # can modify that file
145 + rm -f "${ED%/}${db_path}/drivedb.h" || die
146 +
147 + # Bug #622072
148 + find "${ED%/}"/usr/share/doc -type f -exec chmod a-x '{}' \; || die
149 }
150
151 pkg_postinst() {
152 - if ! use minimal ; then
153 - local db_path="/var/db/${PN}"
154 + if use daemon || use update_drivedb; then
155 + local initial_db_file="${EPREFIX%/}/usr/share/${PN}/drivedb.h"
156 + local db_path="${EPREFIX%/}/var/db/${PN}"
157
158 - if [[ -f "${db_path}/drivedb.h" ]] ; then
159 - ewarn "WARNING! The existing copy of the drive database has been replaced with the version that"
160 - ewarn "was shipped with this release of ${PN}. You may want to update the"
161 - ewarn "database by: "
162 + if [[ ! -f "${db_path}/drivedb.h" ]] ; then
163 + # No initial database found
164 + cp "${initial_db_file}" "${db_path}" || die
165 + einfo "Default drive database which was shipped with this release of ${PN}"
166 + einfo "has been installed to '${db_path}'."
167 + else
168 + ewarn "WARNING: There's already a drive database in '${db_path}'!"
169 + ewarn "Because we cannot determine if this database is untouched"
170 + ewarn "or was modified by the user you have to manually update the"
171 + ewarn "drive database:"
172 + ewarn ""
173 + ewarn "a) Replace '${db_path}/drivedb.h' by the database shipped with this"
174 + ewarn " release which can be found in '${initial_db_file}', i.e."
175 + ewarn ""
176 + ewarn " cp \"${initial_db_file}\" \"${db_path}\""
177 + ewarn ""
178 + ewarn "b) Run the following command as root:"
179 + ewarn ""
180 + ewarn " /usr/sbin/update-smart-drivedb"
181
182 if ! use update_drivedb ; then
183 - ewarn "re-merging ${PN} with USE='update_drivedb', then"
184 + ewarn ""
185 + ewarn "However, 'update-smart-drivedb' requires that you re-emerge ${PN}"
186 + ewarn "with USE='update_drivedb'."
187 fi
188 - ewarn "running the following command as root:"
189 - ewarn ""
190 - ewarn "/usr/sbin/update-smart-drivedb"
191 - fi
192 -
193 - if use update_drivedb ; then
194 - # Move drivedb.h to /var/db/${PN} (bug #575292)
195 - mv "${T}"/drivedb.h "${db_path}" || die
196 fi
197 fi
198 }