adjust miniroot scripts to deal with the time prefix in dmesg

This commit is contained in:
christos 2019-04-10 14:52:53 +00:00
parent ac5a071282
commit a672382c55
9 changed files with 76 additions and 118 deletions

View File

@ -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. # Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@ -46,20 +46,10 @@ md_set_term() {
export TERM 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() { md_makerootwritable() {
# Mount root rw for convenience of the tester ;-) # Mount root rw for convenience of the tester ;-)
if ! cp /dev/null /tmp/.root_writable >/dev/null 2>&1; then if ! cp /dev/null /tmp/.root_writable >/dev/null 2>&1; then
__mount_kernfs mi_mount_kernfs
# XXX: Use /kern/rootdev instead? # XXX: Use /kern/rootdev instead?
mount -t ffs -u /kern/rootdev / > /dev/null 2>&1 mount -t ffs -u /kern/rootdev / > /dev/null 2>&1
fi fi
@ -67,16 +57,14 @@ md_makerootwritable() {
md_get_diskdevs() { md_get_diskdevs() {
# return available disk devices # return available disk devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^[sw]d[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^[sw]d[0-9] /s/ .*//p'
< /kern/msgbuf | sort -u
} }
md_get_cddevs() { md_get_cddevs() {
# return available CDROM devices # return available CDROM devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^cd[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^cd[0-9] /s/ .*//p'
< /kern/msgbuf | sort -u
} }
md_get_partition_range() { md_get_partition_range() {

View File

@ -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. # Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -46,14 +46,6 @@ md_set_term() {
export TERM 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() { md_makerootwritable() {
# Mount root rw for convenience of the tester ;-) # Mount root rw for convenience of the tester ;-)
if [ ! -e /tmp/.root_writable ]; then if [ ! -e /tmp/.root_writable ]; then
@ -65,10 +57,8 @@ md_makerootwritable() {
md_get_diskdevs() { md_get_diskdevs() {
# return available disk devices # return available disk devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^sd[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^[sw]d[0-9] /s/ .*//p'
-e '/^wd[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
} }
md_prep_disklabel() md_prep_disklabel()

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/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. # Copyright (c) 1996 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -69,18 +69,18 @@ __mfs_failed_1
md_get_diskdevs() { md_get_diskdevs() {
# return available disk devices # return available disk devices
dmesg | awk -F : '/^rd[0-9]*:./ { print $1; }' | sort -u mi_filter_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 : '/^sd[0-9]*:.*sectors/ { print $1; }' | sort -u
} }
md_get_cddevs() { md_get_cddevs() {
# return available CD-ROM devices # 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() { md_get_ifdevs() {
# return available network interfaces # 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() { md_installboot() {

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/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. # Copyright (c) 1996 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -69,18 +69,18 @@ __mfs_failed_1
md_get_diskdevs() { md_get_diskdevs() {
# return available disk devices # 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() { md_get_cddevs() {
# return available CD-ROM devices # 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() { md_get_ifdevs() {
# return available network interfaces # return available network interfaces
dmesg | awk -F : '/^ae[0-9]*:/ { print $1; }' | sort -u mi_filter_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 : '/^sn[0-9]*:/ { print $1; }' | sort -u
} }
md_installboot() { md_installboot() {

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/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. # Copyright (c) 1996 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -32,7 +32,7 @@
# NetBSD installation/upgrade script - common subroutines. # NetBSD installation/upgrade script - common subroutines.
ROOTDISK="" # filled in below ROOTDISK="" # filled in below
VERSION= # filled in automatically (see list) VERSION=89936
export VERSION export VERSION
ALLSETS="base comp etc games man misc text" # default install sets ALLSETS="base comp etc games man misc text" # default install sets
@ -43,7 +43,7 @@ local_sets_dir="" # Path searched for sets by install_sets
# on the local filesystems # on the local filesystems
# decide upon an editor # decide upon an editor
if [ X$EDITOR = X ]; then if [ -z "$EDITOR" ]; then
if [ -x /usr/bin/vi ]; then if [ -x /usr/bin/vi ]; then
EDITOR=vi EDITOR=vi
else else
@ -184,7 +184,7 @@ get_localdir() {
_mp=$1 _mp=$1
_dir= _dir=
while : ; do while : ; do
if [ X$_mp != X ]; then if [ -n "$_mp" ]; then
cat << __get_localdir_1 cat << __get_localdir_1
Note: your filesystems are mounted under the temporary mount point \"$_mp\". Note: your filesystems are mounted under the temporary mount point \"$_mp\".
The pathname you are requested to enter below should NOT include the \"$_mp\" The pathname you are requested to enter below should NOT include the \"$_mp\"
@ -298,7 +298,7 @@ addhostent() {
sed "/^$1 /d" < /tmp/hosts > /tmp/hosts.new sed "/^$1 /d" < /tmp/hosts > /tmp/hosts.new
mv /tmp/hosts.new /tmp/hosts mv /tmp/hosts.new /tmp/hosts
if [ X${FQDN} != X ]; then if [ -n "${FQDN}" ]; then
fqdn=$2.$FQDN fqdn=$2.$FQDN
fi fi
echo "$1 $2 $fqdn" >> /tmp/hosts echo "$1 $2 $fqdn" >> /tmp/hosts
@ -1305,7 +1305,7 @@ To get a listing of what's available in /usr/share/zoneinfo, enter "?"
at the prompts below. at the prompts below.
__get_timezone_1 __get_timezone_1
if [ X$TZ = X ]; then if [ -z "$TZ" ]; then
TZ=$(ls -l /mnt/etc/localtime 2>/dev/null | cutlast) TZ=$(ls -l /mnt/etc/localtime 2>/dev/null | cutlast)
TZ=${TZ#/usr/share/zoneinfo/} TZ=${TZ#/usr/share/zoneinfo/}
fi fi
@ -1385,17 +1385,17 @@ __install_sets_1
fi fi
if [ -n "${local_sets_dir}" ]; then if [ -n "${local_sets_dir}" ]; then
install_from_mounted_fs ${local_sets_dir} install_from_mounted_fs ${local_sets_dir}
if [ X"$_setsdone" != X ]; then if [ -n "$_setsdone" ]; then
_yup="TRUE" _yup="TRUE"
fi fi
fi fi
# Go on prodding for alternate locations # Go on prodding for alternate locations
resp="" # force at least one iteration 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 _yup is not FALSE, it means that we extracted sets above.
# If that's the case, bypass the menu the first time. # 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 "Install from (f)tp, (t)ape, (C)D-ROM, (N)FS"
echo -n " or local (d)isk? " echo -n " or local (d)isk? "
getresp "" getresp ""
@ -1597,3 +1597,22 @@ check_fs()
echo "Done." echo "Done."
) < $_fstab ) < $_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
}

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/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. # Copyright (c) 1996 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -48,41 +48,28 @@ md_set_term() {
# XXX call tset? # 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() { md_makerootwritable() {
# Just remount the root device read-write. # Just remount the root device read-write.
__mount_kernfs mi_mount_kernfs
echo "Remounting root read-write..." echo "Remounting root read-write..."
mount -t ffs -u /kern/rootdev / mount -t ffs -u /kern/rootdev /
} }
md_get_diskdevs() { md_get_diskdevs() {
# return available disk devices # return available disk devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^sd[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^sd[0-9] /s/ .*//p'
< /kern/msgbuf | sort -u
} }
md_get_cddevs() { md_get_cddevs() {
# return available CDROM devices # return available CDROM devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^cd[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^cd[0-9] /s/ .*//p'
< /kern/msgbuf | sort -u
} }
md_get_ifdevs() { md_get_ifdevs() {
# return available network devices # return available network devices
__mount_kernfs mi_filter_msgbuf | sed -ne '/^[il]e[0-9] /s/ .*//p'
sed -n -e '/^le[0-9] /s/ .*//p' \
-e '/^ie[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
} }
md_get_partition_range() { md_get_partition_range() {

View File

@ -1,4 +1,4 @@
# $NetBSD: install.md,v 1.23 2019/04/04 21:00:19 christos Exp $ # $NetBSD: install.md,v 1.24 2019/04/10 14:52:53 christos Exp $
# #
# #
# Copyright (c) 1996 The NetBSD Foundation, Inc. # Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -71,17 +71,17 @@ __mfs_failed_1
md_get_diskdevs() { md_get_diskdevs() {
# return available disk devices # return available disk devices
dmesg | sed -n -e 's/^\(sd[0-9]\) .*/\1/p' -e 's/^\(x[dy][0-9]\) .*/\1/p' | sort -u mi_filter_dmesg | sed -n -e 's/^\(sd[0-9]\) .*/\1/p' -e 's/^\(x[dy][0-9]\) .*/\1/p' | sort -u
} }
md_get_cddevs() { md_get_cddevs() {
# return available CDROM devices # return available CDROM devices
dmesg | sed -n -e 's/^\(cd[0-9]\) .*/\1/p' | sort -u mi_filter_dmesg | sed -n -e 's/^\(cd[0-9]\) .*/\1/p' | sort -u
} }
md_get_ifdevs() { md_get_ifdevs() {
# return available network devices # return available network devices
dmesg | sed -n -e 's/^\(le[0-9]\) .*/\1/p' -e 's/^\(ie[0-9]\) .*/\1/p' | sort -u mi_filter_dmesg | sed -n -e 's/^\(le[0-9]\) .*/\1/p' -e 's/^\(ie[0-9]\) .*/\1/p' | sort -u
} }
md_get_partition_range() { md_get_partition_range() {

View File

@ -1,4 +1,4 @@
# $NetBSD: install.md,v 1.4 2019/04/04 21:00:19 christos Exp $ # $NetBSD: install.md,v 1.5 2019/04/10 14:52:53 christos Exp $
# #
# #
# Copyright (c) 1996 The NetBSD Foundation, Inc. # Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -47,19 +47,11 @@ md_set_term() {
export TERM 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() { md_makerootwritable() {
# Just remount the root device read-write. # Just remount the root device read-write.
if [ ! -e /tmp/root_writable ]; then if [ ! -e /tmp/root_writable ]; then
echo "Remounting root read-write..." echo "Remounting root read-write..."
__mount_kernfs mi_mount_kernfs
mount -u -t ffs /kern/rootdev / mount -u -t ffs /kern/rootdev /
swapctl -a /kern/rootdev swapctl -a /kern/rootdev
cp /dev/null /tmp/root_writable cp /dev/null /tmp/root_writable
@ -68,26 +60,21 @@ md_makerootwritable() {
md_get_diskdevs() { md_get_diskdevs() {
# return available disk devices # return available disk devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^sd[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^[xs]d[0-9] /s/ .*//p' \
-e '/^xd[0-9] /s/ .*//p' \ -e '/^xy[0-9] /s/ .*//p'
-e '/^xy[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
} }
md_get_cddevs() { md_get_cddevs() {
# return available CDROM devices # return available CDROM devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^cd[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^cd[0-9] /s/ .*//p'
< /kern/msgbuf | sort -u
} }
md_get_ifdevs() { md_get_ifdevs() {
# return available network devices # return available network devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^ie[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^[il]e[0-9] /s/ .*//p'
-e '/^le[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
} }
md_get_partition_range() { md_get_partition_range() {

View File

@ -1,4 +1,4 @@
# $NetBSD: install.md,v 1.4 2019/04/04 21:00:19 christos Exp $ # $NetBSD: install.md,v 1.5 2019/04/10 14:52:53 christos Exp $
# #
# #
# Copyright (c) 1996 The NetBSD Foundation, Inc. # Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -47,19 +47,11 @@ md_set_term() {
export TERM 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() { md_makerootwritable() {
# Just remount the root device read-write. # Just remount the root device read-write.
if [ ! -e /tmp/root_writable ]; then if [ ! -e /tmp/root_writable ]; then
echo "Remounting root read-write..." echo "Remounting root read-write..."
__mount_kernfs mi_mount_kernfs
mount -u /kern/rootdev / mount -u /kern/rootdev /
swapctl -a /kern/rootdev swapctl -a /kern/rootdev
cp /dev/null /tmp/root_writable cp /dev/null /tmp/root_writable
@ -68,26 +60,21 @@ md_makerootwritable() {
md_get_diskdevs() { md_get_diskdevs() {
# return available disk devices # return available disk devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^sd[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^[xs]d[0-9] /s/ .*//p' \
-e '/^xd[0-9] /s/ .*//p' \ -e '/^xy[0-9] /s/ .*//p'
-e '/^xy[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
} }
md_get_cddevs() { md_get_cddevs() {
# return available CDROM devices # return available CDROM devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^cd[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^cd[0-9] /s/ .*//p'
< /kern/msgbuf | sort -u
} }
md_get_ifdevs() { md_get_ifdevs() {
# return available network devices # return available network devices
__mount_kernfs mi_mount_kernfs
sed -n -e '/^ie[0-9] /s/ .*//p' \ mi_filter_msgbuf | sed -ne '/^[il]e[0-9] /s/ .*//p'
-e '/^le[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
} }
md_get_partition_range() { md_get_partition_range() {