Module Name: src
Committed By: jmmv
Date: Tue Aug 9 18:24:46 UTC 2011
Modified Files:
src/usr.sbin/postinstall: postinstall
Log Message:
Check (and fix) that unprivileged-user has been changed from _atf to _tests
in /etc/atf/common.conf. Requested by martin@.
To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 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.121 src/usr.sbin/postinstall/postinstall:1.122
--- src/usr.sbin/postinstall/postinstall:1.121 Fri Aug 5 14:43:41 2011
+++ src/usr.sbin/postinstall/postinstall Tue Aug 9 18:24:46 2011
@@ -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)
#