Module Name:    src
Committed By:   martin
Date:           Tue Nov 11 19:41:39 UTC 2014

Modified Files:
        src/usr.sbin/postinstall: postinstall

Log Message:
Make check_ids take an additional argument (the corresponding source
file) and grep that on error for the missing information, so the user
gets all the info needed how to "FIX MANUALLY".


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/usr.sbin/postinstall/postinstall

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.180 src/usr.sbin/postinstall/postinstall:1.181
--- src/usr.sbin/postinstall/postinstall:1.180	Thu Sep 11 13:10:04 2014
+++ src/usr.sbin/postinstall/postinstall	Tue Nov 11 19:41:38 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.180 2014/09/11 13:10:04 roy Exp $
+# $NetBSD: postinstall,v 1.181 2014/11/11 19:41:38 martin Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -229,12 +229,13 @@ check_dir()
 #	
 check_ids()
 {
-	[ $# -ge 5 ] || err 3 "USAGE: checks_ids op type file start id [...]"
+	[ $# -ge 6 ] || err 3 "USAGE: checks_ids op type file start srcfile id [...]"
 	_op="$1"
 	_type="$2"
 	_file="$3"
 	_start="$4"
-	shift 4
+	_srcfile="$5"
+	shift 5
 	#_ids="$@"
 
 	if [ ! -f "${_file}" ]; then
@@ -276,6 +277,14 @@ check_ids()
 	' "$@" < "${_file}")"	|| return 1
 	if [ -n "${_missing}" ]; then
 		msg "Error ${_type}${_notfixed}:" $(echo ${_missing})
+		msg "Use the following as a template:"
+		set -- ${_missing}
+		while [ $# -gt 0 ]
+		do
+			${GREP} -E "^${1}:" ${_srcfile}
+			shift 2
+		done
+		msg "and adjust if necessary."
 		return 1
 	fi
 	return 0
@@ -1019,6 +1028,7 @@ do_gid()
 	[ -n "$1" ] || err 3 "USAGE: do_gid  fix|check"
 
 	check_ids "$1" groups "${DEST_DIR}/etc/group" 14 \
+	    "${SRC_DIR}/etc/group" \
 	    named ntpd sshd SKIP _pflogd _rwhod staff _proxy _timedc \
 	    _sdpd _httpd _mdnsd _tests _tcpdump _tss _gpio _rtadvd
 }
@@ -1697,6 +1707,7 @@ do_uid()
 	[ -n "$1" ] || err 3 "USAGE: do_uid  fix|check"
 
 	check_ids "$1" users "${DEST_DIR}/etc/master.passwd" 12 \
+	    "${SRC_DIR}/etc/master.passwd" \
 	    postfix SKIP named ntpd sshd SKIP _pflogd _rwhod SKIP _proxy \
 	    _timedc _sdpd _httpd _mdnsd _tests _tcpdump _tss SKIP _rtadvd
 }

Reply via email to