Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/postinstall Check (and fix) that unprivileged-user ...



details:   https://anonhg.NetBSD.org/src/rev/662256a8a012
branches:  trunk
changeset: 768154:662256a8a012
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Tue Aug 09 18:24:46 2011 +0000

description:
Check (and fix) that unprivileged-user has been changed from _atf to _tests
in /etc/atf/common.conf.  Requested by martin@.

diffstat:

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

diffs (49 lines):

diff -r 192b7ba06ef5 -r 662256a8a012 usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall  Tue Aug 09 18:11:37 2011 +0000
+++ b/usr.sbin/postinstall/postinstall  Tue Aug 09 18:24:46 2011 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.121 2011/08/05 14:43:41 jmmv Exp $
+# $NetBSD: postinstall,v 1.122 2011/08/09 18:24:46 jmmv Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1524,6 +1524,37 @@
 
 
 #
+#      atf
+#
+additem atf "validate the _atf to _tests user/group renaming"
+do_atf()
+{
+       [ -n "$1" ] || err 3 "USAGE: do_atf  fix|check"
+       op="$1"
+       failed=0
+
+       if grep '[^#]*unprivileged-user[ \t]*=.*_atf' /etc/atf/common.conf \
+           >/dev/null
+       then
+               if [ "$1" = "fix" ]; then
+                       sed -e \
+                           "/[^#]*unprivileged-user[\ t]*=/s/_atf/_tests/" \
+                           /etc/atf/common.conf >/etc/atf/common.conf.new
+                       failed=$(( ${failed} + $? ))
+                       mv /etc/atf/common.conf.new /etc/atf/common.conf
+                       failed=$(( ${failed} + $? ))
+               else
+                       msg "unprivileged-user=_atf in /etc/atf/common.conf" \
+                           "should be _tests"
+                       failed=1
+               fi
+       fi
+
+       return ${failed}
+}
+
+
+#
 #      obsolete
 #      (this item is last to allow other items to move obsolete files)
 #



Home | Main Index | Thread Index | Old Index