Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Dec 2013 20:07:00 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r337796 - in head/sysutils/etcupdate: . src
Message-ID:  <201312272007.rBRK70tp097901@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb (src,doc committer)
Date: Fri Dec 27 20:07:00 2013
New Revision: 337796
URL: http://svnweb.freebsd.org/changeset/ports/337796

Log:
  Update to the latest version in HEAD including:
  - Add a pre-world mode of updating similar to the -p option that can be
    passed to mergemaster.
  - Fix a couple of issues with -F.
  - Refresh /etc/localtime after each update using tzsetup -r.
  - Regenerate /var/db/services.db when /etc/services changes.
  
  Bump to 1.1.
  
  Reviewed by:	kwm

Modified:
  head/sysutils/etcupdate/Makefile
  head/sysutils/etcupdate/src/etcupdate.8
  head/sysutils/etcupdate/src/etcupdate.sh

Modified: head/sysutils/etcupdate/Makefile
==============================================================================
--- head/sysutils/etcupdate/Makefile	Fri Dec 27 19:54:02 2013	(r337795)
+++ head/sysutils/etcupdate/Makefile	Fri Dec 27 20:07:00 2013	(r337796)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 PORTNAME=	etcupdate
-PORTVERSION=	1.0
+PORTVERSION=	1.1
 CATEGORIES=	sysutils
 MASTER_SITES=	# none
 DISTFILES=	# none

Modified: head/sysutils/etcupdate/src/etcupdate.8
==============================================================================
--- head/sysutils/etcupdate/src/etcupdate.8	Fri Dec 27 19:54:02 2013	(r337795)
+++ head/sysutils/etcupdate/src/etcupdate.8	Fri Dec 27 20:07:00 2013	(r337796)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2010-2012 Advanced Computing Technologies LLC
+.\" Copyright (c) 2010-2013 Advanced Computing Technologies LLC
 .\" Written by: John H. Baldwin <jhb@FreeBSD.org>
 .\" All rights reserved.
 .\"
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 12, 2013
+.Dd December 9, 2013
 .Dt ETCUPDATE 8
 .Os
 .Sh NAME
@@ -695,6 +695,25 @@ has been removed from the
 tree,
 but it has been locally modified.
 The modified version of the file remains in the destination directory.
+.It "Needs update: /etc/localtime (required manual update via tzsetup(1))"
+The
+.Fa /var/db/zoneinfo
+file does not exist,
+so
+.Nm
+was not able to refresh
+.Fa /etc/localtime
+from its source file in
+.Fa /usr/share/zoneinfo .
+Running
+.Xr tzsetup 1
+will both refresh
+.Fa /etc/localtime
+and generate
+.Fa /var/db/zoneinfo
+permitting future updates to refresh
+.Fa /etc/localtime
+automatically.
 .It "Needs update: /etc/mail/aliases.db (required manual update via newaliases(1))"
 The file
 .Pa /etc/mail/aliases

Modified: head/sysutils/etcupdate/src/etcupdate.sh
==============================================================================
--- head/sysutils/etcupdate/src/etcupdate.sh	Fri Dec 27 19:54:02 2013	(r337795)
+++ head/sysutils/etcupdate/src/etcupdate.sh	Fri Dec 27 20:07:00 2013	(r337796)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 2010 Advanced Computing Technologies LLC
+# Copyright (c) 2010-2013 Advanced Computing Technologies LLC
 # Written by: John H. Baldwin <jhb@FreeBSD.org>
 # All rights reserved.
 #
@@ -486,6 +486,39 @@ diffnode()
 	esac
 }
 
