Bug 86839 - Update port: sysutils/pcfclock revised to 0.44_2
Summary: Update port: sysutils/pcfclock revised to 0.44_2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Marcus Alves Grando
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-02 18:40 UTC by Frank W. Josellis
Modified: 2006-05-01 06:45 UTC (History)
0 users

See Also:


Attachments
pcfclock-0.44_2.patch (2.68 KB, patch)
2005-10-02 18:40 UTC, Frank W. Josellis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Frank W. Josellis 2005-10-02 18:40:13 UTC
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
Comment 1 Marcus Alves Grando freebsd_committer freebsd_triage 2005-10-02 23:35:16 UTC
Responsible Changed
From-To: freebsd-ports-bugs->mnag

I'll take it.
Comment 2 Marcus Alves Grando freebsd_committer freebsd_triage 2005-12-01 00:27:15 UTC
State Changed
From-To: open->feedback

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
Comment 3 Frank W. Josellis 2005-12-02 23:29:10 UTC
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 ---
Comment 4 Marcus Alves Grando freebsd_committer freebsd_triage 2006-05-01 06:45:57 UTC
State Changed
From-To: feedback->closed

Committed, with minor changes. Thanks!