Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jul 2013 20:29:04 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        "Michael W. Lucas" <mwlucas@michaelwlucas.com>
Cc:        pkg@freebsd.org
Subject:   Re: "pkg upgrade -y" behavior differs in script vs command line
Message-ID:  <51F2CE00.5060901@infracaninophile.co.uk>
In-Reply-To: <20130726174743.GA37930@bewilderbeast.blackhelicopters.org>
References:  <20130726174743.GA37930@bewilderbeast.blackhelicopters.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--f5uxUuFnoPaBw7KUfEW00vmS65F8Edrsg
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 26/07/2013 18:47, Michael W. Lucas wrote:
> Hi,
>=20
> I'm testing a 9.2-beta box, and want to deploy pkgng immediately upon
> installation. I'm writing a script to do this automatically, before
> any packages get installed.
>=20
> pkg upgrade -y behaves differently in a script versus the command
> line. Do I need to do something special to make pkg upgrade work in a
> script? The script and output follow.
>=20
> --
> #!/bin/sh
> FTP_PROXY=3Dblah
> HTTP_PROXY=3Dblah
> ftp_proxy=3Dblah
> http_proxy=3Dblah
>=20
> pkg_add -r pkg
> echo "WITH_PKGNG=3DYES" >> /etc/make.conf
> pkg2ng
>=20
> cp pkg.conf /usr/local/etc/
> chown root:wheel /usr/local/etc/pkg.conf
>=20
> echo ""
> echo "basic pkg config done, now let pkg upgrade itself"
> pkg upgrade -y
> pkg upgrade -y
>=20
> echo "pkgng now installed, so installing packages"
> --
>=20
> (My setup script has more, but I've stripped the rest out while
> debugging this one problem.)
>=20
> When I run the script I get:
>=20
> ...
> basic pkg config done, now let pkg upgrade itself
> Updating repository catalogue
> digests.txz                         100% 1040KB   1.0MB/s   1.0MB/s   0=
0:00   =20
> packagesite.txz                     100% 5689KB   1.9MB/s   2.2MB/s   0=
0:03   =20
> pkg: Invalid manifest format: mapping values are not allowed in this co=
ntext
> Incremental update completed, 0 packages processed:
> 0 packages updated, 0 removed and 23554 added.
> pkg: No digest falling back on legacy catalog format
> packagesite repository catalogue is up-to-date, no need to fetch fresh =
copy
> Nothing to do
>=20
> pkg install can't find any packages, even though 23554 should be there.=

>=20
> I run the command interactively and get:
>=20
> # pkg upgrade -y
> Updating repository catalogue
> digests.txz                                100% 1011KB   1.0MB/s   1.0M=
B/s   00:00   =20
> packagesite.txz                            100% 5689KB   5.6MB/s   3.3M=
B/s   00:01=20
> (long pause as pkg eats ~90% of my cpu)
> Incremental update completed, 0 packages processed:
> 0 packages updated, 0 removed and 22912 added.
> New version of pkg detected; it needs to be installed first.
> After this upgrade it is recommended that you do a full upgrade using: =
'pkg upgrade'
>=20
> Uprgades have been requested for the following 1 packages:
>=20
>         Reinstalling pkg-1.1.4_1 (needed shared library changed)
>=20
> The upgrade will free 10 kB
>=20
> 1 MB to be downloaded
> pkg-1.1.4_1.txz                            100% 1598KB   1.6MB/s   1.6M=
B/s   00:01   =20
> Checking integrity... done
> [1/1] Reinstalling pkg-1.1.4_1... done
> #
>=20
> Do I need to do something special to script pkg commands?

There's nothing in the pkg(8) code designed to make it act differently
when run from a script rather than interactively.  At least, nothing
intentional.

Two possibilities:

   - there's something significantly different about the environment
within your script compared to your command line session, and that's
causing different behaviour.  Any of the variables in pkg.conf(5) can be
set in the environment and should override the settings in pkg.conf.

   - pkg(8) actually modified your package database the first time you
ran it in the script, and subsequently re-running it would have had a
different outcome whether run from the script or the command line.

Or I could be completely wrong, and you've discovered some rather
unfortunate unintentional misbehaviour.  Hmmm...

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.

PGP: http://www.infracaninophile.co.uk/pgpkey
JID: matthew@infracaninophile.co.uk


--f5uxUuFnoPaBw7KUfEW00vmS65F8Edrsg
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.16 (Darwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHyzggACgkQ8Mjk52CukIwAaQCeKmIWXXGOtv5flqJeIGpckklA
qpQAniVrft/79IKa/97xM3YB1xwTiiKR
=tp5f
-----END PGP SIGNATURE-----

--f5uxUuFnoPaBw7KUfEW00vmS65F8Edrsg--



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