Date: Fri, 4 May 2012 20:22:00 +0200 From: Baptiste Daroussin <bapt@FreeBSD.org> To: Garrett Cooper <yanegomi@gmail.com> Cc: Josh Paetzel <jpaetzel@FreeBSD.org>, "svn-src-head@freebsd.org" <svn-src-head@FreeBSD.org>, "svn-src-all@freebsd.org" <svn-src-all@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "kmoore@freebsd.org" <kmoore@FreeBSD.org> Subject: Re: svn commit: r235005 - head/usr.sbin/pc-sysinstall/backend Message-ID: <20120504182200.GD1604@azathoth.lan> In-Reply-To: <F68AFF89-B9C3-494B-8B61-7130999BC354@gmail.com> References: <201205041531.q44FVaYF010236@svn.freebsd.org> <F68AFF89-B9C3-494B-8B61-7130999BC354@gmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Fri, May 04, 2012 at 09:33:38AM -0700, Garrett Cooper wrote: > On May 4, 2012, at 8:31 AM, Josh Paetzel <jpaetzel@FreeBSD.org> wrote: > > > 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)) > > Bug; should be '$SIZE/' No this is perfectly valid > > > 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 > > while : > do > > Is better. > > > + NEWNAME="${BASENAME}${NUM}" > > + zpool import | grep -q "${NEWNAME}" > > + if [ $? -ne 0 ] ; then break ; fi > > Please decompress the conditional. or zpool import | grep -q "${NEWNAME}" && break btw this is potentially buggy if there is a zpool named: a${NEWNAME}b for example zpool import | grep -qw "${NEWNAME}" && break should be perhaps better > > > + NUM=$((NUM+1)) > > Another bug (see above). > > Thanks, > -Garrett [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk+kHkgACgkQ8kTtMUmk6EwriACfTQPvFz9qT2HdxyQZUj3FA7zX N5oAoISZGfdLeNb1eUn41wHOke1rrjRG =oi4X -----END PGP SIGNATURE-----help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120504182200.GD1604>
