Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 2010 00:11:55 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r214192 - head/usr.sbin/pc-sysinstall/backend-query
Message-ID:  <201010220011.o9M0Bt2E008115@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Oct 22 00:11:55 2010
New Revision: 214192
URL: http://svn.freebsd.org/changeset/base/214192

Log:
  More simplifications
  
  Submitted by:	 Alex Kozlov

Modified:
  head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh
  head/usr.sbin/pc-sysinstall/backend-query/test-live.sh

Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh
==============================================================================
--- head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh	Fri Oct 22 00:10:48 2010	(r214191)
+++ head/usr.sbin/pc-sysinstall/backend-query/disk-info.sh	Fri Oct 22 00:11:55 2010	(r214192)
@@ -26,25 +26,16 @@
 # $FreeBSD$
 
 # Query a disk for partitions and display them
-#############################
+#############################################################################
 
-. ${PROGDIR}/backend/functions.sh
 . ${PROGDIR}/backend/functions-disk.sh
 
-if [ -z "${1}" ]
-then
-  echo "Error: No disk specified!"
-  exit 1
-fi
-
-if [ ! -e "/dev/${1}" ]
-then
-  echo "Error: Disk /dev/${1} does not exist!"
-  exit 1
-fi
-
 DISK="${1}"
 
+[ -z "${DISK}" ] && { echo 'Error: No disk specified!'; exit 1; }
+[ ! -e "/dev/${DISK}" ] && \
+	{ echo "Error: Disk /dev/${DISK} does not exist!"; exit 1; }
+
 get_disk_cyl "${DISK}"
 CYLS="${VAL}"
 

Modified: head/usr.sbin/pc-sysinstall/backend-query/test-live.sh
==============================================================================
--- head/usr.sbin/pc-sysinstall/backend-query/test-live.sh	Fri Oct 22 00:10:48 2010	(r214191)
+++ head/usr.sbin/pc-sysinstall/backend-query/test-live.sh	Fri Oct 22 00:11:55 2010	(r214192)
@@ -28,13 +28,6 @@
 # Script which checks if we are running from install media, or real system
 #############################################################################
 
-dmesg | grep "md0: Preloaded image" >/dev/null 2>/dev/null
-if [ "$?" = "0" ]
-then
-  echo "INSTALL-MEDIA"
-  exit 0
-else
-  echo "REAL-DISK"
-  exit 1
-fi
+dmesg | grep -q 'md0: Preloaded image' || { echo 'REAL-DISK'; exit 1; }
 
+echo 'INSTALL-MEDIA'



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010220011.o9M0Bt2E008115>