Skip to content

Commit f37375f

Browse files
committed
sysutils/smart: use `smartctl --scan' as disk source; closes opnsense#3236
1 parent e9044ac commit f37375f

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

sysutils/smart/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PLUGIN_NAME= smart
22
PLUGIN_VERSION= 2.2
3-
PLUGIN_REVISION= 1
3+
PLUGIN_REVISION= 2
44
PLUGIN_COMMENT= SMART tools
55
PLUGIN_DEPENDS= smartmontools
66
PLUGIN_MAINTAINER= [email protected]

sysutils/smart/src/opnsense/scripts/OPNsense/Smart/detailed_list.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,15 @@
2727

2828
RESULT=
2929

30-
for DEV in $(sysctl -n kern.disks); do
30+
for DEV in $(smartctl --scan | awk '{ print $1 }'); do
3131
IDENT=$(/usr/sbin/diskinfo -s ${DEV})
32-
33-
if [ "${DEV#nvd}" != "${DEV}" ]; then
34-
# the disk formerly know as nvdX
35-
DEV="nvme${DEV#nvd}"
36-
fi
37-
38-
STATE=$(/usr/local/sbin/smartctl -jH /dev/${DEV})
32+
STATE=$(/usr/local/sbin/smartctl -jH ${DEV})
3933

4034
if [ -n "${RESULT}" ]; then
4135
RESULT="${RESULT},";
4236
fi
4337

44-
RESULT="${RESULT}{\"device\":\"${DEV}\",\"ident\":\"${IDENT}\",\"state\":${STATE}}";
38+
RESULT="${RESULT}{\"device\":\"${DEV##/dev/}\",\"ident\":\"${IDENT}\",\"state\":${STATE}}";
4539
done
4640

4741
echo "[${RESULT}]"

0 commit comments

Comments
 (0)