Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/usr.sbin/postinstall Pull up following revision(s) (reque...
details: https://anonhg.NetBSD.org/src/rev/713faef074be
branches: netbsd-6
changeset: 773773:713faef074be
user: riz <riz%NetBSD.org@localhost>
date: Sun Feb 19 18:35:55 2012 +0000
description:
Pull up following revision(s) (requested by apb in ticket #9):
usr.sbin/postinstall/postinstall: revision 1.130
Add "pwd_mkdb" item, which checks whether /etc/pwd.db is in the
new format, and runs "pwd_mkdb -V 1 /etc/master.passwd" to fix it.
diffstat:
usr.sbin/postinstall/postinstall | 41 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 1 deletions(-)
diffs (68 lines):
diff -r 17c5a427d820 -r 713faef074be usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall Sun Feb 19 18:28:53 2012 +0000
+++ b/usr.sbin/postinstall/postinstall Sun Feb 19 18:35:55 2012 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: postinstall,v 1.129 2012/02/15 13:01:00 joerg Exp $
+# $NetBSD: postinstall,v 1.129.2.1 2012/02/19 18:35:55 riz Exp $
#
# Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -53,10 +53,12 @@
# This script is executed as part of a cross build. Allow the build
# environment to override the locations of some tools.
: ${AWK:=awk}
+: ${DB:=db}
: ${EGREP:=egrep}
: ${FGREP:=fgrep}
: ${GREP:=grep}
: ${MAKE:=make}
+: ${PWD_MKDB:=/usr/sbin/pwd_mkdb}
#
# helper functions
@@ -1107,6 +1109,43 @@
}
#
+# pwd_mkdb
+#
+additem pwd_mkdb "passwd database version"
+do_pwd_mkdb()
+{
+ [ -n "$1" ] || err 3 "USAGE: do_pwd_mkdb fix|check"
+ op="$1"
+ failed=0
+
+ # XXX Ideally, we should figure out the endianness of the
+ # target machine, and add "-E B"/"-E L" to the db(1) flags,
+ # and "-B"/"-L" to the pwd_mkdb(8) flags if the target is not
+ # the same as the host machine. It probably doesn't matter,
+ # because we don't expect "postinstall fix pwd_mkdb" to be
+ # invoked during a cross build.
+
+ set -- $(${DB} -q -Sb -Ub -To -N hash ${DEST_DIR}/etc/pwd.db \
+ 'VERSION\0')
+ case "$2" in
+ '\001\000\000\000') return 0 ;; # version 1, little-endian
+ '\000\000\000\001') return 0 ;; # version 1, big-endian
+ esac
+
+ if [ "${op}" = "check" ]; then
+ msg "Update format of passwd database"
+ failed=1
+ elif ! ${PWD_MKDB} -V 1 ${DEST_DIR}/etc/master.passwd; then
+ msg "Can't update format of passwd database"
+ failed=1
+ else
+ msg "Updated format of passwd database"
+ fi
+
+ return ${failed}
+}
+
+#
# rc
#
additem rc "/etc/rc* and /etc/rc.d/ being up to date"
Home |
Main Index |
Thread Index |
Old Index