+# Run one-off commands after an update has completed.  These commands
+# are not tied to a specific file, so they cannot be handled by
+# post_install_file().
+post_update()
+{
+	local args
+
+	# None of these commands should be run for a pre-world update.
+	if [ -n "$preworld" ]; then
+		return
+	fi
+
+	# If /etc/localtime exists and is not a symlink and /var/db/zoneinfo
+	# exists, run tzsetup -r to refresh /etc/localtime.
+	if [ -f ${DESTDIR}/etc/localtime -a \
+	    ! -L ${DESTDIR}/etc/localtime ]; then
+		if [ -f ${DESTDIR}/var/db/zoneinfo ]; then
+			if [ -n "${DESTDIR}" ]; then
+				args="-C ${DESTDIR}"
+			else
+				args=""
+			fi
+			log "tzsetup -r ${args}"
+			if [ -z "$dryrun" ]; then
+				tzsetup -r ${args} >&3 2>&1
+			fi
+		else
+			warn "Needs update: /etc/localtime (required" \
+			    "manual update via tzsetup(1))"
+		fi
+	fi
+}
+
 # Create missing parent directories of a node in a target tree
 # preserving the owner, group, and permissions from a specified
 # template tree.
@@ -583,6 +616,14 @@ post_install_file()
 				fi
 			fi
 			;;
+		/etc/services)
+			log "services_mkdb -q -o $DESTDIR/var/db/services.db" \
+			    "${DESTDIR}$1"
+			if [ -z "$dryrun" ]; then
+				services_mkdb -q -o $DESTDIR/var/db/services.db \
+				    ${DESTDIR}$1 >&3 2>&1
+			fi
+			;;
 	esac
 }
 
@@ -1026,16 +1067,6 @@ handle_modified_file()
 		fi
 	fi
 
-	# If the only change in the new file versus the old file is a
-	# change in the FreeBSD ID string and -F is specified, just
-	# update the FreeBSD ID string in the local file.
-	if [ -n "$FREEBSD_ID" -a $cmp -eq $COMPARE_DIFFFILES ] && \
-	    fbsdid_only $OLDTREE/$file $NEWTREE/$file; then
-		if update_freebsdid $file; then
-			continue
-		fi
-	fi
-
 	# If the file was removed from the dest tree, just whine.
 	if [ $newdestcmp -eq $COMPARE_ONLYFIRST ]; then
 		# If the removed file matches an ALWAYS_INSTALL glob,
@@ -1050,6 +1081,14 @@ handle_modified_file()
 			return
 		fi
 
+		# If the only change in the new file versus the old
+		# file is a change in the FreeBSD ID string and -F is
+		# specified, don't warn.
+		if [ -n "$FREEBSD_ID" -a $cmp -eq $COMPARE_DIFFFILES ] && \
+		    fbsdid_only $OLDTREE/$file $NEWTREE/$file; then
+			return
+		fi
+
 		case $cmp in
 			$COMPARE_DIFFTYPE)
 				old=`file_type $OLDTREE/$file`
@@ -1080,6 +1119,16 @@ handle_modified_file()
 		fi
 	fi
 
+	# If the only change in the new file versus the old file is a
+	# change in the FreeBSD ID string and -F is specified, just
+	# update the FreeBSD ID string in the local file.
+	if [ -n "$FREEBSD_ID" -a $cmp -eq $COMPARE_DIFFFILES ] && \
+	    fbsdid_only $OLDTREE/$file $NEWTREE/$file; then
+		if update_freebsdid $file; then
+			continue
+		fi
+	fi
+
 	# If the file changed types between the old and new trees but
 	# the files in the new and dest tree are both of the same
 	# type, treat it like an added file just comparing the new and
@@ -1498,6 +1547,9 @@ EOF
 		    "(requires manual update via newaliases(1))"
 	fi
 
+	# Run any special one-off commands after an update has completed.
+	post_update
+
 	if [ -s $WARNINGS ]; then
 		echo "Warnings:"
 		cat $WARNINGS
@@ -1698,7 +1750,7 @@ case $command in
 		fi
 		;;
 	build|diff|status)
-		if [ -n "$dryrun" -o -n "$rerun" -o -n "$tarball" -o
+		if [ -n "$dryrun" -o -n "$rerun" -o -n "$tarball" -o \
 		     -n "$preworld" ]; then
 			usage
 		fi



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312272007.rBRK70tp097901>