Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/postinstall Add SORT and SED variables, in case a h...



details:   https://anonhg.NetBSD.org/src/rev/51e1d18a2e4d
branches:  trunk
changeset: 796737:51e1d18a2e4d
user:      apb <apb%NetBSD.org@localhost>
date:      Mon Jun 16 07:08:06 2014 +0000

description:
Add SORT and SED variables, in case a host environment needs them.

diffstat:

 usr.sbin/postinstall/postinstall |  24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diffs (97 lines):

diff -r d73d60f2c5df -r 51e1d18a2e4d usr.sbin/postinstall/postinstall
--- a/usr.sbin/postinstall/postinstall  Mon Jun 16 03:43:10 2014 +0000
+++ b/usr.sbin/postinstall/postinstall  Mon Jun 16 07:08:06 2014 +0000
@@ -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 @@
                # 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 @@
                        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 @@
        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 @@
                        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 @@
                # 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 @@
        # 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 @@
        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 @@
        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} + $? ))
 
        (



Home | Main Index | Thread Index | Old Index