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/files/, sys-apps/smartmontools/
Date: Tue, 31 Oct 2017 21:53:24
Message-Id: 1509486776.ad8950f967e37dcff1fb1ab9fcd2e0b4001b0a69.whissi@gentoo
1 commit: ad8950f967e37dcff1fb1ab9fcd2e0b4001b0a69
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 31 21:51:15 2017 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 31 21:52:56 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad8950f9
7
8 sys-apps/smartmontools: Rev bump to address several problems
9
10 - EAPI updated to EAPI 6.
11
12 - Depend on sys-freebsd/freebsd-lib[usb] on FreeBSD. (bug #552054)
13
14 - Update smartd systemd service to reflect that we don't provide a general
15 config file for the service. Users are supposed to overwrite the
16 provided service if they want to pass additional
17 parameters. (bug #527648)
18
19 - We no longer install executable files in /usr/share/{PN}. (bug #622072)
20
21 - "minimal" USE flag was replaced by "daemon" USE flag to better indicate
22 what the USE flag does.
23
24 - "caps" USE flag now requires "daemon" USE flag.
25
26 - It is now possible to use the "update_drivedb" USE flag
27 alone (i.e. without the "minimal", now "daemon" USE flag). (bug #635700)
28
29 - The drive database logic was rewritten: Per default we try to install
30 the drive database shipped with the package. If there's already a drive
31 database installed we will not replace the database anymore in
32 assumption that the user has updated the database in the meantime and
33 want to preserve the changes.
34 A warning will be displayed in this case with an instruction how to
35 update or restore the default drive database shipped with the package.
36 The new logic now also works when using binary packages. (bug #575292)
37
38 - RDEPENDs on net-misc/curl, net-misc/wget, www-client/lynx and
39 dev-vcs/subversion (just one of them is required!) were added when using
40 "update_drivedb" USE flag.
41
42 Closes: https://bugs.gentoo.org/552054
43 Closes: https://bugs.gentoo.org/527648
44 Closes: https://bugs.gentoo.org/622072
45 Closes: https://bugs.gentoo.org/635700
46 Closes: https://bugs.gentoo.org/575292
47 Package-Manager: Portage-2.3.13, Repoman-2.3.4
48
49 sys-apps/smartmontools/files/smartd.systemd | 11 ++
50 sys-apps/smartmontools/metadata.xml | 2 +
51 sys-apps/smartmontools/smartmontools-6.5-r1.ebuild | 148 +++++++++++++++++++++
52 3 files changed, 161 insertions(+)
53
54 diff --git a/sys-apps/smartmontools/files/smartd.systemd b/sys-apps/smartmontools/files/smartd.systemd
55 new file mode 100644
56 index 00000000000..bdcbdbbe306
57 --- /dev/null
58 +++ b/sys-apps/smartmontools/files/smartd.systemd
59 @@ -0,0 +1,11 @@
60 +[Unit]
61 +Description=Self Monitoring and Reporting Technology (SMART) Daemon
62 +Documentation=man:smartd(8) man:smartd.conf(5)
63 +
64 +[Service]
65 +ExecStart=/usr/sbin/smartd -n
66 +ExecReload=/bin/kill -HUP $MAINPID
67 +StandardOutput=syslog
68 +
69 +[Install]
70 +WantedBy=multi-user.target
71
72 diff --git a/sys-apps/smartmontools/metadata.xml b/sys-apps/smartmontools/metadata.xml
73 index b3555884800..0ae4667bf8d 100644
74 --- a/sys-apps/smartmontools/metadata.xml
75 +++ b/sys-apps/smartmontools/metadata.xml
76 @@ -6,6 +6,8 @@
77 <name>Gentoo Base System</name>
78 </maintainer>
79 <use>
80 + <flag name="caps">Build against <pkg>sys-libs/libcap-ng</pkg> to allow smartd to drop its privileges.</flag>
81 + <flag name="daemon">Install the monitoring daemon (smartd) and associated scripts.</flag>
82 <flag name="minimal">Do not install the monitoring daemon and associated scripts.</flag>
83 <flag name="update_drivedb">Install a script to update the drivedb file.</flag>
84 </use>
85
86 diff --git a/sys-apps/smartmontools/smartmontools-6.5-r1.ebuild b/sys-apps/smartmontools/smartmontools-6.5-r1.ebuild
87 new file mode 100644
88 index 00000000000..499584db4c3
89 --- /dev/null
90 +++ b/sys-apps/smartmontools/smartmontools-6.5-r1.ebuild
91 @@ -0,0 +1,148 @@
92 +# Copyright 1999-2017 Gentoo Foundation
93 +# Distributed under the terms of the GNU General Public License v2
94 +
95 +EAPI="6"
96 +
97 +inherit autotools flag-o-matic systemd
98 +if [[ ${PV} == "9999" ]] ; then
99 + ESVN_REPO_URI="https://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools"
100 + ESVN_PROJECT="smartmontools"
101 + inherit subversion
102 +else
103 + SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
104 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~x64-macos"
105 +fi
106 +
107 +DESCRIPTION="Tools to monitor storage systems to provide advanced warning of disk degradation"
108 +HOMEPAGE="https://www.smartmontools.org"
109 +
110 +LICENSE="GPL-2"
111 +SLOT="0"
112 +IUSE="caps +daemon selinux static update_drivedb"
113 +
114 +DEPEND="
115 + caps? (
116 + static? ( sys-libs/libcap-ng[static-libs] )
117 + !static? ( sys-libs/libcap-ng )
118 + )
119 + kernel_FreeBSD? (
120 + sys-freebsd/freebsd-lib[usb]
121 + )
122 + selinux? (
123 + sys-libs/libselinux
124 + )"
125 +RDEPEND="${DEPEND}
126 + daemon? ( virtual/mailx )
127 + selinux? ( sec-policy/selinux-smartmon )
128 + update_drivedb? (
129 + || (
130 + net-misc/curl
131 + net-misc/wget
132 + www-client/lynx
133 + dev-vcs/subversion
134 + )
135 + )
136 +"
137 +
138 +REQUIRED_USE="( caps? ( daemon ) )"
139 +
140 +src_prepare() {
141 + default
142 +
143 + eautoreconf
144 +}
145 +
146 +src_configure() {
147 + use static && append-ldflags -static
148 + # The build installs /etc/init.d/smartd, but we clobber it
149 + # in our src_install, so no need to manually delete it.
150 + myeconfargs=(
151 + --docdir="${EPREFIX}/usr/share/doc/${PF}"
152 + --with-drivedbdir="${EPREFIX}/var/db/${PN}" #575292
153 + --with-initscriptdir="${EPREFIX}/etc/init.d"
154 + $(use_with caps libcap-ng)
155 + $(use_with selinux)
156 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
157 + $(use_with update_drivedb update-smart-drivedb)
158 + )
159 + econf "${myeconfargs[@]}"
160 +}
161 +
162 +src_install() {
163 + local db_path="/var/db/${PN}"
164 +
165 + if use daemon; then
166 + default
167 +
168 + newinitd "${FILESDIR}"/smartd-r1.rc smartd
169 + newconfd "${FILESDIR}"/smartd.confd smartd
170 + systemd_newunit "${FILESDIR}"/smartd.systemd smartd.service
171 + else
172 + dosbin smartctl
173 + doman smartctl.8
174 +
175 + local DOCS=( AUTHORS ChangeL* COPYING INSTALL NEWS README TODO )
176 + einstalldocs
177 + fi
178 +
179 + if use update_drivedb ; then
180 + if ! use daemon; then
181 + dosbin "${S}"/update-smart-drivedb
182 + fi
183 +
184 + exeinto /etc/cron.monthly
185 + doexe "${FILESDIR}/${PN}-update-drivedb"
186 + fi
187 +
188 + if use daemon || use update_drivedb; then
189 + keepdir "${db_path}"
190 +
191 + # Install a copy of the initial drivedb.h to /usr/share/${PN}
192 + # so that we can access that file later in pkg_postinst
193 + # even when dealing with binary packages (bug #575292)
194 + insinto /usr/share/${PN}
195 + doins "${S}"/drivedb.h
196 + fi
197 +
198 + # Make sure we never install drivedb.h into the db location
199 + # of the acutal image so we don't record hashes because user
200 + # can modify that file
201 + rm -f "${ED%/}${db_path}/drivedb.h" || die
202 +
203 + # Bug #622072
204 + find "${ED%/}"/usr/share/doc -type f -exec chmod a-x '{}' \; || die
205 +}
206 +
207 +pkg_postinst() {
208 + if use daemon || use update_drivedb; then
209 + local initial_db_file="${EPREFIX%/}/usr/share/${PN}/drivedb.h"
210 + local db_path="${EPREFIX%/}/var/db/${PN}"
211 +
212 + if [[ ! -f "${db_path}/drivedb.h" ]] ; then
213 + # No initial database found
214 + cp "${initial_db_file}" "${db_path}" || die
215 + einfo "Default drive database which was shipped with this release of ${PN}"
216 + einfo "has been installed to '${db_path}'."
217 + else
218 + ewarn "WARNING: There's already a drive database in '${db_path}'!"
219 + ewarn "Because we cannot determine if this database is untouched"
220 + ewarn "or was modified by the user you have to manually update the"
221 + ewarn "drive database:"
222 + ewarn ""
223 + ewarn "a) Replace '${db_path}/drivedb.h' by the database shipped with this"
224 + ewarn " release which can be found in '${initial_db_file}', i.e."
225 + ewarn ""
226 + ewarn " cp \"${initial_db_file}\" \"${db_path}\""
227 + ewarn ""
228 + ewarn "b) Run the following command as root:"
229 + ewarn ""
230 + ewarn " /usr/sbin/update-smart-drivedb"
231 +
232 + if ! use update_drivedb ; then
233 + ewarn ""
234 + ewarn "However, 'update-smart-drivedb' requires that you re-emerge ${PN}"
235 + ewarn "with USE='update_drivedb'."
236 + fi
237 + fi
238 + fi
239 +}