Source-Changes-HG archive

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

[src/trunk]: src/etc - add [-m machine] support, from David Laight dsl@



details:   https://anonhg.NetBSD.org/src/rev/b66707ebef66
branches:  trunk
changeset: 543147:b66707ebef66
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Feb 18 10:12:52 2003 +0000

description:
- add [-m machine] support, from David Laight dsl@
- parenthesise some messages
- add some bugs and todo items

diffstat:

 etc/postinstall |  35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 deletions(-)

diffs (122 lines):

diff -r 453a4f142799 -r b66707ebef66 etc/postinstall
--- a/etc/postinstall   Tue Feb 18 10:09:28 2003 +0000
+++ b/etc/postinstall   Tue Feb 18 10:12:52 2003 +0000
@@ -1,8 +1,8 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.49 2003/01/21 14:28:55 abs Exp $
+# $NetBSD: postinstall,v 1.50 2003/02/18 10:12:52 lukem Exp $
 #
-# Copyright (c) 2002 The NetBSD Foundation, Inc.
+# Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
 # All rights reserved.
 #
 # This code is derived from software contributed to The NetBSD Foundation
@@ -41,14 +41,22 @@
 #      over time as NetBSD evolves.
 #
 
+# bugs:
+#      - may need MACHINE_ARCH set.
+#      - need MAKE set (c.f, uwe@)
+#      - makeobsolete needs copy of obsolete files, or better way to
+#        generate them
+
 #
 # checks to add:
+#      - obsolete minor/teeny shared libraries in /lib
 #      - sysctl(8) renames
 #      - de* -> tlp* migration (/etc/ifconfig.de*, $ifconfig_de*,
 #        dhclient.conf, ...) ?
 #      - support quiet/verbose mode ?
 #      - differentiate between failures caused by missing source
 #        and real failures
+#      - rm files before cp -f (incase of symlink)?
 #
 
 #
@@ -273,7 +281,8 @@
                : ${_dir1st:=${dir}}
                if [ -f "${dir}/${_file}" ]; then
                        if [ "${_dir1st}" != "${dir}" ]; then
-                               msg "Checking from ${dir} instead of ${_dir1st}"
+                               msg \
+                                 "(Checking from ${dir} instead of ${_dir1st})"
                        fi
                        return 0
                fi
@@ -519,7 +528,8 @@
                modulidir=$dirsrc
        elif [ -f "${diretc}"/moduli ]; then
                modulidir=$diretc
-               msg "Checking for moduli from ${modulidir} instead of ${dirsrc}"
+               msg \
+                 "(Checking for moduli from ${modulidir} instead of ${dirsrc})"
        else
                msg "Can't find source directory for etc/moduli"
                failed=1
@@ -665,14 +675,15 @@
 usage()
 {
        cat 1>&2 << _USAGE_
-Usage: ${PROGNAME} [-s srcdir] [-d destdir] operation [item [...]]
+Usage: ${PROGNAME} [-s srcdir] [-d destdir] [-m machine] operation [item [...]]
        Perform post-installation checks and/or fixes on a system's
-       configuration files.  If no items are provided, all checks
-       or fixes are applied.
+       configuration files.
+       If no items are provided, all checks or fixes are applied.
 
        Options:
        -s srcdir       Source directory to compare from.  [${SRC_DIR:-/}]
        -d destdir      Destination directory to check.    [${DEST_DIR:-/}]
+       -m machine      Machine architecture.              [${MACHINE}]
 
        Operation may be one of:
                help    display this help
@@ -699,12 +710,14 @@
 
 main()
 {
-       while getopts s:d: ch; do
+       while getopts s:d:m: ch; do
        case ${ch} in
        s)
                SRC_DIR=${OPTARG} ;;
        d)
                DEST_DIR=${OPTARG} ;;
+       m)
+               MACHINE=${OPTARG} ;;
        *)
                usage ;;
        esac
@@ -714,6 +727,7 @@
 
        [ -d "${SRC_DIR}" ]     || err 1 "${SRC_DIR} is not a directory"
        [ -d "${DEST_DIR}" ]    || err 1 "${DEST_DIR} is not a directory"
+       [ -n "${MACHINE}" ]     || err 1 "\${MACHINE} is not defined"
 
                # If directories are /, clear them, so various messages
                # don't have leading "//".   However, this requires
@@ -773,9 +787,10 @@
                echo "${PROGNAME} ${plural} passed:${items_passed}"
                echo "${PROGNAME} ${plural} failed:${items_failed}"
                if [ -n "${items_failed}" -a "${op}" = "check" ]; then
+                       [ "$MACHINE" = "$(uname -m)" ] && m= || m=" -m $MACHINE"
                        cat <<_Fix_me_
 To fix, run:
-    ${0} -s ${SRC_DIR} -d ${DEST_DIR:-/} fix${items_failed}
+    ${0} -s ${SRC_DIR} -d ${DEST_DIR:-/}$m fix${items_failed}
 _Fix_me_
                fi
 
@@ -812,8 +827,8 @@
 SRC_DIR="/usr/src"
 DEST_DIR="/"
 : ${MACHINE:=$( uname -m )}    # assume native build if $MACHINE is not set
+
 NOT_FIXED=" [NOT FIXED]"
-
 SCRATCHDIR=$( mkdtemp ) || err 1 "Can't create scratch directory"
 trap "/bin/rm -rf ${SCRATCHDIR} ; exit 0" 0 1 2 3 15   # EXIT HUP INT QUIT TERM
 



Home | Main Index | Thread Index | Old Index