Source-Changes-HG archive

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

[src/trunk]: src/distrib adjust miniroot scripts to deal with the time prefix...



details:   https://anonhg.NetBSD.org/src/rev/5173d326a647
branches:  trunk
changeset: 450324:5173d326a647
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 10 14:52:53 2019 +0000

description:
adjust miniroot scripts to deal with the time prefix in dmesg

diffstat:

 distrib/amiga/miniroot/install.md         |  24 +++++---------------
 distrib/atari/floppies/prepare/install.md |  16 ++----------
 distrib/hp300/miniroot/install.md         |  10 ++++----
 distrib/mac68k/miniroot/install.md        |  10 ++++----
 distrib/miniroot/install.sub              |  37 +++++++++++++++++++++++-------
 distrib/mvme68k/miniroot/install.md       |  27 +++++----------------
 distrib/sparc/install.md                  |   8 +++---
 distrib/sun2/miniroot/install.md          |  31 +++++++------------------
 distrib/sun3/miniroot/install.md          |  31 +++++++------------------
 9 files changed, 76 insertions(+), 118 deletions(-)

diffs (truncated from 473 to 300 lines):

diff -r 2c2531811f0a -r 5173d326a647 distrib/amiga/miniroot/install.md
--- a/distrib/amiga/miniroot/install.md Wed Apr 10 10:57:51 2019 +0000
+++ b/distrib/amiga/miniroot/install.md Wed Apr 10 14:52:53 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: install.md,v 1.29 2019/04/04 21:00:19 christos Exp $
+#      $NetBSD: install.md,v 1.30 2019/04/10 14:52:53 christos Exp $
 #
 #
 # Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -46,20 +46,10 @@
        export TERM
 }
 
