Index: etc/defaults/rc.conf
===================================================================
--- etc/defaults/rc.conf	(revision 276758)
+++ etc/defaults/rc.conf	(working copy)
@@ -52,6 +52,9 @@ varmfs="AUTO"		# Set to YES to always create an mf
 varsize="32m"		# Size of mfs /var if created
 varmfs_flags="-S"	# Extra mount options for the mfs /var
 populate_var="AUTO"	# Set to YES to always (re)populate /var, NO to never
+populate_var_mtree_enable="YES"	# Use mtree(8) to (re)populate /var
+#populate_var_files=""	# Files to be copied to /var
+#populate_var_cmd=""	# Command to execute for (re)populating /var
 cleanvar_enable="YES" 	# Clean the /var directory
 local_startup="/usr/local/etc/rc.d" # startup script dirs.
 script_name_sep=" "	# Change if your startup scripts' names contain spaces
Index: etc/rc.d/var
===================================================================
--- etc/rc.d/var	(revision 276758)
+++ etc/rc.d/var	(working copy)
@@ -41,14 +41,33 @@ load_rc_config $name
 
 populate_var()
 {
-	/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null
-	case ${sendmail_enable} in
-	[Nn][Oo][Nn][Ee])
+	case ${populate_var_mtree_enable} in
+	[Nn][Oo])
 		;;
 	*)
-		/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null
+		if [ ! -x /usr/sbin/mtree ]; then
+			# We need mtree to populate /var so try mounting /usr.
+			# If this does not work, we can not boot so it is OK to
+			# try to mount out of order.
+			mount /usr
+			[ ! -x /usr/sbin/mtree ] && exit 1
+		fi
+		/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null
+		case ${sendmail_enable} in
+		[Nn][Oo][Nn][Ee])
+			;;
+		*)
+			/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null
+			;;
+		esac
 		;;
 	esac
+	if [ -n "${populate_var_files}" ]; then
+		cp -Rp ${populate_var_files} /var
+	fi
+	if [ -n "${populate_var_cmd}" ]; then
+		eval ${populate_var_cmd}
+	fi
 }
 
 # If we do not have a writable /var, create a memory filesystem for /var
@@ -71,9 +90,7 @@ case "${varmfs}" in
 esac
 
 
-# If we have an empty looking /var, populate it, but only if we have
-# /usr available.  Hopefully, we'll eventually find a workaround, but
-# in realistic diskless setups, we're probably ok.
+# If explicitly requested or we have an empty looking /var, populate it.
 case "${populate_var}" in
 [Yy][Ee][Ss])
 	populate_var
@@ -84,18 +101,8 @@ case "${populate_var}" in
 *)
 	if [ -d /var/run -a -d /var/db -a -d /var/empty ] ; then
 		true
-	elif [ -x /usr/sbin/mtree ] ; then
+	else
 		populate_var
-	else
-		# We need mtree to populate /var so try mounting /usr.
-		# If this does not work, we can not boot so it is OK to
-		# try to mount out of order.
-		mount /usr
-		if [ ! -x /usr/sbin/mtree ] ; then
-			exit 1
-		else
-			populate_var
-		fi
 	fi
 	;;
 esac
Index: share/man/man5/rc.conf.5
===================================================================
--- share/man/man5/rc.conf.5	(revision 276758)
+++ share/man/man5/rc.conf.5	(working copy)
@@ -386,6 +386,27 @@ Note that this process requires access to certain
 before
 .Pa /usr
 is mounted on normal systems.
+.It Va populate_var_mtree_enable
+.Pq Vt bool
+Use
+.Xr mtree 8
+to populate
+.Pa /var
+after it has been mounted.
+Default is
+.Dq Li YES .
+.It Va populate_var_files
+.Pq Vt str
+Files to be copied to
+.Pa /var
+after it has been mounted.
+.It Va populate_var_cmd
+.Pq Vt str
+Command to execute after
+.Pa /var
+has been mounted.
+Note that the command is passed to
+.Ic eval.
 .It Va cleanvar_enable
 .Pq Vt bool
 Clean the
