Module Name:    src
Committed By:   apb
Date:           Wed Feb 22 16:42:07 UTC 2012

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

Log Message:
quote SRC_DIR and DEST_DIR everywhere.  Also wrap some long lines.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 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.133 src/usr.sbin/postinstall/postinstall:1.134
--- src/usr.sbin/postinstall/postinstall:1.133	Wed Feb 22 16:27:38 2012
+++ src/usr.sbin/postinstall/postinstall	Wed Feb 22 16:42:07 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.133 2012/02/22 16:27:38 apb Exp $
+# $NetBSD: postinstall,v 1.134 2012/02/22 16:42:07 apb Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1023,7 +1023,7 @@ do_mtree()
 	if ! $SOURCEMODE; then
 		MTREE_DIR="${SRC_DIR}/etc/mtree"
 	else
-		${MAKE} -C ${SRC_DIR}/etc/mtree emit_dist_file > \
+		${MAKE} -C "${SRC_DIR}/etc/mtree" emit_dist_file > \
 		    "${SCRATCHDIR}/NetBSD.dist"
 		MTREE_DIR="${SCRATCHDIR}"
 	fi
@@ -1125,7 +1125,7 @@ do_pwd_mkdb()
 	# 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 \
+	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
@@ -1135,7 +1135,9 @@ do_pwd_mkdb()
 	if [ "${op}" = "check" ]; then
 		msg "Update format of passwd database"
 		failed=1
-	elif ! ${PWD_MKDB} -V 1 -d ${DEST_DIR:-/} ${DEST_DIR}/etc/master.passwd; then
+	elif ! ${PWD_MKDB} -V 1 -d "${DEST_DIR:-/}" \
+			"${DEST_DIR}/etc/master.passwd";
+	then
 		msg "Can't update format of passwd database"
 		failed=1
 	else
@@ -1262,11 +1264,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 ${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
+	    $(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} + $? ))
@@ -1284,7 +1286,8 @@ do_mailerconf()
 	op="$1"
 
 	failed=0
-	mta_path="$(${AWK} '/^sendmail[ \t]/{print$2}' ${DEST_DIR}/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
@@ -1578,11 +1581,11 @@ do_tcpdumpchroot()
 	[ -n "$1" ] || err 3 "USAGE: do_tcpdumpchroot  fix|check"
 
 	failed=0;
-	if [ -r ${DEST_DIR}/var/chroot/tcpdump/etc/protocols ]; then
+	if [ -r "${DEST_DIR}/var/chroot/tcpdump/etc/protocols" ]; then
 		if [ "$1" = "fix" ]; then
-			rm ${DEST_DIR}/var/chroot/tcpdump/etc/protocols
+			rm "${DEST_DIR}/var/chroot/tcpdump/etc/protocols"
 			failed=$(( ${failed} + $? ))
-			rmdir  ${DEST_DIR}/var/chroot/tcpdump/etc
+			rmdir "${DEST_DIR}/var/chroot/tcpdump/etc"
 			failed=$(( ${failed} + $? ))
 		else
 			failed=1
@@ -1602,18 +1605,21 @@ do_atf()
 	op="$1"
 	failed=0
 
-	if grep '[^#]*unprivileged-user[ \t]*=.*_atf' ${DEST_DIR}/etc/atf/common.conf \
-	    >/dev/null
+	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/" \
-			    ${DEST_DIR}/etc/atf/common.conf >${DEST_DIR}/etc/atf/common.conf.new
+			    "${DEST_DIR}/etc/atf/common.conf"\
+			    >"${DEST_DIR}/etc/atf/common.conf.new"
 			failed=$(( ${failed} + $? ))
-			mv ${DEST_DIR}/etc/atf/common.conf.new ${DEST_DIR}/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 ${DEST_DIR}/etc/atf/common.conf" \
+			msg "unprivileged-user=_atf in" \
+			    "${DEST_DIR}/etc/atf/common.conf" \
 			    "should be _tests"
 			failed=1
 		fi
@@ -1668,11 +1674,13 @@ do_catpages()
 	failed=0
 	for manbase in /usr/share/man /usr/X11R6/man /usr/X11R7/man; do
 		for sec in 1 2 3 4 5 6 7 8 9; do
-			obsolete_catpages $1 ${DEST_DIR}${manbase} ${sec}
+			obsolete_catpages "$1" "${DEST_DIR}${manbase}" "${sec}"
 			failed=$(( ${failed} + $? ))
 			if [ "$1" = "fix" ]; then
-				rmdir ${DEST_DIR}${manbase}/cat${sec}/* 2>/dev/null
-				rmdir ${DEST_DIR}${manbase}/cat${sec} 2>/dev/null
+				rmdir "${DEST_DIR}${manbase}/cat${sec}"/* \
+					2>/dev/null
+				rmdir "${DEST_DIR}${manbase}/cat${sec}" \
+					2>/dev/null
 			fi
 		done
 	done

Reply via email to