Module Name: src Committed By: apb Date: Mon Jun 16 07:08:06 UTC 2014
Modified Files: src/usr.sbin/postinstall: postinstall Log Message: Add SORT and SED variables, in case a host environment needs them. To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 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.166 src/usr.sbin/postinstall/postinstall:1.167 --- src/usr.sbin/postinstall/postinstall:1.166 Fri Apr 25 00:23:26 2014 +++ src/usr.sbin/postinstall/postinstall Mon Jun 16 07:08:06 2014 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall,v 1.166 2014/04/25 00:23:26 mrg Exp $ +# $NetBSD: postinstall,v 1.167 2014/06/16 07:08:06 apb Exp $ # # Copyright (c) 2002-2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -58,6 +58,8 @@ : ${HOST_SH:=sh} : ${MAKE:=make} : ${PWD_MKDB:=/usr/sbin/pwd_mkdb} +: ${SED:=sed} +: ${SORT:=sort} : ${STAT:=stat} # @@ -121,7 +123,7 @@ shell_quote() # then insert ' at the beginning of the first line, # and append ' at the end of the last line. result="${result}$(printf "%s\n" "$arg" | \ - sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/")" + ${SED} -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/")" done printf "%s\n" "$result" } @@ -718,9 +720,9 @@ do_ddbonpanic() result=1 else echo >> "${DEST_DIR}/etc/sysctl.conf" - sed < "${SRC_DIR}/etc/sysctl.conf" \ + ${SED} < "${SRC_DIR}/etc/sysctl.conf" \ -e '/^ddb\.onpanic/q' | \ - sed -e '1,/^$/d' >> \ + ${SED} -e '1,/^$/d' >> \ "${DEST_DIR}/etc/sysctl.conf" result=$? fi @@ -1036,8 +1038,8 @@ do_motd() then tmp1="$(mktemp /tmp/postinstall.motd.XXXXXXXX)" tmp2="$(mktemp /tmp/postinstall.motd.XXXXXXXX)" - sed '1,2d' <"${SRC_DIR}/etc/motd" >"${tmp1}" - sed '1,2d' <"${DEST_DIR}/etc/motd" >"${tmp2}" + ${SED} '1,2d' <"${SRC_DIR}/etc/motd" >"${tmp1}" + ${SED} '1,2d' <"${DEST_DIR}/etc/motd" >"${tmp2}" if [ "$1" = check ]; then cmp -s "${tmp1}" "${tmp2}" @@ -1048,7 +1050,7 @@ do_motd() fi else head -n 2 "${DEST_DIR}/etc/motd" >"${tmp1}" - sed '1,2d' <"${SRC_DIR}/etc/motd" >>"${tmp1}" + ${SED} '1,2d' <"${SRC_DIR}/etc/motd" >>"${tmp1}" cp "${tmp1}" "${DEST_DIR}/etc/motd" result=0 fi @@ -1258,7 +1260,7 @@ do_rc() # generate scripts mkdir "${SCRATCHDIR}/rc" for f in ${generated_scripts}; do - sed -e "s,@X11ROOTDIR@,${X11ROOTDIR},g" \ + ${SED} -e "s,@X11ROOTDIR@,${X11ROOTDIR},g" \ < "${SRC_DIR}/etc/rc.d/${f}.in" \ > "${SCRATCHDIR}/rc/${f}" done @@ -1570,7 +1572,7 @@ ${pcpath} was a directory, should be a f # itself. If the directory contains unexpected extra files # then it will not be deleted. ( [ -f "${DEST_DIR}"/var/db/obsolete/xbase ] \ - && sort -ru "${DEST_DIR}"/var/db/obsolete/xbase \ + && ${SORT} -ru "${DEST_DIR}"/var/db/obsolete/xbase \ | ${GREP} -E "^\\.?${pcpath}/" ; echo "${pcpath}" ) \ | obsolete_paths "${op}" @@ -1697,7 +1699,7 @@ handle_atf_user() if grep '[^#]*unprivileged-user[ \t]*=.*_atf' "${conf}" >/dev/null then if [ "$1" = "fix" ]; then - sed -e \ + ${SED} -e \ "/[^#]*unprivileged-user[\ t]*=/s/_atf/_tests/" \ "${conf}" >"${conf}.new" failed=$(( ${failed} + $? )) @@ -1905,7 +1907,7 @@ do_obsolete() op="$1" failed=0 - sort -ru "${DEST_DIR}"/var/db/obsolete/* | obsolete_paths "${op}" + ${SORT} -ru "${DEST_DIR}"/var/db/obsolete/* | obsolete_paths "${op}" failed=$(( ${failed} + $? )) (