svn commit: r214192 - head/usr.sbin/pc-sysinstall/backend-query

Warner Losh imp at FreeBSD.org
Fri Oct 22 00:11:56 UTC 2010


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'


More information about the svn-src-all mailing list