diff --git a/sysutils/smartmontools/Makefile b/sysutils/smartmontools/Makefile index 8b53ce8c25ca..b9a3b337a767 100644 --- a/sysutils/smartmontools/Makefile +++ b/sysutils/smartmontools/Makefile @@ -1,40 +1,41 @@ PORTNAME= smartmontools DISTVERSION= 7.3 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= SF MAINTAINER= samm@FreeBSD.org COMMENT= S.M.A.R.T. disk monitoring tools WWW= https://www.smartmontools.org LICENSE= GPLv2+ LICENSE_FILE= ${WRKSRC}/COPYING USES= compiler:c++11-lib cpe shebangfix USE_RC_SUBR= smartd SHEBANG_FILES= examplescripts/Example5 GNU_CONFIGURE= yes CONFIGURE_ARGS= --disable-dependency-tracking \ --enable-sample \ --with-gnupg=no \ --with-initscriptdir=${PREFIX}/etc/rc.d \ --with-nvme-devicescan=yes SUB_FILES= pkg-message smart PORTDOCS= * OPTIONS_DEFINE= DOCS post-patch: @${REINPLACE_CMD} -e 's| install-initdDATA| |' ${WRKSRC}/Makefile.in post-install: @${MKDIR} ${STAGEDIR}${PREFIX}/etc/periodic/daily ${INSTALL_SCRIPT} ${WRKDIR}/smart \ ${STAGEDIR}${PREFIX}/etc/periodic/daily ${MV} ${STAGEDIR}${DATADIR}/drivedb.h \ ${STAGEDIR}${DATADIR}/drivedb.h.sample .include diff --git a/sysutils/smartmontools/files/patch-update-smart-drivedb.in b/sysutils/smartmontools/files/patch-update-smart-drivedb.in new file mode 100644 index 000000000000..786236c5c01a --- /dev/null +++ b/sysutils/smartmontools/files/patch-update-smart-drivedb.in @@ -0,0 +1,56 @@ +--- update-smart-drivedb.in.orig 2022-02-23 21:47:28 UTC ++++ update-smart-drivedb.in +@@ -8,7 +8,7 @@ + # + # SPDX-License-Identifier: GPL-2.0-or-later + # +-# $Id: update-smart-drivedb.in 5332 2022-02-23 21:47:28Z chrfranke $ ++# $Id$ + # + + set -e +@@ -527,7 +527,7 @@ gpg_verify() + # Remove temp home dir, retry on failure + i=0 + while ! out=`rm -f -r "$gnupgtmp" 2>&1`; do +- let ++i ++ i=$((i+1)) + if [ $i -ge 10 ]; then + echo "$out" >&2; break + fi +@@ -542,12 +542,14 @@ gpg_verify() + get_db_version() + { + local r v x +- x=$(sed -n '/^[ {]*"VERSION: *[^"]*"/{s,^[ {]*"VERSION: \([1-9][./0-9]* [^"]*\)".*$,\1,p;q}' "$1") \ +- || return 1 ++ x=`sed -n '/^[ {]*"VERSION: *[^"]*"/{ ++ s,^[ {]*"VERSION: \([1-9][./0-9]* [^"]*\)".*$,\1,p ++ q ++ }' "$1"` || return 1 + v=${x%% *} + test -n "$v" || return 0 + if [ "${v%/*}" = "$v" ]; then # trunk: get rev from expanded SVN-Id +- r=$(echo "$x" | sed -n 's,^[^$]*\$''Id: drivedb\.h \([1-9][0-9]*\) .*$,\1,p') ++ r=`echo "$x" | sed -n 's,^[^$]*\$''Id: drivedb\.h \([1-9][0-9]*\) .*$,\1,p'` + test -n "$r" || r="?" + v="$v/$r" + fi +@@ -860,7 +862,7 @@ if [ -z "$no_verify" ]; then + fi + + # Get version +-newver=$(get_db_version "$drivedb.new") ++newver=`get_db_version "$drivedb.new"` + if [ -z "$newver" ]; then + if [ -z "$force" ]; then + mv_all "$drivedb" ".new" ".error" +@@ -905,7 +907,7 @@ if [ -n "$equal" ]; then + fi + + # Check branch and file version +-oldver=$(get_db_version "$drivedb") ++oldver=`get_db_version "$drivedb"` + test -n "$oldver" || oldver="?/?" + if [ "${newver##*/}" = "?" ] \ + || [ "${oldver##*/}" = "?" ] \ diff --git a/sysutils/smartmontools/files/smart.in b/sysutils/smartmontools/files/smart.in index f9ceea2bfad1..8460df0f231a 100644 --- a/sysutils/smartmontools/files/smart.in +++ b/sysutils/smartmontools/files/smart.in @@ -1,88 +1,88 @@ #!/bin/sh # This script is in the public domain. Original author: Garrett Wollman if [ -r /etc/defaults/periodic.conf ]; then . /etc/defaults/periodic.conf source_periodic_confs fi smartctl=%%PREFIX%%/sbin/smartctl : ${daily_status_smartctl_flags="-H"} : ${daily_status_smartctl_extra_status_flags="-a"} case "${daily_status_smart_devices}" in # XXX AUTO mode selects only regular ad/da disks [Aa][Uu][Tt][Oo]) - daily_status_smart_devices="$(sysctl -n kern.disks | sed -E 's/[[:<:]](cd|ar|vtbd)[0-9]+//g; s/nvd/nvme/g')" + daily_status_smart_devices="$(sysctl -n kern.disks | sed -E 's/[[:<:]](cd|ar|vtbd)[0-9]+//g; s/n(da|vd)/nvme/g')" ;; *) ;; esac if [ -z "${daily_status_smart_devices}" ]; then : ${daily_status_smart_enable="NO"} else : ${daily_status_smart_enable="YES"} fi trim_junk="tail -n +4" tmpfile="$(mktemp -t daily)" trap "rm -f ${tmpfile}" 0 1 3 15 rc=0 case "${daily_status_smart_enable}" in [Yy][Ee][Ss]) echo echo 'SMART status:' cd /dev for device in ${daily_status_smart_devices}; do device="${device#/dev/}" devflags="" case ${device} in tw[aes]*) devflags="-d3ware,${device##tw[aes][0-9]*,}" device="/dev/${device%,[0-9]*}" ;; ciss*) devflags="-dcciss,${device##ciss[0-9]*,}" device="/dev/${device%,[0-9]*}" ;; arcmsr*) devflags="-dareca,${device##arcmsr[0-9]*,}" device="/dev/${device%,[0-9]*}" ;; mrsas*) devflags="-dmegaraid,${device##mrsas[0-9]*,}" device="/dev/${device%,[0-9]*}" ;; /*) ;; *) device="/dev/${device}" ;; esac if [ -e ${device} ]; then echo -n "Checking health of ${device}" if [ -n "${devflags}" ]; then echo -n " (${devflags})" fi echo -n ": " ${smartctl} ${devflags} ${daily_status_smartctl_flags} ${device} > "${tmpfile}" status=$? if [ ${status} -eq 0 ]; then echo "OK" elif [ ${status} -eq 32 ]; then echo "OK (but has failed in the past)" elif [ $((status & 3)) -ne 0 ]; then rc=2 ${trim_junk} "${tmpfile}" elif [ `grep -c '^SMART support is: Unavailable' ${tmpfile}` -eq 1 ] ; then rc=2 echo "N/A" else rc=3 ${smartctl} ${devflags} ${daily_status_smartctl_extra_status_flags} \ ${device} | ${trim_junk} fi fi done ;; esac exit "${rc}"