-__mount_kernfs() {
-       #
-       # Force kern_fs to be mounted
-       #
-       if [ ! -d /kern ] || [ ! -e /kern/msgbuf ]; then
-               mkdir /kern > /dev/null 2>&1
-               /sbin/mount_kernfs /kern /kern >/dev/null 2>&1
-       fi
-}
-
 md_makerootwritable() {
        # Mount root rw for convenience of the tester ;-)
        if ! cp /dev/null /tmp/.root_writable >/dev/null 2>&1; then
-               __mount_kernfs
+               mi_mount_kernfs
                # XXX: Use /kern/rootdev instead?
                mount -t ffs -u /kern/rootdev / > /dev/null 2>&1
        fi
@@ -67,16 +57,14 @@
 
 md_get_diskdevs() {
        # return available disk devices
-       __mount_kernfs
-       sed -n -e '/^[sw]d[0-9] /s/ .*//p' \
-               < /kern/msgbuf | sort -u
+       mi_mount_kernfs
+       mi_filter_msgbuf | sed  -ne '/^[sw]d[0-9] /s/ .*//p'
 }
 
 md_get_cddevs() {
        # return available CDROM devices
-       __mount_kernfs
-       sed -n -e '/^cd[0-9] /s/ .*//p' \
-               < /kern/msgbuf | sort -u
+       mi_mount_kernfs
+       mi_filter_msgbuf | sed -ne '/^cd[0-9] /s/ .*//p'
 }
 
 md_get_partition_range() {
diff -r 2c2531811f0a -r 5173d326a647 distrib/atari/floppies/prepare/install.md
--- a/distrib/atari/floppies/prepare/install.md Wed Apr 10 10:57:51 2019 +0000
+++ b/distrib/atari/floppies/prepare/install.md Wed Apr 10 14:52:53 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: install.md,v 1.5 2019/04/04 21:00:19 christos Exp $
+#      $NetBSD: install.md,v 1.6 2019/04/10 14:52:53 christos Exp $
 #
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -46,14 +46,6 @@
        export TERM
 }
 
-__mount_kernfs() {
-       # Make sure kernfs is mounted.
-       if [ ! -d /kern ] || [ ! -e /kern/msgbuf ]; then
-               mkdir /kern > /dev/null 2>&1
-               /sbin/mount_kernfs /kern /kern
-       fi
-}
-
 md_makerootwritable() {
        # Mount root rw for convenience of the tester ;-)
        if [ ! -e /tmp/.root_writable ]; then
@@ -65,10 +57,8 @@
 
 md_get_diskdevs() {
        # return available disk devices
-       __mount_kernfs
-       sed -n -e '/^sd[0-9] /s/ .*//p' \
-              -e '/^wd[0-9] /s/ .*//p' \
-               < /kern/msgbuf | sort -u
+       mi_mount_kernfs
+       mi_filter_msgbuf | sed -ne '/^[sw]d[0-9] /s/ .*//p'
 }
 
 md_prep_disklabel()
diff -r 2c2531811f0a -r 5173d326a647 distrib/hp300/miniroot/install.md
--- a/distrib/hp300/miniroot/install.md Wed Apr 10 10:57:51 2019 +0000
+++ b/distrib/hp300/miniroot/install.md Wed Apr 10 14:52:53 2019 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: install.md,v 1.16 2019/04/04 21:00:19 christos Exp $
+#      $NetBSD: install.md,v 1.17 2019/04/10 14:52:53 christos Exp $
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -69,18 +69,18 @@
 
 md_get_diskdevs() {
        # return available disk devices
-       dmesg | awk -F : '/^rd[0-9]*:./ { print $1; }' | sort -u
-       dmesg | awk -F : '/^sd[0-9]*:.*sectors/ { print $1; }' | sort -u
+       mi_filter_dmesg | awk -F : '/^rd[0-9]*:./ { print $1; }' | sort -u
+       mi_filter_dmesg | awk -F : '/^sd[0-9]*:.*sectors/ { print $1; }' | sort -u
 }
 
 md_get_cddevs() {
        # return available CD-ROM devices
-       dmesg | awk -F : '/^cd[0-9]*:/ { print $1; }' | sort -u
+       mi_filter_dmesg | awk -F : '/^cd[0-9]*:/ { print $1; }' | sort -u
 }
 
 md_get_ifdevs() {
        # return available network interfaces
-       dmesg | awk -F : '/^le[0-9]*:/ { print $1; }' | sort -u
+       mi_filter_dmesg | awk -F : '/^le[0-9]*:/ { print $1; }' | sort -u
 }
 
 md_installboot() {
diff -r 2c2531811f0a -r 5173d326a647 distrib/mac68k/miniroot/install.md
--- a/distrib/mac68k/miniroot/install.md        Wed Apr 10 10:57:51 2019 +0000
+++ b/distrib/mac68k/miniroot/install.md        Wed Apr 10 14:52:53 2019 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: install.md,v 1.4 2008/04/30 13:10:48 martin Exp $
+#      $NetBSD: install.md,v 1.5 2019/04/10 14:52:53 christos Exp $
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -69,18 +69,18 @@
 
 md_get_diskdevs() {
        # return available disk devices
-       dmesg | awk -F : '/^sd[0-9]*:.*cylinders/ { print $1; }' | sort -u
+       mi_filter_dmesg | awk -F : '/^sd[0-9]*:.*cylinders/ { print $1; }' | sort -u
 }
 
 md_get_cddevs() {
        # return available CD-ROM devices
-       dmesg | awk -F : '/cd[0-9]*:.*CD-ROM/ { print $1; }' | sort -u
+       mi_filter_dmesg | awk -F : '/cd[0-9]*:.*CD-ROM/ { print $1; }' | sort -u
 }
 
 md_get_ifdevs() {
        # return available network interfaces
-       dmesg | awk -F : '/^ae[0-9]*:/ { print $1; }' | sort -u
-       dmesg | awk -F : '/^sn[0-9]*:/ { print $1; }' | sort -u
+       mi_filter_dmesg | awk -F : '/^ae[0-9]*:/ { print $1; }' | sort -u
+       mi_filter_dmesg | awk -F : '/^sn[0-9]*:/ { print $1; }' | sort -u
 }
 
 md_installboot() {
diff -r 2c2531811f0a -r 5173d326a647 distrib/miniroot/install.sub
--- a/distrib/miniroot/install.sub      Wed Apr 10 10:57:51 2019 +0000
+++ b/distrib/miniroot/install.sub      Wed Apr 10 14:52:53 2019 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-#      $NetBSD: install.sub,v 1.47 2019/04/04 20:51:35 christos Exp $
+#      $NetBSD: install.sub,v 1.48 2019/04/10 14:52:53 christos Exp $
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -32,7 +32,7 @@
 #      NetBSD installation/upgrade script - common subroutines.
 
 ROOTDISK=""                            # filled in below
-VERSION=                               # filled in automatically (see list)
+VERSION=89936
 export VERSION
 
 ALLSETS="base comp etc games man misc text"    # default install sets
@@ -43,7 +43,7 @@
                                        # on the local filesystems
 
 # decide upon an editor
-if [ X$EDITOR = X ]; then
+if [ -z "$EDITOR" ]; then
        if [ -x /usr/bin/vi ]; then
                EDITOR=vi
        else
@@ -184,7 +184,7 @@
        _mp=$1
        _dir=
        while : ; do
-           if [ X$_mp != X ]; then
+           if [ -n "$_mp" ]; then
                cat << __get_localdir_1
 Note: your filesystems are mounted under the temporary mount point \"$_mp\".
 The pathname you are requested to enter below should NOT include the \"$_mp\"
@@ -298,7 +298,7 @@
        sed "/^$1 /d" < /tmp/hosts > /tmp/hosts.new
        mv /tmp/hosts.new /tmp/hosts
 
-       if [ X${FQDN} != X ]; then
+       if [ -n "${FQDN}" ]; then
                fqdn=$2.$FQDN
        fi
        echo "$1 $2 $fqdn" >> /tmp/hosts
@@ -1305,7 +1305,7 @@
 at the prompts below.
 
 __get_timezone_1
-       if [ X$TZ = X ]; then
+       if [ -z "$TZ" ]; then
                TZ=$(ls -l /mnt/etc/localtime 2>/dev/null | cutlast)
                TZ=${TZ#/usr/share/zoneinfo/}
        fi
@@ -1385,17 +1385,17 @@
        fi
        if [ -n "${local_sets_dir}" ]; then
                install_from_mounted_fs ${local_sets_dir}
-               if [ X"$_setsdone" != X ]; then
+               if [ -n "$_setsdone" ]; then
                        _yup="TRUE"
                fi
        fi
 
        # Go on prodding for alternate locations
        resp=""         # force at least one iteration
-       while [ X"${resp}" = X ]; do
+       while [ -z "${resp}" ]; do
                # If _yup is not FALSE, it means that we extracted sets above.
                # If that's the case, bypass the menu the first time.
-               if [ X"$_yup" = X"FALSE" ]; then
+               if [ "${_yup}" = "FALSE" ]; then
                        echo -n "Install from (f)tp, (t)ape, (C)D-ROM, (N)FS"
                        echo -n " or local (d)isk? "
                        getresp ""
@@ -1597,3 +1597,22 @@
                echo "Done."
        ) < $_fstab
 }
+
+mi_mount_kernfs() {
+       # Make sure kernfs is mounted.
+       if [ ! -d /kern ] || [ ! -e /kern/msgbuf ]; then
+               mkdir /kern > /dev/null 2>&1
+               /sbin/mount_kernfs /kern /kern
+       fi
+}
+
+mi_filter_msgbuf() {
+       # Remove timestemps, sort.
+       sed -e 's/^\[[0-9. ]*\] //' < /kern/msgbuf | sort -u
+}
+
+mi_filter_dmesg() {
+       # Remove timestemps, sort.
+       dmesg | awk '{ h=$0; gsub("^\[[0-9. ]*\] ", "", h); print h; }' \
+           | sort -u
+}
diff -r 2c2531811f0a -r 5173d326a647 distrib/mvme68k/miniroot/install.md
--- a/distrib/mvme68k/miniroot/install.md       Wed Apr 10 10:57:51 2019 +0000
+++ b/distrib/mvme68k/miniroot/install.md       Wed Apr 10 14:52:53 2019 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: install.md,v 1.7 2019/04/04 21:00:19 christos Exp $
+#      $NetBSD: install.md,v 1.8 2019/04/10 14:52:53 christos Exp $
 #
 # Copyright (c) 1996 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -48,41 +48,28 @@
        # XXX call tset?
 }
 
-__mount_kernfs() {
-       # Make sure kernfs is mounted.
-       if [ ! -d /kern ] || [ ! -e /kern/msgbuf ]; then
-               mkdir /kern > /dev/null 2>&1
-               /sbin/mount_kernfs /kern /kern >/dev/null 2>&1
-       fi
-}
-
 md_makerootwritable() {
        # Just remount the root device read-write.
-       __mount_kernfs
+       mi_mount_kernfs
        echo "Remounting root read-write..."
        mount -t ffs -u /kern/rootdev /
 }
 
 md_get_diskdevs() {
        # return available disk devices
-       __mount_kernfs
-       sed -n -e '/^sd[0-9] /s/ .*//p' \
-               < /kern/msgbuf | sort -u
+       mi_mount_kernfs
+       mi_filter_msgbuf | sed -ne '/^sd[0-9] /s/ .*//p'
 }
 
 md_get_cddevs() {
        # return available CDROM devices
-       __mount_kernfs
-       sed -n -e '/^cd[0-9] /s/ .*//p' \



Home | Main Index | Thread Index | Old Index