sysutils/smartmontools: fix update-drive-db and hanlde nda(4) devices

PR: 269535, 266185
This commit is contained in:
Oleksii Samorukov 2023-06-05 22:12:23 +02:00
parent 77b7aa3bf8
commit bcfaccea10
3 changed files with 58 additions and 1 deletions

View file

@ -1,5 +1,6 @@
PORTNAME= smartmontools
DISTVERSION= 7.3
PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= SF

View file

@ -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##*/}" = "?" ] \

View file

@ -13,7 +13,7 @@ smartctl=%%PREFIX%%/sbin/smartctl
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