FreeBSD Port: sysutils/smartmontools (more RCng problems)

Doug Barton dougb at FreeBSD.org
Fri Jan 6 15:53:27 PST 2006


Mike Jakubik wrote:
> This is yet another port that does not work properly because of the 
> recent RCng commits in 6-STABLE. Smartd does not startup on bootup, it 
> has to be manually started.

Ok, I installed this port and tested it myself, and the problem is the hard 
coded value of smartd_enable at the top of the script. For reasons I don't 
quite understand yet, hard coding the value in the script affects the 
boot-time operation of the script differently than on the command line.

The good news is that the fix is simple:

Index: smartd.sh
===================================================================
RCS file: /home/pcvs/ports/sysutils/smartmontools/files/smartd.sh,v
retrieving revision 1.5
diff -u -r1.5 smartd.sh
--- smartd.sh   18 Nov 2005 11:46:38 -0000      1.5
+++ smartd.sh   6 Jan 2006 23:36:35 -0000
@@ -13,8 +13,8 @@
  #
  # DO NOT CHANGE THESE DEFAULT VALUES HERE
  #
-smartd_enable="NO"
-smartd_pidfile="/var/run/smartd.pid"
+smartd_enable=${smartd_enable:-NO}
+smartd_pidfile=${smartd_pidfile:-/var/run/smartd.pid}

  . %%RC_SUBR%%


For the maintainer, the attached patch brings the use of USE_RC_SUBR up to 
speed with the latest stuff. I'll be glad to commit it if you're ok with it.

Doug


-- 

     This .signature sanitized for your protection

-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/sysutils/smartmontools/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- Makefile	18 Nov 2005 11:46:38 -0000	1.21
+++ Makefile	6 Jan 2006 23:49:01 -0000
@@ -16,7 +16,7 @@
 COMMENT=	S.M.A.R.T. disk monitoring tools
 
 USE_GMAKE=	yes
-USE_RC_SUBR=	yes
+USE_RC_SUBR=	smartd.sh
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--with-initscriptdir=${PREFIX}/etc/rc.d \
 		--with-docdir=${DOCSDIR} --enable-sample
@@ -27,18 +27,12 @@
 MAN8=		smartd.8 smartctl.8
 DOCS=		AUTHORS CHANGELOG INSTALL NEWS README TODO WARNINGS
 EXAMPLES=	smartd.conf examplescripts/README examplescripts/Example?
-RC_SCRIPTS_SUB=	PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
-
-post-build:
-	${SED}	${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
-		${FILESDIR}/smartd.sh > ${WRKDIR}/smartd.sh
 
 do-install:
 	cd ${WRKSRC} && ${INSTALL_PROGRAM} ${PROGRAMS} ${PREFIX}/sbin
 	cd ${WRKSRC} && ${INSTALL_MAN} ${MAN5} ${MANPREFIX}/man/man5
 	cd ${WRKSRC} && ${INSTALL_MAN} ${MAN8} ${MANPREFIX}/man/man8
 	${INSTALL_DATA} ${WRKSRC}/smartd.conf.sample ${PREFIX}/etc
-	${INSTALL_SCRIPT} ${WRKDIR}/smartd.sh ${PREFIX}/etc/rc.d/smartd.sh
 	@${MKDIR} ${EXAMPLESDIR}
 	cd ${WRKSRC} && ${INSTALL_DATA} ${EXAMPLES} ${EXAMPLESDIR}
 .if !defined(NOPORTDOCS)
Index: pkg-plist
===================================================================
RCS file: /home/pcvs/ports/sysutils/smartmontools/pkg-plist,v
retrieving revision 1.2
diff -u -r1.2 pkg-plist
--- pkg-plist	28 Apr 2004 18:27:52 -0000	1.2
+++ pkg-plist	6 Jan 2006 23:49:01 -0000
@@ -2,7 +2,6 @@
 @unexec /bin/echo "===>" Stopping smartd ...
 @unexec /usr/bin/killall smartd 2>/dev/null || true
 etc/smartd.conf.sample
-etc/rc.d/smartd.sh
 sbin/smartctl
 sbin/smartd
 %%PORTDOCS%%%%DOCSDIR%%/AUTHORS
Index: files/smartd.sh
===================================================================
RCS file: /home/pcvs/ports/sysutils/smartmontools/files/smartd.sh,v
retrieving revision 1.5
diff -u -r1.5 smartd.sh
--- files/smartd.sh	18 Nov 2005 11:46:38 -0000	1.5
+++ files/smartd.sh	6 Jan 2006 23:49:01 -0000
@@ -3,8 +3,7 @@
 
 # PROVIDE: smartd
 # REQUIRE: DAEMON
-# BEFORE: LOGIN
-# KEYWORD: FreeBSD shutdown
+# KEYWORD: shutdown
 
 # Define these smartd_* variables in one of these files:
 #	/etc/rc.conf
@@ -13,8 +12,8 @@
 #
 # DO NOT CHANGE THESE DEFAULT VALUES HERE
 #
-smartd_enable="NO"
-smartd_pidfile="/var/run/smartd.pid"
+smartd_enable=${smartd_enable:-NO}
+smartd_pidfile=${smartd_pidfile:-/var/run/smartd.pid}
 
 . %%RC_SUBR%%
 


More information about the freebsd-ports mailing list