Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/usr.sbin/postinstall Pull up following revision(s) (reque...



details:   https://anonhg.NetBSD.org/src/rev/771de50c57ec
branches:  netbsd-7
changeset: 798586:771de50c57ec
user:      snj <snj%NetBSD.org@localhost>
date:      Fri Nov 14 18:18:14 2014 +0000

description:
Pull up following revision(s) (requested by martin in ticket #220):
        usr.sbin/postinstall/postinstall: revision 1.181-1.183
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".
--
Change the order of arguments to check_ids, placing the two file names
adjacent to each other.  Also add a comment explaining the "start"
argument and the "SKIP" special value.
--
Fix tab/space inconsistency in comment.

diffstat:

 usr.sbin/postinstall/postinstall |  32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diffs (76 lines):

diff -r 2147edc440e3 -r 771de50c57ec usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall  Fri Nov 14 18:11:22 2014 +0000
+++ b/usr.sbin/postinstall/postinstall  Fri Nov 14 18:18:14 2014 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.175.2.2 2014/08/12 15:14:55 martin Exp $
+# $NetBSD: postinstall,v 1.175.2.3 2014/11/14 18:18:14 snj Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -223,18 +223,24 @@
        return 0
 }
 
-# check_ids op type file start id [...]
-#      Check if file of type "users" or "groups" contains the relevant IDs
+# check_ids op type file srcfile start id [...]
+#      Check if file of type "users" or "groups" contains the relevant IDs.
+#      Use srcfile as a reference for the expected contents.
+#      The specified "id" names should be given in numerical order,
+#      with the first name corresponding to numerical value "start",
+#      and with the special name "SKIP" being used to mark gaps in the
+#      sequence.
 #      Returns 0 if ok, 1 otherwise.
 #      
 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="$4"
+       _start="$5"
+       shift 5
        #_ids="$@"
 
        if [ ! -f "${_file}" ]; then
@@ -276,6 +282,14 @@
        ' "$@" < "${_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
@@ -1018,7 +1032,8 @@
 {
        [ -n "$1" ] || err 3 "USAGE: do_gid  fix|check"
 
-       check_ids "$1" groups "${DEST_DIR}/etc/group" 14 \
+       check_ids "$1" groups "${DEST_DIR}/etc/group" \
+           "${SRC_DIR}/etc/group" 14 \
            named ntpd sshd SKIP _pflogd _rwhod staff _proxy _timedc \
            _sdpd _httpd _mdnsd _tests _tcpdump _tss _gpio _rtadvd
 }
@@ -1696,7 +1711,8 @@
 {
        [ -n "$1" ] || err 3 "USAGE: do_uid  fix|check"
 
-       check_ids "$1" users "${DEST_DIR}/etc/master.passwd" 12 \
+       check_ids "$1" users "${DEST_DIR}/etc/master.passwd" \
+           "${SRC_DIR}/etc/master.passwd" 12 \
            postfix SKIP named ntpd sshd SKIP _pflogd _rwhod SKIP _proxy \
            _timedc _sdpd _httpd _mdnsd _tests _tcpdump _tss SKIP _rtadvd
 }



Home | Main Index | Thread Index | Old Index