svn commit: r235446 - stable/9/usr.sbin/pc-sysinstall/backend

Josh Paetzel jpaetzel at FreeBSD.org
Mon May 14 15:15:14 UTC 2012


Author: jpaetzel
Date: Mon May 14 15:15:13 2012
New Revision: 235446
URL: http://svn.freebsd.org/changeset/base/235446

Log:
  MFC: 235005
  
  Use a unique zpool name during install, in the case of having another
  PC-BSD / FreeBSD zpool on the system for another install.
  
  Submitted by:	kmoore
  Obtained from:	PC-BSD
  Sponsored by:	iXsystems

Modified:
  stable/9/usr.sbin/pc-sysinstall/backend/functions.sh
Directory Properties:
  stable/9/usr.sbin/pc-sysinstall/   (props changed)

Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions.sh
==============================================================================
--- stable/9/usr.sbin/pc-sysinstall/backend/functions.sh	Mon May 14 15:13:14 2012	(r235445)
+++ stable/9/usr.sbin/pc-sysinstall/backend/functions.sh	Mon May 14 15:15:13 2012	(r235446)
@@ -216,7 +216,7 @@ fetch_file()
 
   fetch -s "${FETCHFILE}" >${SIZEFILE}
   SIZE="`cat ${SIZEFILE}`"
-  SIZE="`expr ${SIZE} / 1024`"
+  SIZE=$((SIZE/1024))
   echo "FETCH: ${FETCHFILE}"
   echo "FETCH: ${FETCHOUTFILE}" >>${LOGOUT}
 
@@ -276,11 +276,22 @@ get_zpool_name()
   else
     # Need to generate a zpool name for this device
     NUM=`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'`
-    NEWNAME="${BASENAME}${NUM}"
+
+    # Is it used in another zpool?
+    while
+    z=1
+    do
+      NEWNAME="${BASENAME}${NUM}"
+      zpool import | grep -q "${NEWNAME}"
+      if [ $? -ne 0 ] ; then break ; fi
+      NUM=$((NUM+1))
+    done
+
+    # Now save the new tank name
     mkdir -p ${TMPDIR}/.zpools/`dirname $DEVICE`
     echo "$NEWNAME" >${TMPDIR}/.zpools/${DEVICE} 
     echo "${NEWNAME}"
-    return
+    return 0
   fi
 };
 


More information about the svn-src-stable-9 mailing list