aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpav <pav@FreeBSD.org>2008-12-19 21:14:29 +0800
committerpav <pav@FreeBSD.org>2008-12-19 21:14:29 +0800
commitcbaf4bc051365699e68013e17ccc10119432b62a (patch)
treeb75f919c0e07258c646c4e5e66e51430dc2d106e
parent4eeede6eba8f04e6dab12aac6bb321e3ce34b160 (diff)
downloadfreebsd-ports-gnome-cbaf4bc051365699e68013e17ccc10119432b62a.tar.gz
freebsd-ports-gnome-cbaf4bc051365699e68013e17ccc10119432b62a.tar.zst
freebsd-ports-gnome-cbaf4bc051365699e68013e17ccc10119432b62a.zip
- Now comes with a periodic script
PR: ports/129722 Submitted by: wollman
-rw-r--r--sysutils/smartmontools-devel/Makefile5
-rw-r--r--sysutils/smartmontools-devel/files/pkg-message.in7
-rw-r--r--sysutils/smartmontools-devel/files/smart.in52
-rw-r--r--sysutils/smartmontools-devel/pkg-plist3
-rw-r--r--sysutils/smartmontools/Makefile5
-rw-r--r--sysutils/smartmontools/files/pkg-message.in7
-rw-r--r--sysutils/smartmontools/files/smart.in52
-rw-r--r--sysutils/smartmontools/pkg-plist3
8 files changed, 130 insertions, 4 deletions
diff --git a/sysutils/smartmontools-devel/Makefile b/sysutils/smartmontools-devel/Makefile
index fed31cf28b3f..0668320d1535 100644
--- a/sysutils/smartmontools-devel/Makefile
+++ b/sysutils/smartmontools-devel/Makefile
@@ -7,6 +7,7 @@
PORTNAME= smartmontools
PORTVERSION= 5.38
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
@@ -18,7 +19,7 @@ USE_GMAKE= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-docdir=${DOCSDIR} --enable-sample
-SUB_FILES= pkg-message
+SUB_FILES= pkg-message smart
USE_RC_SUBR= smartd
MAN5= smartd.conf.5
@@ -28,6 +29,8 @@ post-patch:
@${REINPLACE_CMD} -e 's| install-initdDATA | |' ${WRKSRC}/Makefile.in
post-install:
+ ${MKDIR} ${PREFIX}/etc/periodic/daily
+ ${INSTALL_SCRIPT} ${WRKDIR}/smart ${PREFIX}/etc/periodic/daily/smart
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/sysutils/smartmontools-devel/files/pkg-message.in b/sysutils/smartmontools-devel/files/pkg-message.in
index ee9f662c7703..85cab06bfad7 100644
--- a/sysutils/smartmontools-devel/files/pkg-message.in
+++ b/sysutils/smartmontools-devel/files/pkg-message.in
@@ -5,7 +5,12 @@ To check the status of drives, use the following:
%%PREFIX%%/sbin/smartctl -a /dev/ad0 for first ATA drive
%%PREFIX%%/sbin/smartctl -a /dev/da0 for first SCSI drive
-To enable monitor of drives, you can use %%PREFIX%%/sbin/smartd
+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
diff --git a/sysutils/smartmontools-devel/files/smart.in b/sysutils/smartmontools-devel/files/smart.in
new file mode 100644
index 000000000000..166e4bf87187
--- /dev/null
+++ b/sysutils/smartmontools-devel/files/smart.in
@@ -0,0 +1,52 @@
+#!/bin/sh
+# This script is in the public domain. Original author: Garrett Wollman
+#
+# $FreeBSD$
+#
+
+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"}
+# no default for ${daily_status_smart_devices}
+if [ -z "${daily_status_smart_devices}" ]; then
+ : ${daily_status_smart_enabled="NO"}
+else
+ : ${daily_status_smart_enabled="YES"}
+fi
+trim_junk="tail -n +4"
+
+tmpfile="$(mktemp /var/run/daily.XXXXXXXX)"
+trap "rm -f ${tmpfile}" 0 1 3 15
+
+rc=0
+case "${daily_status_smart_enable}" in
+ [Nn][Oo])
+ ;;
+ *)
+ for device in ${daily_status_smart_devices}; do
+ if [ -e ${device} ]; then
+ echo
+ echo "Checking health of ${device}:"
+ echo
+ ${smartctl} ${daily_status_smartctl_flags} ${device} > "${tmpfile}"
+ status=$?
+ if [ $((status & 3)) -ne 0 ]; then
+ rc=2
+ ${trim_junk} "${tmpfile}"
+ elif [ $status -ne 0 ]; then
+ rc=1
+ ${smartctl} ${daily_status_smartctl_extra_status_flags} ${device} | ${trim_junk}
+ else
+ ${trim_junk} "${tmpfile}"
+ fi
+ fi
+ done
+ ;;
+esac
+
+exit "$rc"
diff --git a/sysutils/smartmontools-devel/pkg-plist b/sysutils/smartmontools-devel/pkg-plist
index 4e77c480f242..7ca96cbea442 100644
--- a/sysutils/smartmontools-devel/pkg-plist
+++ b/sysutils/smartmontools-devel/pkg-plist
@@ -1,6 +1,7 @@
@comment $FreeBSD$
@unexec /bin/echo "===>" Stopping smartd ...
@unexec /usr/bin/killall smartd 2>/dev/null || true
+etc/periodic/daily/smart
etc/smartd.conf.sample
sbin/smartctl
sbin/smartd
@@ -20,3 +21,5 @@ sbin/smartd
%%DOCSDIR%%/smartd.conf
@dirrm %%DOCSDIR%%/examplescripts
@dirrm %%DOCSDIR%%
+@dirrmtry etc/periodic/daily
+@dirrmtry etc/periodic
diff --git a/sysutils/smartmontools/Makefile b/sysutils/smartmontools/Makefile
index fed31cf28b3f..0668320d1535 100644
--- a/sysutils/smartmontools/Makefile
+++ b/sysutils/smartmontools/Makefile
@@ -7,6 +7,7 @@
PORTNAME= smartmontools
PORTVERSION= 5.38
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
@@ -18,7 +19,7 @@ USE_GMAKE= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-docdir=${DOCSDIR} --enable-sample
-SUB_FILES= pkg-message
+SUB_FILES= pkg-message smart
USE_RC_SUBR= smartd
MAN5= smartd.conf.5
@@ -28,6 +29,8 @@ post-patch:
@${REINPLACE_CMD} -e 's| install-initdDATA | |' ${WRKSRC}/Makefile.in
post-install:
+ ${MKDIR} ${PREFIX}/etc/periodic/daily
+ ${INSTALL_SCRIPT} ${WRKDIR}/smart ${PREFIX}/etc/periodic/daily/smart
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/sysutils/smartmontools/files/pkg-message.in b/sysutils/smartmontools/files/pkg-message.in
index ee9f662c7703..85cab06bfad7 100644
--- a/sysutils/smartmontools/files/pkg-message.in
+++ b/sysutils/smartmontools/files/pkg-message.in
@@ -5,7 +5,12 @@ To check the status of drives, use the following:
%%PREFIX%%/sbin/smartctl -a /dev/ad0 for first ATA drive
%%PREFIX%%/sbin/smartctl -a /dev/da0 for first SCSI drive
-To enable monitor of drives, you can use %%PREFIX%%/sbin/smartd
+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
diff --git a/sysutils/smartmontools/files/smart.in b/sysutils/smartmontools/files/smart.in
new file mode 100644
index 000000000000..166e4bf87187
--- /dev/null
+++ b/sysutils/smartmontools/files/smart.in
@@ -0,0 +1,52 @@
+#!/bin/sh
+# This script is in the public domain. Original author: Garrett Wollman
+#
+# $FreeBSD$
+#
+
+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"}
+# no default for ${daily_status_smart_devices}
+if [ -z "${daily_status_smart_devices}" ]; then
+ : ${daily_status_smart_enabled="NO"}
+else
+ : ${daily_status_smart_enabled="YES"}
+fi
+trim_junk="tail -n +4"
+
+tmpfile="$(mktemp /var/run/daily.XXXXXXXX)"
+trap "rm -f ${tmpfile}" 0 1 3 15
+
+rc=0
+case "${daily_status_smart_enable}" in
+ [Nn][Oo])
+ ;;
+ *)
+ for device in ${daily_status_smart_devices}; do
+ if [ -e ${device} ]; then
+ echo
+ echo "Checking health of ${device}:"
+ echo
+ ${smartctl} ${daily_status_smartctl_flags} ${device} > "${tmpfile}"
+ status=$?
+ if [ $((status & 3)) -ne 0 ]; then
+ rc=2
+ ${trim_junk} "${tmpfile}"
+ elif [ $status -ne 0 ]; then
+ rc=1
+ ${smartctl} ${daily_status_smartctl_extra_status_flags} ${device} | ${trim_junk}
+ else
+ ${trim_junk} "${tmpfile}"
+ fi
+ fi
+ done
+ ;;
+esac
+
+exit "$rc"
diff --git a/sysutils/smartmontools/pkg-plist b/sysutils/smartmontools/pkg-plist
index 4e77c480f242..7ca96cbea442 100644
--- a/sysutils/smartmontools/pkg-plist
+++ b/sysutils/smartmontools/pkg-plist
@@ -1,6 +1,7 @@
@comment $FreeBSD$
@unexec /bin/echo "===>" Stopping smartd ...
@unexec /usr/bin/killall smartd 2>/dev/null || true
+etc/periodic/daily/smart
etc/smartd.conf.sample
sbin/smartctl
sbin/smartd
@@ -20,3 +21,5 @@ sbin/smartd
%%DOCSDIR%%/smartd.conf
@dirrm %%DOCSDIR%%/examplescripts
@dirrm %%DOCSDIR%%
+@dirrmtry etc/periodic/daily
+@dirrmtry etc/periodic