From frank@dynamical-systems.org  Sun Oct  2 17:35:36 2005
Return-Path: <frank@dynamical-systems.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id BBAC816A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  2 Oct 2005 17:35:36 +0000 (GMT)
	(envelope-from frank@dynamical-systems.org)
Received: from mout2.freenet.de (mout2.freenet.de [194.97.50.155])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 14C0A43D45
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  2 Oct 2005 17:35:35 +0000 (GMT)
	(envelope-from frank@dynamical-systems.org)
Received: from [194.97.55.147] (helo=mx4.freenet.de)
	by mout2.freenet.de with esmtpa (Exim 4.53-RC2)
	id 1EM7kM-0008DE-QL
	for FreeBSD-gnats-submit@freebsd.org; Sun, 02 Oct 2005 19:35:34 +0200
Received: from p508eb606.dip0.t-ipconnect.de ([80.142.182.6] helo=achilles.senax.net)
	by mx4.freenet.de with esmtpsa (ID jr-relay@freenet.de) (TLSv1:AES256-SHA:256) (Exim 4.53 #4)
	id 1EM7kM-0002Ip-CP
	for FreeBSD-gnats-submit@freebsd.org; Sun, 02 Oct 2005 19:35:34 +0200
Received: from achilles.senax.net (localhost.senax.net [127.0.0.1])
	by achilles.senax.net (8.13.1/8.13.1) with ESMTP id j92HZXdZ000574;
	Sun, 2 Oct 2005 19:35:33 +0200 (CEST)
	(envelope-from frank@dynamical-systems.org)
Received: (from root@localhost)
	by achilles.senax.net (8.13.1/8.13.1/Submit) id j92HZW5B000573;
	Sun, 2 Oct 2005 19:35:32 +0200 (CEST)
	(envelope-from frank@dynamical-systems.org)
Message-Id: <200510021735.j92HZW5B000573@achilles.senax.net>
Date: Sun, 2 Oct 2005 19:35:32 +0200 (CEST)
From: "Frank W. Josellis" <frank@dynamical-systems.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Update port: sysutils/pcfclock revised to 0.44_2
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         86839
>Category:       ports
>Synopsis:       Update port: sysutils/pcfclock revised to 0.44_2
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    mnag
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 02 17:40:13 GMT 2005
>Closed-Date:    Mon May 01 05:45:59 GMT 2006
>Last-Modified:  Mon May 01 05:45:59 GMT 2006
>Originator:     Frank W. Josellis
>Release:        FreeBSD 4.11-STABLE i386
>Organization:
>Environment:
System: FreeBSD achilles.senax.net 4.11-STABLE FreeBSD 4.11-STABLE #8: Fri Sep 23 17:31:13 CEST 2005 root@achilles.senax.net:/usr/obj/usr/src/sys/ACHILLES i386


>Description:
Added a script for setting the system time from /dev/pcfclock0 during 
the boot process. Notably for FreeBSD 5.x this provides a convenient way 
to set the time at an early boot stage, before any time synchronization 
daemons are launched to achieve a more precise adjustment with the global 
network time.

Added files:
files/pcfdate.sh
pkg-deinstall

>How-To-Repeat:
	
>Fix:

--- pcfclock-0.44_2.patch begins here ---
diff -Nur pcfclock.BAK/Makefile pcfclock/Makefile
--- pcfclock.BAK/Makefile	Sat May  7 10:14:35 2005
+++ pcfclock/Makefile	Sun Oct  2 17:44:45 2005
@@ -7,18 +7,19 @@
 
 PORTNAME=	pcfclock
 PORTVERSION=	0.44
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	sysutils
 MASTER_SITES=	http://www-stud.ims.uni-stuttgart.de/~voegelas/pcfclock/
 
 MAINTAINER=	frank@dynamical-systems.org
 COMMENT=	Userland access to the pcfclock device
 
+USE_RC_SUBR=	yes
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--without-linux
 
 MAN8=		pcfdate.8
-PLIST_FILES=	sbin/pcfdate
+PLIST_FILES=	etc/rc.d/pcfdate.sh.sample sbin/pcfdate
 
 .include <bsd.port.pre.mk>
 
@@ -31,8 +32,9 @@
 .endif
 
 post-install:
-.if ${OSVERSION} < 500000
-	${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
-.endif
-
+	PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+	@${SED} -e 's|%%PREFIX%%|${PREFIX}|g' \
+		-e 's|%%RC_SUBR%%|${RC_SUBR}|g' \
+		${FILESDIR}/pcfdate.sh > ${PREFIX}/etc/rc.d/pcfdate.sh.sample
+	@${CHMOD} 755 ${PREFIX}/etc/rc.d/pcfdate.sh.sample
 .include <bsd.port.post.mk>
diff -Nur pcfclock.BAK/files/pcfdate.sh pcfclock/files/pcfdate.sh
--- pcfclock.BAK/files/pcfdate.sh	Thu Jan  1 01:00:00 1970
+++ pcfclock/files/pcfdate.sh	Sun Oct  2 17:44:45 2005
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+#
+# PROVIDE: pcfdate
+# BEFORE:  hostname
+# KEYWORD: FreeBSD DragonFly
+
+prefix=%%PREFIX%%
+
+# Define these pcfdate_* variables in one of these files:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/pcfdate
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+pcfdate_enable=${pcfdate_enable:-"NO"}	        # Enable pcfdate
+pcfdate_flags=${pcfdate_flags:-"-sv"}           # Flags to pcfdate program
+pcfdate_program="${prefix}/sbin/pcfdate"        # Location of pcfdate
+
+. %%RC_SUBR%%
+
+name="pcfdate"
+rcvar=`set_rcvar`
+start_cmd="pcfdate_start"
+stop_cmd=":"
+required_files="/dev/pcfclock0"
+
+pcfdate_start(){
+	echo "Setting time from pcfclock."
+	${pcfdate_program} ${pcfdate_flags}
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff -Nur pcfclock.BAK/pkg-deinstall pcfclock/pkg-deinstall
--- pcfclock.BAK/pkg-deinstall	Thu Jan  1 01:00:00 1970
+++ pcfclock/pkg-deinstall	Sun Oct  2 17:44:45 2005
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+case $2 in
+    DEINSTALL)
+    if [ -L /etc/rc.d/pcfdate ]; then
+	echo -n "Removing stale link: " ; rm -v /etc/rc.d/pcfdate
+    fi
+    ;;
+esac
diff -Nur pcfclock.BAK/pkg-install pcfclock/pkg-install
--- pcfclock.BAK/pkg-install	Sat May  7 10:14:35 2005
+++ pcfclock/pkg-install	Sun Oct  2 17:44:45 2005
@@ -16,5 +16,8 @@
 	    echo "$2: Try 'cd /dev ; mknod pcfclock0 c 140 0 root:wheel'"
 	fi
     fi
+    if [ -d /etc/rc.d ]; then
+	ln -vfs ${PKG_PREFIX}/etc/rc.d/pcfdate.sh.sample /etc/rc.d/pcfdate
+    fi
     ;;
 esac
--- pcfclock-0.44_2.patch ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->mnag 
Responsible-Changed-By: mnag 
Responsible-Changed-When: Sun Oct 2 22:35:16 GMT 2005 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=86839 
State-Changed-From-To: open->feedback 
State-Changed-By: mnag 
State-Changed-When: Thu Dec 1 00:27:15 GMT 2005 
State-Changed-Why:  
Dear maintainer, 

FreeBSD > 5.x use devfs(8). Maybe change rc script to create 
/dev/pcfclock with mknod.  Instead, pcfclock aren't work in FreeBSD > 5. 

Another thing is. Why rc script in /etc/rc.d? It's are not recommended, 
and i think when more last pcfclock start is better, because it does not 
concur with ntpdate for example. 

Regards 

http://www.freebsd.org/cgi/query-pr.cgi?pr=86839 

From: "Frank W. Josellis" <frank@dynamical-systems.org>
To: Marcus Alves Grando <mnag@FreeBSD.org>, freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/86839: Update port: sysutils/pcfclock revised to 0.44_2
Date: Sat, 3 Dec 2005 00:29:10 +0100 (CET)

 Well, I see that pkg-install can give confusing output and I tried to fix 
 this with the additional patch below. The MAKEDEV/mknod stuff is kept for 
 FreeBSD 4.x compatibility, while for FreeBSD 5.x and later one merely has 
 to enable the kernel's pcfclock support -- either by installing a suitably 
 customized kernel or by loading the pcfclock.ko module beforehand.
 
 Placing an rc script in /etc/rc.d was the only way I found to have pcfdate 
 invoked at the earliest possible stage. In particular, this has to happen 
 before ntpdate/ntpd or timed are launched, and I couldn't achieve this 
 with a script in /usr/local/etc/rc.d. (Of course, for FreeBSD 4.x all this 
 doesn't help, but that's presumably of minor importance). If there is the
 possibility to circumvent /etc/rc.d without missing the desired features, 
 please let me know.
 
 Aside from the modifications in pkg-install the patch below provides some 
 more corrections. For instance, I ran in trouble with the former patch if 
 /usr resides in its own separate partition. In the Makefile I have changed 
 the list of unsupported architectures by excluding exactly those hardware 
 platforms where ppbus is not available, according to the GENERIC configs. 
 (As usual, the patches are incremental, the older one has to be applied 
 first.)
 
 Regards,
 Frank
 
 
 --- pcfclock-0.44_2a.patch begins here ---
 diff -Nur pcfclock.BAK/Makefile pcfclock/Makefile
 --- pcfclock.BAK/Makefile	Fri Dec  2 14:41:04 2005
 +++ pcfclock/Makefile	Fri Dec  2 14:44:24 2005
 @@ -23,7 +23,7 @@
 
   .include <bsd.port.pre.mk>
 
 -.if ${ARCH} == "alpha"
 +.if ${ARCH} == "ia64" || ${ARCH} == "powerpc" || ${ARCH} == "sparc64"
   IGNORE=		Not supported for architecture ${ARCH}
   .endif
 
 @@ -32,9 +32,9 @@
   .endif
 
   post-install:
 -	PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
   	@${SED} -e 's|%%PREFIX%%|${PREFIX}|g' \
   		-e 's|%%RC_SUBR%%|${RC_SUBR}|g' \
   		${FILESDIR}/pcfdate.sh > ${PREFIX}/etc/rc.d/pcfdate.sh.sample
   	@${CHMOD} 755 ${PREFIX}/etc/rc.d/pcfdate.sh.sample
 +	PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
   .include <bsd.port.post.mk>
 diff -Nur pcfclock.BAK/distinfo pcfclock/distinfo
 --- pcfclock.BAK/distinfo	Mon Oct 24 23:04:11 2005
 +++ pcfclock/distinfo	Fri Dec  2 14:44:24 2005
 @@ -1,2 +1,3 @@
   MD5 (pcfclock-0.44.tar.gz) = 35f436caf4e6adb077b72bb49d5af3bb
 +SHA256 (pcfclock-0.44.tar.gz) = 1285c9536ad04c74bbdd92e22fd6a6661feeb3c9175eccb9b1e02c2f06adbda8
   SIZE (pcfclock-0.44.tar.gz) = 89914
 diff -Nur pcfclock.BAK/files/pcfdate.sh pcfclock/files/pcfdate.sh
 --- pcfclock.BAK/files/pcfdate.sh	Fri Dec  2 14:41:04 2005
 +++ pcfclock/files/pcfdate.sh	Fri Dec  2 14:44:24 2005
 @@ -2,7 +2,7 @@
   #
   #
   # PROVIDE: pcfdate
 -# BEFORE:  hostname
 +# BEFORE:  SERVERS
   # KEYWORD: FreeBSD DragonFly
 
   prefix=%%PREFIX%%
 diff -Nur pcfclock.BAK/pkg-deinstall pcfclock/pkg-deinstall
 --- pcfclock.BAK/pkg-deinstall	Fri Dec  2 14:41:04 2005
 +++ pcfclock/pkg-deinstall	Fri Dec  2 14:44:24 2005
 @@ -2,8 +2,8 @@
 
   case $2 in
       DEINSTALL)
 -    if [ -L /etc/rc.d/pcfdate ]; then
 -	echo -n "Removing stale link: " ; rm -v /etc/rc.d/pcfdate
 +    if [ -e /etc/rc.d/pcfdate ]; then
 +	echo -n "Removing stale rc script: " ; rm -v /etc/rc.d/pcfdate
       fi
       ;;
   esac
 diff -Nur pcfclock.BAK/pkg-install pcfclock/pkg-install
 --- pcfclock.BAK/pkg-install	Fri Dec  2 14:41:04 2005
 +++ pcfclock/pkg-install	Fri Dec  2 14:44:24 2005
 @@ -3,21 +3,26 @@
   case $2 in
       POST-INSTALL)
       if [ ! -c /dev/pcfclock0 ]; then
 -	rv=1
   	if [ -x /dev/MAKEDEV ]; then
 +	    # FreeBSD 4.x
   	    ( cd /dev && ./MAKEDEV pcfclock0 )
   	    rv=$?
 -	fi
 -
 -	if [ ${rv} = 0 ]; then
 -	    echo "$2: Device special file /dev/pcfclock0 created"
 + 
 +	    if [ ${rv} = 0 ]; then
 +		echo "$2: Device special file /dev/pcfclock0 created"
 +	    else
 +		echo "$2: Unexpected failure creating /dev/pcfclock0"
 +		echo "$2: Try 'cd /dev ; mknod pcfclock0 c 140 0 root:wheel'"
 +	    fi
   	else
 -	    echo "$2: Unexpected failure creating /dev/pcfclock0"
 -	    echo "$2: Try 'cd /dev ; mknod pcfclock0 c 140 0 root:wheel'"
 +	    # FreeBSD 5.x or later
 +	    echo "$2: No pcfclock device found"
 +	    echo "$2: Ensure to have pcfclock support enabled for your kernel"
   	fi
       fi
 +
       if [ -d /etc/rc.d ]; then
 -	ln -vfs ${PKG_PREFIX}/etc/rc.d/pcfdate.sh.sample /etc/rc.d/pcfdate
 +	cp -vp ${PKG_PREFIX}/etc/rc.d/pcfdate.sh.sample /etc/rc.d/pcfdate
       fi
       ;;
   esac
 --- pcfclock-0.44_2a.patch ends here ---
 
State-Changed-From-To: feedback->closed 
State-Changed-By: mnag 
State-Changed-When: Mon May 1 05:45:57 UTC 2006 
State-Changed-Why:  
Committed, with minor changes. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=86839 
>Unformatted:
