diff options
Diffstat (limited to 'sys-apps/smartmontools')
-rw-r--r-- | sys-apps/smartmontools/Manifest | 2 | ||||
-rw-r--r-- | sys-apps/smartmontools/files/smartmontools-6.6-set-broadcast-nsid.patch | 104 | ||||
-rw-r--r-- | sys-apps/smartmontools/smartmontools-6.6-r1.ebuild | 155 |
3 files changed, 261 insertions, 0 deletions
diff --git a/sys-apps/smartmontools/Manifest b/sys-apps/smartmontools/Manifest index dca3c94d6e61..85078a0d5fdc 100644 --- a/sys-apps/smartmontools/Manifest +++ b/sys-apps/smartmontools/Manifest @@ -2,6 +2,7 @@ AUX smartd-r1.rc 614 BLAKE2B ec80520e3c8762e39d89eadc63e16bb9d9d4f7dec84507faeba AUX smartd.confd 107 BLAKE2B fe687733a13f7a9c32aee16a759feef798fe7db158783497c6cc0ccba2baaff7cf48acffea0a4becb47d470c691855a046617d3f8e934eeebd54df7030ef4877 SHA512 ff45462944f01c0e7cac99443078b253dcbaed4f99ffab85052b12361d9eec4beec81cab334fbede9148b3dd503d5205add32ef4327a788f02a8b1e37f460437 AUX smartd.systemd 258 BLAKE2B 9aadec117adeacff070f127ff34df520d5deebe152d0a72e34f36a34b267f854c52640644b285c57de460c7b91f5fb54a5e1c704706540fd5813ed1954f74e7d SHA512 73c49bca755adf0ff1c6ccd221de0fd2bb7804250968fbcb3799e19c66dacc85a6c7a3e0d1eecea683f57d6a3ff01fbd4b4fc47b0eab5747006f0edc21876a7c AUX smartmontools-6.6-fix-build-on-musl.patch 416 BLAKE2B 3c7eec408c3ea346ebad3df77e8b2beb89e2565c61d7b85c69404d354b662ee0679389b10cfb110728d99b8df8434a590865a4bb2b46c1ce108ca635dd2a6ebc SHA512 cf2ec3c0366c5ec79cccbe181b4dfed74f051d2236e851f81125e57f7893221a3e311c46556a8854c7c50ee6378d34c917089a90fcb6c3e07cc0c0716085540d +AUX smartmontools-6.6-set-broadcast-nsid.patch 4217 BLAKE2B 27225c052a13c22d031450f9ed700e5f5295738644a91802c86e1d9f6938fd17b150eff028ec4aa79fdd3cf927697dbe1d0d55f57ce48df850ce335e2497c24b SHA512 8abaa33749f70049f3c28ac09f915ccd37081cc7ca8ee63325eecd78d038842c2cce300f277279614b5b1d6d336c343f7512b21c51d73953f4b3921976642a3e AUX smartmontools-update-drivedb 42 BLAKE2B d3a501dc6a3855bd665a16ce0f105269754a29450201f312369acdbf429c8e0c7c4162de8854ca945b2082cb734dbbbb1326df39e4fb1adf271f215329bd2105 SHA512 8ad70fc85ab67b7c32eda95dd37517382c2447862df08b810a54dcdedb1eb8148f3a0e29f402a54adff31d1e88d80d09a258ed9e1e13b597ab2a358ebeda0ce8 DIST smartmontools-6.4.tar.gz 822539 BLAKE2B be76ec24cf24b2388a77758a1df5b5b9b19bd455dda26df6c13184051a51feeb0baf164265fcfe15b1d2ac41767d546109dea53cd7ac290d02f6e03b44da454f SHA512 366cd55ec668da1ca8a3d9ba79d5bee6e0c59032936b7f2f161f8fbb1c9f869c505d715cc10562b6241f808bb8b534feaf9d9fd752f6cb1593ee893611742adc DIST smartmontools-6.5.tar.gz 855642 BLAKE2B 25f78de8fd58497cf052e75aef746c15af8d56d2694007c1d6e2f8e31cae3b517babfc52ef73d3ae4bc5104a49e4bac16a48f23f3b3145228997bef0aad823dd SHA512 dca7a6363ab7280ee4197155025f624c978886dcc94fc47b524f6f849138b62c471e966c0d4bf59c7bba50519dc122264618e5ded80a406863ddd10b43d928d3 @@ -9,6 +10,7 @@ DIST smartmontools-6.6.tar.gz 903847 BLAKE2B 6c18884cf763c146abceed47587de0e77cd EBUILD smartmontools-6.4-r1.ebuild 2534 BLAKE2B 3395b22b8bdd26c78404016cbb5f48a91b9858ffbff70ae3ca486fc3d32ca9603cbd752111693691a91b5c04982f07987391745514af782bf31d4644d8314223 SHA512 1b0d02e5d4a493cd7926a93c92b3b78951f3580228ca19864113dbb09f12ce936866d50d528bdfb66f94b88b8f99660fa5d7181a81008b4badfaa7ef362a187c EBUILD smartmontools-6.4.ebuild 1639 BLAKE2B 103e33da5b3605be940863b879ab2a4859036c3ce1206052b08cd9f0f88acca4d3f56513049a24ac57dcbd2e3c2413fdfcf4dc973fc19645c735feb2063ba122 SHA512 c9b07c80d4e4355bc2c4ebce895efe35ed70d5a31eab3eb8298c1cc947a42cb1c4bb81d57cb46816619580067aeec246f49bc581a788abb7c912d0ef898f8448 EBUILD smartmontools-6.5-r1.ebuild 4043 BLAKE2B cb6764d3186c03fc1df0878d00b7ced1d1e5036e8e3e7afeeb552e3d257cb51c3173edc07b738d111b41eb73f83f67967a9bd9ed071ab11478e12fdf5a0ea20c SHA512 7bc661356535cf00b2783f4a4bf323eae05c688d3db0ef81e7ccccb8d8aeeff24b2bbfca50b233d96b0f22d2aecf2d39f5bcd53d90b9076424b3c744f48341a5 +EBUILD smartmontools-6.6-r1.ebuild 4198 BLAKE2B efdd8dd91c44c87f2b7424f6200ab64095ccc82c8c36d239bbe88a93e1fa89a653a9d6aa5b7db1fb43e7f152b5333ca175e98e6f394729328c640f4a229a6f79 SHA512 e23a2d29430c2984dc944d3f3613c45dcbd6d6892e5eca3ca97d2fae649163bda5dfcfc2931df86b0d329779ffa26f8b45f11dc1776a0e66b0d270e688d9b218 EBUILD smartmontools-6.6.ebuild 4141 BLAKE2B 44a371caee16745f0e5ae8aca8cd92e673579df9d9a693a81ed2ae0f91a9e2138558cf23f4dbbc6beee6f9910ed4e16368ec9ac68f6b8ca9772a40dc58f21481 SHA512 499b051c4e78c0dd053c8a377814f86b8d01c8176bf973ea03b3032037e573759e08ab1de68ae5a989a18fe688456f306769196c838b4f6b3809121a53aa9f65 EBUILD smartmontools-9999.ebuild 4094 BLAKE2B 2af97f4da8bb0b0f5a1c6f9bc275724d69b4687e3ab7890f021d9e2fa25fccab24769dde1a08d61464f8977b6cd8c912b906307feb119e9f94eb83ce204cf0c7 SHA512 3b284a9deccd3b3e9e02d38565bc2a844f3e9478f20811742c35e5bd57cec653471f742921f37a0a48f1d5a533e51eeda11455e6bfb5fbf93eaba478d3174f2a MISC metadata.xml 718 BLAKE2B 4172ef96f081f77b7f701d2f11ed1eae3cd7342815fd3643373f8bb60802a273d8308dc4ff8e8d36349f8361e04213ee2d94619045a16739aa2fa75560c7cfae SHA512 a6a07e57bd09402839295ee859481d784445afadb12ffd644c6de3af41a4a763225f63d098c328193123d72cdad3b98e278256bb3e67b104015399def014ee54 diff --git a/sys-apps/smartmontools/files/smartmontools-6.6-set-broadcast-nsid.patch b/sys-apps/smartmontools/files/smartmontools-6.6-set-broadcast-nsid.patch new file mode 100644 index 000000000000..e65504d43c65 --- /dev/null +++ b/sys-apps/smartmontools/files/smartmontools-6.6-set-broadcast-nsid.patch @@ -0,0 +1,104 @@ +fix from upstream + +https://www.smartmontools.org/changeset?new=4671@/&old=4670@/ + +Index: trunk/smartmontools-6.6/ChangeLog +=================================================================== + 2017-12-27 Douglas Gilbert <dgilbert@interlog.com> + ++ nvmecmds.cpp: according to NVMe 1.3a spec, the SMART/ ++ health information log page is global and should take ++ the global nsid (all ff_s). It also says the Error ++ info lpage is "global. Broke WD Black PCIe (NVMe) ++ SSD but worked on Intel SSDs. Fix; could break others. ++ ++2017-12-27 Douglas Gilbert <dgilbert@interlog.com> ++ + os_freebsd.cpp: on error was setting set_nvme_err() to 1, + not the actual NVMe status value; fix. + +Index: trunk/smartmontools-6.6/nvmecmds.cpp +=================================================================== +diff --git smartmontools-6.6/nvmecmds.cpp smartmontools-6.6/nvmecmds.cpp +--- smartmontools-6.6/nvmecmds.cpp (revision 4670) ++++ smartmontools-6.6/nvmecmds.cpp (revision 4671) +@@ -196,7 +196,8 @@ + } + + // Read NVMe log page with identifier LID. +-bool nvme_read_log_page(nvme_device * device, unsigned char lid, void * data, unsigned size) ++bool nvme_read_log_page(nvme_device * device, unsigned char lid, void * data, ++ unsigned size, bool broadcast_nsid) + { + if (!(4 <= size && size <= 0x4000 && (size % 4) == 0)) + throw std::logic_error("nvme_read_log_page(): invalid size"); +@@ -204,7 +205,7 @@ + memset(data, 0, size); + nvme_cmd_in in; + in.set_data_in(nvme_admin_get_log_page, data, size); +- in.nsid = device->get_nsid(); ++ in.nsid = broadcast_nsid ? 0xffffffff : device->get_nsid(); + in.cdw10 = lid | (((size / 4) - 1) << 16); + + return nvme_pass_through(device, in); +@@ -213,7 +214,7 @@ + // Read NVMe Error Information Log. + bool nvme_read_error_log(nvme_device * device, nvme_error_log_page * error_log, unsigned num_entries) + { +- if (!nvme_read_log_page(device, 0x01, error_log, num_entries * sizeof(*error_log))) ++ if (!nvme_read_log_page(device, 0x01, error_log, num_entries * sizeof(*error_log), true)) + return false; + + if (isbigendian()) { +@@ -234,7 +235,7 @@ + // Read NVMe SMART/Health Information log. + bool nvme_read_smart_log(nvme_device * device, nvme_smart_log & smart_log) + { +- if (!nvme_read_log_page(device, 0x02, &smart_log, sizeof(smart_log))) ++ if (!nvme_read_log_page(device, 0x02, &smart_log, sizeof(smart_log), true)) + return false; + + if (isbigendian()) { +Index: trunk/smartmontools-6.6/nvmecmds.h +=================================================================== +diff --git smartmontools-6.6/nvmecmds.h smartmontools-6.6/nvmecmds.h +--- smartmontools-6.6/nvmecmds.h (revision 4670) ++++ smartmontools-6.6/nvmecmds.h (revision 4671) +@@ -248,7 +248,8 @@ + bool nvme_read_id_ns(nvme_device * device, unsigned nsid, smartmontools::nvme_id_ns & id_ns); + + // Read NVMe log page with identifier LID. +-bool nvme_read_log_page(nvme_device * device, unsigned char lid, void * data, unsigned size); ++bool nvme_read_log_page(nvme_device * device, unsigned char lid, void * data, ++ unsigned size, bool broadcast_nsid); + + // Read NVMe Error Information Log. + bool nvme_read_error_log(nvme_device * device, smartmontools::nvme_error_log_page * error_log, +Index: trunk/smartmontools-6.6/nvmeprint.cpp +=================================================================== +diff --git smartmontools-6.6/nvmeprint.cpp smartmontools-6.6/nvmeprint.cpp +--- smartmontools-6.6/nvmeprint.cpp (revision 4670) ++++ smartmontools-6.6/nvmeprint.cpp (revision 4671) +@@ -473,9 +473,21 @@ + if (options.log_page_size) { + // Align size to dword boundary + unsigned size = ((options.log_page_size + 4-1) / 4) * 4; ++ bool broadcast_nsid; + raw_buffer log_buf(size); + +- if (!nvme_read_log_page(device, options.log_page, log_buf.data(), size)) { ++ switch (options.log_page) { ++ case 1: ++ case 2: ++ case 3: ++ broadcast_nsid = true; ++ break; ++ default: ++ broadcast_nsid = false; ++ break; ++ } ++ if (!nvme_read_log_page(device, options.log_page, log_buf.data(), ++ size, broadcast_nsid)) { + pout("Read NVMe Log 0x%02x failed: %s\n\n", options.log_page, device->get_errmsg()); + return retval | FAILSMART; + } diff --git a/sys-apps/smartmontools/smartmontools-6.6-r1.ebuild b/sys-apps/smartmontools/smartmontools-6.6-r1.ebuild new file mode 100644 index 000000000000..06a1bd943dbe --- /dev/null +++ b/sys-apps/smartmontools/smartmontools-6.6-r1.ebuild @@ -0,0 +1,155 @@ +# Copyright 1999-2018 Gentoo Foundation +# 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 ~arm-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 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 ) + update_drivedb? ( + app-crypt/gnupg + || ( + net-misc/curl + net-misc/wget + www-client/lynx + dev-vcs/subversion + ) + ) +" + +REQUIRED_USE="( caps? ( daemon ) )" + +PATCHES=( + "${FILESDIR}"/${P}-fix-build-on-musl.patch + "${FILESDIR}"/${P}-set-broadcast-nsid.patch +) + +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=( + --docdir="${EPREFIX}/usr/share/doc/${PF}" + --with-drivedbdir="${EPREFIX}/var/db/${PN}" #575292 + --with-initscriptdir="${EPREFIX}/etc/init.d" + $(use_with caps libcap-ng) + $(use_with selinux) + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" + $(use_with update_drivedb gnupg) + $(use_with update_drivedb update-smart-drivedb) + ) + 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 +} |