Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 May 2012 15:31:36 +0000 (UTC)
From:      Josh Paetzel <jpaetzel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r235005 - head/usr.sbin/pc-sysinstall/backend
Message-ID:  <201205041531.q44FVaYF010236@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jpaetzel
Date: Fri May  4 15:31:35 2012
New Revision: 235005
URL: http://svn.freebsd.org/changeset/base/235005

Log:
  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
  MFC after:	3 days
  Sponsored by:	iXsystems

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh
==============================================================================
--- head/usr.sbin/pc-sysinstall/backend/functions.sh	Fri May  4 15:27:18 2012	(r235004)
+++ head/usr.sbin/pc-sysinstall/backend/functions.sh	Fri May  4 15:31:35 2012	(r235005)
@@ -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
 };
 



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