Rewrite the MD install script to use awk instead of grep, since

trying to include grep in the miniroot currently causes a build
failure, ref. PR#20431.

Also correct a typo/inconsistency "no disk label" -> "no disklabel"
(the disklabel program is not consistent in it's use...), here we
just compensate.

Reviewed by Steve Woodford.
This commit is contained in:
he 2003-03-07 17:00:22 +00:00
parent cf13cdc4df
commit 9042681cbb
2 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# $NetBSD: install.md,v 1.3 2001/08/16 19:14:41 tv Exp $ # $NetBSD: install.md,v 1.4 2003/03/07 17:00:22 he Exp $
# #
# Copyright (c) 1996 The NetBSD Foundation, Inc. # Copyright (c) 1996 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -113,14 +113,19 @@ md_native_fstype() {
md_native_fsopts() { md_native_fsopts() {
} }
grep_check () {
pattern=$1; shift
awk 'BEGIN{ es=1; } /'"$pattern"'/{ print; es=0; } END{ exit es; }' "$@"
}
md_checkfordisklabel() { md_checkfordisklabel() {
# $1 is the disk to check # $1 is the disk to check
local rval local rval
disklabel $1 > /dev/null 2> /tmp/checkfordisklabel disklabel $1 > /dev/null 2> /tmp/checkfordisklabel
if grep "no disk label" /tmp/checkfordisklabel; then if grep_check "no disklabel" /tmp/checkfordisklabel; then
rval=1 rval=1
elif grep "disk label corrupted" /tmp/checkfordisklabel; then elif grep_check "disk label corrupted" /tmp/checkfordisklabel; then
rval=2 rval=2
else else
rval=0 rval=0

View File

@ -1,4 +1,4 @@
# $NetBSD: list,v 1.12 2003/02/19 14:21:06 he Exp $ # $NetBSD: list,v 1.13 2003/03/07 17:00:23 he Exp $
# mvme68k's extras # mvme68k's extras
PROG sbin/disklabel PROG sbin/disklabel
@ -9,7 +9,6 @@ PROG usr/bin/basename
PROG usr/bin/cksum usr/bin/sum PROG usr/bin/cksum usr/bin/sum
PROG usr/bin/cut PROG usr/bin/cut
PROG usr/bin/gawk usr/bin/awk PROG usr/bin/gawk usr/bin/awk
PROG usr/bin/grep usr/bin/egrep usr/bin/fgrep
PROG usr/bin/netstat PROG usr/bin/netstat
PROG usr/bin/rsh PROG usr/bin/rsh
PROG usr/bin/tset usr/bin/reset PROG usr/bin/tset usr/bin/reset
@ -19,7 +18,6 @@ PROG usr/bin/less usr/bin/more
# crunchgen source directory specials # crunchgen source directory specials
SPECIAL less srcdir usr.bin/less/less SPECIAL less srcdir usr.bin/less/less
SPECIAL vi srcdir usr.bin/vi/build SPECIAL vi srcdir usr.bin/vi/build
SPECIAL grep srcdir gnu/usr.bin/grep/grep
# Minimize use of MFS # Minimize use of MFS
SYMLINK /tmp var/tmp SYMLINK /tmp var/tmp