From 202d71e3bf35c5c58f3c7ce8fc4313bd825e5320 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 6 Jul 2010 23:29:55 +0000 Subject: [PATCH] A few patches from Ed Maste by way of Kris Moore 1. Change detect-vmware to detect-emulation 2. improve laptop detection 3. better, network descriptions --- usr.sbin/pc-sysinstall/backend-query/Makefile | 2 +- .../backend-query/detect-laptop.sh | 9 ++++---- .../backend-query/detect-nics.sh | 21 +++++++------------ usr.sbin/pc-sysinstall/doc/help-index | 4 ++-- .../pc-sysinstall/pc-sysinstall.8 | 4 ++-- .../pc-sysinstall/pc-sysinstall.sh | 4 ++-- 6 files changed, 19 insertions(+), 25 deletions(-) diff --git a/usr.sbin/pc-sysinstall/backend-query/Makefile b/usr.sbin/pc-sysinstall/backend-query/Makefile index f516f0b662f6..1deed3f66fbf 100644 --- a/usr.sbin/pc-sysinstall/backend-query/Makefile +++ b/usr.sbin/pc-sysinstall/backend-query/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= detect-laptop.sh detect-nics.sh detect-vmware.sh disk-info.sh \ +FILES= detect-laptop.sh detect-nics.sh detect-emulation.sh disk-info.sh \ disk-list.sh disk-part.sh enable-net.sh list-config.sh list-components.sh \ list-mirrors.sh list-rsync-backups.sh list-tzones.sh query-langs.sh \ send-logs.sh setup-ssh-keys.sh sys-mem.sh test-live.sh test-netup.sh \ diff --git a/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh b/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh index 0c8c94a6db81..4772c2f5a6b0 100755 --- a/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh +++ b/usr.sbin/pc-sysinstall/backend-query/detect-laptop.sh @@ -25,9 +25,8 @@ # # $FreeBSD$ -dmesgLine=`dmesg | grep "acpi_acad0"` -if test "${dmesgLine}" = ""; then - echo "laptop: NO" -else +if devinfo | grep 'acpi_acad0' >/dev/null 2>/dev/null; then echo "laptop: YES" -fi +else + echo "laptop: NO" +fi diff --git a/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh b/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh index 57b5c51618eb..2f7272a6e2dc 100755 --- a/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh +++ b/usr.sbin/pc-sysinstall/backend-query/detect-nics.sh @@ -25,17 +25,12 @@ # # $FreeBSD$ -rm /tmp/netCards 2>/dev/null -touch /tmp/netCards - -config="`ifconfig -l`" - -for i in $config -do - echo "${i}" | grep -e "lo0" -e "^fwe" -e "^fwip" -e "lo1" -e "^plip" -e "^pfsync" -e "^pflog" -e "^tun" >/dev/null 2>/dev/null - if [ "$?" != "0" ] - then - IDENT="<`dmesg | grep ^${i} | grep -v "miibus" | grep '<' | cut -d '<' -f 2 | cut -d '>' -f 1 | head -1`>" - echo "${i}: $IDENT" - fi +for i in $(ifconfig -l); do + case "${i%%[0-9]*}" in + lo|fwe|fwip|plip|pfsync|pflog|tun) + continue + ;; + esac + IDENT=$(dmesg | sed -n "s/^$i: <\(.*\)>.*$/\1/p" | head -1) + echo "${i}: <$IDENT>" done diff --git a/usr.sbin/pc-sysinstall/doc/help-index b/usr.sbin/pc-sysinstall/doc/help-index index 2c7c4cb78c47..bb6cff145f49 100644 --- a/usr.sbin/pc-sysinstall/doc/help-index +++ b/usr.sbin/pc-sysinstall/doc/help-index @@ -22,8 +22,8 @@ System Query Commands detect-laptop Tests to see if this system is a laptop or desktop - detect-vmware - Tests to see if this system is actually a vmware session + detect-emulation + Tests to see if this system is actually running in an emulator such as VirtualBox detect-nics Returns a listing of the detected network cards on this system diff --git a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 index b6ea6989f7c8..15cece241103 100644 --- a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 +++ b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.8 @@ -69,8 +69,8 @@ Returns information about a storage device's size, cylinders, heads, and sectors. .It detect-laptop Tests to see if this system is a laptop or desktop. -.It detect-vmware -Tests to see if this system is a vmware session. +.It detect-emulation +Tests to see if this system is running in an emulator .It detect-nics Returns a listing of the detected network cards on this system. .It list-components diff --git a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh index 20254e6fd4cf..48608932372a 100755 --- a/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh +++ b/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh @@ -124,8 +124,8 @@ case $1 in detect-nics) ${QUERYDIR}/detect-nics.sh ;; - # The user is wanting to check if we are in vmware - detect-vmware) ${QUERYDIR}/detect-vmware.sh + # The user is wanting to check if we are in emulation + detect-emulation) ${QUERYDIR}/detect-emulation.sh ;; # The user is wanting to query a disk's information