Module Name:    src
Committed By:   mrg
Date:           Fri Oct  7 02:07:56 UTC 2011

Modified Files:
        src/usr.sbin/postinstall: postinstall

Log Message:
fix the sendmail, mailerconf and atf checks to use ${DEST_DIR}.
add a note about this to the top of the file.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 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.125 src/usr.sbin/postinstall/postinstall:1.126
--- src/usr.sbin/postinstall/postinstall:1.125	Tue Sep  6 21:39:30 2011
+++ src/usr.sbin/postinstall/postinstall	Fri Oct  7 02:07:56 2011
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.125 2011/09/06 21:39:30 jym Exp $
+# $NetBSD: postinstall,v 1.126 2011/10/07 02:07:56 mrg Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -35,6 +35,10 @@
 #
 
 #
+# XXX BE SURE TO USE ${DEST_DIR} PREFIX BEFORE ALL REAL FILE OPERATIONS XXX
+#
+
+#
 # checks to add:
 #	- sysctl(8) renames (net.inet6.ip6.bindv6only -> net.inet6.ip6.v6only)
 #	- de* -> tlp* migration (/etc/ifconfig.de*, $ifconfig_de*,
@@ -1218,9 +1222,11 @@ do_sendmail()
 	for f in /etc/mail/helpfile /etc/mail/local-host-names \
 	    /etc/mail/sendmail.cf /etc/mail/submit.cf /etc/rc.d/sendmail \
 	    /etc/rc.d/smmsp /usr/share/misc/sendmail.hf \
-	    $(find /usr/share/sendmail -type f) \
-	    $(find /usr/share/sendmail -type d) /var/log/sendmail.st \
-	    /var/spool/clientmqueue /var/spool/mqueue; do
+	    $(find ${DEST_DIR}/usr/share/sendmail -type f) \
+	    $(find ${DEST_DIR}/usr/share/sendmail -type d) \
+	    ${DEST_DIR}/var/log/sendmail.st \
+	    ${DEST_DIR}/var/spool/clientmqueue \
+	    ${DEST_DIR}/var/spool/mqueue; do
 		[ -e "${DEST_DIR}${f}" ] && echo "${f}"
 	done | obsolete_paths "${op}"
 	failed=$(( ${failed} + $? ))
@@ -1238,7 +1244,7 @@ do_mailerconf()
 	op="$1"
 
 	failed=0
-	mta_path="$(${AWK} '/^sendmail[ \t]/{print$2}' /etc/mailer.conf)"
+	mta_path="$(${AWK} '/^sendmail[ \t]/{print$2}' ${DEST_DIR}/etc/mailer.conf)"
 	old_sendmail_path="/usr/libexec/sendmail/sendmail"
 	if [ "${mta_path}" = "${old_sendmail_path}" ]; then
 	    if [ "$op" = check ]; then
@@ -1556,18 +1562,18 @@ do_atf()
 	op="$1"
 	failed=0
 
-	if grep '[^#]*unprivileged-user[ \t]*=.*_atf' /etc/atf/common.conf \
+	if grep '[^#]*unprivileged-user[ \t]*=.*_atf' ${DEST_DIR}/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
+			    ${DEST_DIR}/etc/atf/common.conf >${DEST_DIR}/etc/atf/common.conf.new
 			failed=$(( ${failed} + $? ))
-			mv /etc/atf/common.conf.new /etc/atf/common.conf
+			mv ${DEST_DIR}/etc/atf/common.conf.new ${DEST_DIR}/etc/atf/common.conf
 			failed=$(( ${failed} + $? ))
 		else
-			msg "unprivileged-user=_atf in /etc/atf/common.conf" \
+			msg "unprivileged-user=_atf in ${DEST_DIR}/etc/atf/common.conf" \
 			    "should be _tests"
 			failed=1
 		fi

Reply via email to