Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/postinstall Make check_ids take an additional argum...



details:   https://anonhg.NetBSD.org/src/rev/220195e78f46
branches:  trunk
changeset: 333631:220195e78f46
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Nov 11 19:41:38 2014 +0000

description:
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".

diffstat:

 usr.sbin/postinstall/postinstall |  17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diffs (58 lines):

diff -r 1b738aba7da2 -r 220195e78f46 usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall  Tue Nov 11 19:22:32 2014 +0000
+++ b/usr.sbin/postinstall/postinstall  Tue Nov 11 19:41:38 2014 +0000
@@ -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_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 @@
        ' "$@" < "${_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 @@
        [ -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 @@
        [ -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
 }



Home | Main Index | Thread Index | Old Index