This commit is contained in:
2025-08-27 17:10:19 +02:00
parent 67c8d5ea09
commit f54d1dfc4a
628 changed files with 29658 additions and 4 deletions

View File

@@ -0,0 +1,38 @@
#
# $Id$
#
PORTNAME= smartmontools
PORTVERSION= 7.4
CATEGORIES= sysutils
MASTER_SITES= SF
MAINTAINER= samm@os2.kiev.ua
COMMENT= S.M.A.R.T. disk monitoring tools
USES= alias gmake shebangfix
SHEBANG_FILES= examplescripts/Example5
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --disable-dependency-tracking
CONFIGURE_ARGS+= --enable-sample
CONFIGURE_ARGS+= --with-nvme-devicescan=yes
CONFIGURE_ARGS+= --with-initscriptdir=${PREFIX}/etc/rc.d
CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc/smartd
SUB_FILES= pkg-message smart
USE_RC_SUBR= smartd
PORTEXAMPLES= *
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/310.smart
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
${INSTALL_DATA} ${WRKSRC}/*.conf ${STAGEDIR}${EXAMPLESDIR}
# ${INSTALL_DATA} ${WRKSRC}/smartd_warning.sh ${STAGEDIR}${EXAMPLESDIR}/smartd-warning.sh
.include <bsd.port.mk>
#EOF

View File

@@ -0,0 +1,3 @@
TIMESTAMP = 1703707373
SHA256 (smartmontools-7.4.tar.gz) = e9a61f641ff96ca95319edfb17948cd297d0cd3342736b2c49c99d4716fb993d
SIZE (smartmontools-7.4.tar.gz) = 1094955

View File

@@ -0,0 +1,11 @@
--- configure.orig 2018-12-30 14:49:08 UTC
+++ configure
@@ -6891,7 +6891,7 @@ case "${host}" in
*-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
os_deps='os_freebsd.o cciss.o dev_areca.o'
os_libs='-lcam -lsbuf'
- os_dltools='curl wget lynx fetch svn'
+ os_dltools='fetch curl wget lynx svn'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb20_dev_get_device_desc in -lusb" >&5
$as_echo_n "checking for libusb20_dev_get_device_desc in -lusb... " >&6; }
if ${ac_cv_lib_usb_libusb20_dev_get_device_desc+:} false; then :

View File

@@ -0,0 +1,53 @@
Index: os_freebsd.cpp
===================================================================
--- os_freebsd.cpp.orig 2018-12-05 18:30:46 UTC
+++ os_freebsd.cpp
@@ -9,6 +9,7 @@
*/
#include <sys/param.h>
+#include <sys/endian.h>
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
@@ -522,29 +523,29 @@ bool freebsd_nvme_device::nvme_pass_through(const nvme
pt.cmd.opc = in.opcode;
#endif
pt.cmd.opc = in.opcode;
- pt.cmd.nsid = in.nsid;
+ pt.cmd.nsid = htole32(in.nsid);
pt.buf = in.buffer;
pt.len = in.size;
- pt.cmd.cdw10 = in.cdw10;
- pt.cmd.cdw11 = in.cdw11;
- pt.cmd.cdw12 = in.cdw12;
- pt.cmd.cdw13 = in.cdw13;
- pt.cmd.cdw14 = in.cdw14;
- pt.cmd.cdw15 = in.cdw15;
+ pt.cmd.cdw10 = htole32(in.cdw10);
+ pt.cmd.cdw11 = htole32(in.cdw11);
+ pt.cmd.cdw12 = htole32(in.cdw12);
+ pt.cmd.cdw13 = htole32(in.cdw13);
+ pt.cmd.cdw14 = htole32(in.cdw14);
+ pt.cmd.cdw15 = htole32(in.cdw15);
pt.is_read = 1; // should we use in.direction()?
int status = ioctl(get_fd(), NVME_PASSTHROUGH_CMD, &pt);
if (status < 0)
return set_err(errno, "NVME_PASSTHROUGH_CMD: %s", strerror(errno));
-
+#if __FreeBSD_version >= 1200058
+ nvme_completion_swapbytes(&pt.cpl);
+#endif
cp_p = &pt.cpl;
out.result=cp_p->cdw0; // Command specific result (DW0)
if (nvme_completion_is_error(cp_p)) { /* ignore DNR and More bits */
- uint16_t nvme_status = ((cp_p->status.sct << 8) | cp_p->status.sc) & 0x3ff;
-
- return set_nvme_err(out, nvme_status);
+ return set_nvme_err(out, nvme_completion_is_error(&pt.cpl));
}
return true;

View File

@@ -0,0 +1,20 @@
smartmontools has been installed
To check the status of drives, use the following:
%%PREFIX%%/sbin/smartctl -a /dev/ad0 for first ATA/SATA drive
%%PREFIX%%/sbin/smartctl -a /dev/da0 for first SCSI drive
%%PREFIX%%/sbin/smartctl -a /dev/ada0 for first SATA drive
To include drive health information in your daily status reports,
add a line like the following to /etc/periodic.conf:
daily_status_smart_devices="/dev/ad0 /dev/da0"
substituting the appropriate device names for your SMART-capable disks.
To enable drive monitoring, you can use %%PREFIX%%/sbin/smartd.
A sample configuration file has been installed as
%%PREFIX%%/etc/smartd.conf.sample
Copy this file to %%PREFIX%%/etc/smartd.conf and edit appropriately
To have smartd start at boot
echo 'smartd_enable="YES"' >> /etc/rc.conf

View File

@@ -0,0 +1,85 @@
#!/bin/sh
# This script is in the public domain. Original author: Garrett Wollman
#
# $FreeBSD: head/sysutils/smartmontools/files/smart.in 389829 2015-06-16 09:36:09Z tijl $
#
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)[0-9]+//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]*}"
;;
/*) ;;
*) 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=1
${smartctl} ${devflags} ${daily_status_smartctl_extra_status_flags} \
${device} | ${trim_junk}
fi
fi
done
;;
esac
exit "${rc}"

View File

@@ -0,0 +1,70 @@
#!/bin/sh
# $FreeBSD: head/sysutils/smartmontools/files/smartd.in 340872 2014-01-24 00:14:07Z mat $
#
# PROVIDE: smartd
# REQUIRE: LOGIN
# KEYWORD: shutdown nojail
#
# Define these smartd_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/smartd
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
. /etc/rc.subr
name=smartd
rcvar=smartd_enable
load_rc_config smartd
: ${smartd_enable:="NO"}
required_files=${smartd_config:="%%PREFIX%%/etc/smartd/smartd.conf"}
pidfile=${smartd_pidfile:="/var/run/smartd.pid"}
command="%%PREFIX%%/sbin/smartd"
command_args="-c ${required_files} -p ${pidfile}"
extra_commands="reload report"
reload_cmd="smartd_reload"
report_cmd="smartd_report"
start_precmd=smartd_prestart
smartd_prestart()
{
case "${smartd_flags}" in
-p*|*-p*)
err 1 'smartd_flags includes the -p option, use smartd_pidfile instead'
;;
esac
}
smartd_reload()
{
local status
if ! status=`run_rc_command status 2>&1`; then
echo $status
return 1
fi
echo 'Reloading smartd.'
kill -HUP $rc_pid
}
smartd_report()
{
local status
if ! status=`run_rc_command status 2>&1`; then
echo $status
return 1
fi
echo 'Checking SMART devices now.'
kill -USR1 $rc_pid
}
run_rc_command "$1"

View File

@@ -0,0 +1,7 @@
The smartmontools package contains two utility programs (smartctl and smartd)
to control and monitor storage systems using the Self-Monitoring, Analysis
and Reporting Technology System (S.M.A.R.T.) built into most modern ATA and
SCSI hard disks. It is derived from the smartsuite package, and includes
support for ATA/ATAPI/SATA disks and SCSI disks and tape devices.
WWW: http://www.smartmontools.org

View File

@@ -0,0 +1,9 @@
etc/periodic/daily/310.smart
sbin/smartctl
sbin/smartd
share/smartmontools/drivedb.h
man/man5/smartd.conf.5.gz
man/man8/smartctl.8.gz
man/man8/smartd.8.gz
man/man8/update-smart-drivedb.8.gz
sbin/update-smart-drivedb