Skip site navigation (1)Skip section navigation (2)
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>

next in thread | previous in thread | raw e-mail | index | archive | help

--bajzpZikUji1w+G9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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:
>=20
> > Author: jpaetzel
> > Date: Fri May  4 15:31:35 2012
> > New Revision: 235005
> > URL: http://svn.freebsd.org/changeset/base/235005
> >=20
> > Log:
> >  Use a unique zpool name during install, in the case of having another
> >  PC-BSD / FreeBSD zpool on the system for another install.
> >=20
> >  Submitted by:    kmoore
> >  Obtained from:    PC-BSD
> >  MFC after:    3 days
> >  Sponsored by:    iXsystems
> >=20
> > Modified:
> >  head/usr.sbin/pc-sysinstall/backend/functions.sh
> >=20
> > Modified: head/usr.sbin/pc-sysinstall/backend/functions.sh
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
> > --- head/usr.sbin/pc-sysinstall/backend/functions.sh    Fri May  4 15:2=
7:18 2012    (r235004)
> > +++ head/usr.sbin/pc-sysinstall/backend/functions.sh    Fri May  4 15:3=
1:35 2012    (r235005)
> > @@ -216,7 +216,7 @@ fetch_file()
> >=20
> >   fetch -s "${FETCHFILE}" >${SIZEFILE}
> >   SIZE=3D"`cat ${SIZEFILE}`"
> > -  SIZE=3D"`expr ${SIZE} / 1024`"
> > +  SIZE=3D$((SIZE/1024))
>=20
> Bug; should be '$SIZE/'

No this is perfectly valid
>=20
> >   echo "FETCH: ${FETCHFILE}"
> >   echo "FETCH: ${FETCHOUTFILE}" >>${LOGOUT}
> >=20
> > @@ -276,11 +276,22 @@ get_zpool_name()
> >   else
> >     # Need to generate a zpool name for this device
> >     NUM=3D`ls ${TMPDIR}/.zpools/ | wc -l | sed 's| ||g'`
> > -    NEWNAME=3D"${BASENAME}${NUM}"
> > +
> > +    # Is it used in another zpool?
> > +    while
> > +    z=3D1
> > +    do
>=20
> while :
> do
>=20
> Is better.
>=20
> > +      NEWNAME=3D"${BASENAME}${NUM}"
> > +      zpool import | grep -q "${NEWNAME}"
> > +      if [ $? -ne 0 ] ; then break ; fi
>=20
> Please decompress the conditional.
or=20

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

>=20
> > +      NUM=3D$((NUM+1))
>=20
> Another bug (see above).
>=20
> Thanks,
> -Garrett

--bajzpZikUji1w+G9
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iEYEARECAAYFAk+kHkgACgkQ8kTtMUmk6EwriACfTQPvFz9qT2HdxyQZUj3FA7zX
N5oAoISZGfdLeNb1eUn41wHOke1rrjRG
=oi4X
-----END PGP SIGNATURE-----

--bajzpZikUji1w+G9--



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