Index: Makefile =================================================================== RCS file: /home/pcvs/ports/sysutils/smartmontools/Makefile,v retrieving revision 1.56 diff -u -r1.56 Makefile --- Makefile 1 Dec 2011 20:53:31 -0000 1.56 +++ Makefile 15 Feb 2012 05:52:59 -0000 @@ -7,7 +7,7 @@ PORTNAME= smartmontools PORTVERSION= 5.42 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= sysutils MASTER_SITES= SF @@ -19,8 +19,6 @@ CONFLICTS= smartmontools-devel-[0-9]* USE_GMAKE= yes -# hack to prevent gmake failure on 6.xx -GMAKE= make GNU_CONFIGURE= yes CONFIGURE_ARGS= --disable-dependency-tracking \ --enable-drivedb --enable-sample \ @@ -32,6 +30,8 @@ MAN5= smartd.conf.5 MAN8= smartd.8 smartctl.8 +PORTDOCS= * + CFLAGS:= ${CFLAGS:S/-O2/-O/} -Wno-write-strings post-patch: @@ -40,7 +40,7 @@ post-install: ${MKDIR} ${PREFIX}/etc/periodic/daily ${INSTALL_SCRIPT} ${WRKDIR}/smart ${PREFIX}/etc/periodic/daily/smart - ${INSTALL_SCRIPT} ${WRKSRC}/smartd.freebsd.initd ${PREFIX}/etc/rc.d/smartd + @${CAT} ${PKGMESSAGE} .include Index: pkg-plist =================================================================== RCS file: /home/pcvs/ports/sysutils/smartmontools/pkg-plist,v retrieving revision 1.7 diff -u -r1.7 pkg-plist --- pkg-plist 19 Oct 2010 11:31:13 -0000 1.7 +++ pkg-plist 15 Feb 2012 05:52:59 -0000 @@ -1,28 +1,10 @@ -@comment $FreeBSD: ports/sysutils/smartmontools/pkg-plist,v 1.7 2010/10/19 11:31:13 sunpoet Exp $ -@unexec /bin/echo "===>" Stopping smartd ... -@unexec /usr/bin/killall smartd 2>/dev/null || true +@stopdaemon smartd etc/periodic/daily/smart etc/smartd.conf.sample sbin/smartctl sbin/smartd sbin/update-smart-drivedb -%%DOCSDIR%%/AUTHORS -%%DOCSDIR%%/CHANGELOG -%%DOCSDIR%%/COPYING -%%DOCSDIR%%/INSTALL -%%DOCSDIR%%/NEWS -%%DOCSDIR%%/README -%%DOCSDIR%%/TODO -%%DOCSDIR%%/WARNINGS -%%DOCSDIR%%/examplescripts/Example1 -%%DOCSDIR%%/examplescripts/Example2 -%%DOCSDIR%%/examplescripts/Example3 -%%DOCSDIR%%/examplescripts/Example4 -%%DOCSDIR%%/examplescripts/README -%%DOCSDIR%%/smartd.conf %%DATADIR%%/drivedb.h @dirrm %%DATADIR%% -@dirrm %%DOCSDIR%%/examplescripts -@dirrm %%DOCSDIR%% @dirrmtry etc/periodic/daily @dirrmtry etc/periodic Index: files/smartd.in =================================================================== RCS file: /home/pcvs/ports/sysutils/smartmontools/files/smartd.in,v retrieving revision 1.3 diff -u -r1.3 smartd.in --- files/smartd.in 14 Jan 2012 08:57:06 -0000 1.3 +++ files/smartd.in 15 Feb 2012 05:52:59 -0000 @@ -1,44 +1,70 @@ #!/bin/sh -# $FreeBSD: ports/sysutils/smartmontools/files/smartd.in,v 1.3 2012/01/14 08:57:06 dougb Exp $ +# $FreeBSD$ +# # PROVIDE: smartd -# REQUIRE: DAEMON -# BEFORE: LOGIN -# KEYWORD: shutdown - +# 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 -# -smartd_enable="${smartd_enable-NO}" -smartd_pidfile="/var/run/smartd.pid" . /etc/rc.subr -name="smartd" +name=smartd rcvar=smartd_enable -command="%%PREFIX%%/sbin/smartd" -load_rc_config $name +load_rc_config smartd + +: ${smartd_enable:="NO"} -: ${smartd_config="%%PREFIX%%/etc/smartd.conf"} -: ${smartd_flags="-c ${smartd_config}"} +required_files=${smartd_config:="%%PREFIX%%/etc/smartd.conf"} +pidfile=${smartd_pidfile:="/var/run/smartd.pid"} -pidfile="${smartd_pidfile}" -required_files="${smartd_config}" +command="%%PREFIX%%/sbin/smartd" +command_args="-c ${required_files} -p ${pidfile}" -case "${smartd_flags}" in -*-p\ *) - echo "ERROR: \$smartd_flags includes -p option." \ - "Please use \$smartd_pidfile instead." - exit 1 - ;; -*) - smartd_flags="-p ${pidfile} ${smartd_flags}" - ;; -esac +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"