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.
@ -46,20 +46,10 @@ md_set_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() {
# 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_makerootwritable() {
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() {

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.
@ -46,14 +46,6 @@ md_set_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() {
# Mount root rw for convenience of the tester ;-)
if [ ! -e /tmp/.root_writable ]; then
@ -65,10 +57,8 @@ md_makerootwritable() {
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()

View File

@ -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 @@ __mfs_failed_1
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() {

View File

@ -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 @@ __mfs_failed_1
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() {

View File

@ -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 @@ local_sets_dir="" # Path searched for sets by install_sets
# 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 @@ get_localdir() {
_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 @@ addhostent() {
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 @@ To get a listing of what's available in /usr/share/zoneinfo, enter "?"
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 @@ __install_sets_1
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 @@ check_fs()
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
}

View File

@ -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 @@ md_set_term() {
# 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' \
< /kern/msgbuf | sort -u
mi_mount_kernfs
mi_filter_msgbuf | sed -ne '/^cd[0-9] /s/ .*//p'
}
md_get_ifdevs() {
# return available network devices
__mount_kernfs
sed -n -e '/^le[0-9] /s/ .*//p' \
-e '/^ie[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
mi_filter_msgbuf | sed -ne '/^[il]e[0-9] /s/ .*//p'
}
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.
@ -71,17 +71,17 @@ __mfs_failed_1
md_get_diskdevs() {
# 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() {
# 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() {
# 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() {

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.
@ -47,19 +47,11 @@ md_set_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() {
# Just remount the root device read-write.
if [ ! -e /tmp/root_writable ]; then
echo "Remounting root read-write..."
__mount_kernfs
mi_mount_kernfs
mount -u -t ffs /kern/rootdev /
swapctl -a /kern/rootdev
cp /dev/null /tmp/root_writable
@ -68,26 +60,21 @@ md_makerootwritable() {
md_get_diskdevs() {
# return available disk devices
__mount_kernfs
sed -n -e '/^sd[0-9] /s/ .*//p' \
-e '/^xd[0-9] /s/ .*//p' \
-e '/^xy[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
mi_mount_kernfs
mi_filter_msgbuf | sed -ne '/^[xs]d[0-9] /s/ .*//p' \
-e '/^xy[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_ifdevs() {
# return available network devices
__mount_kernfs
sed -n -e '/^ie[0-9] /s/ .*//p' \
-e '/^le[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
mi_mount_kernfs
mi_filter_msgbuf | sed -ne '/^[il]e[0-9] /s/ .*//p'
}
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.
@ -47,19 +47,11 @@ md_set_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() {
# Just remount the root device read-write.
if [ ! -e /tmp/root_writable ]; then
echo "Remounting root read-write..."
__mount_kernfs
mi_mount_kernfs
mount -u /kern/rootdev /
swapctl -a /kern/rootdev
cp /dev/null /tmp/root_writable
@ -68,26 +60,21 @@ md_makerootwritable() {
md_get_diskdevs() {
# return available disk devices
__mount_kernfs
sed -n -e '/^sd[0-9] /s/ .*//p' \
-e '/^xd[0-9] /s/ .*//p' \
-e '/^xy[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
mi_mount_kernfs
mi_filter_msgbuf | sed -ne '/^[xs]d[0-9] /s/ .*//p' \
-e '/^xy[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_ifdevs() {
# return available network devices
__mount_kernfs
sed -n -e '/^ie[0-9] /s/ .*//p' \
-e '/^le[0-9] /s/ .*//p' \
< /kern/msgbuf | sort -u
mi_mount_kernfs
mi_filter_msgbuf | sed -ne '/^[il]e[0-9] /s/ .*//p'
}
md_get_partition_range() {