Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jul 2013 13:47:43 -0400
From:      "Michael W. Lucas" <mwlucas@michaelwlucas.com>
To:        pkg@freebsd.org
Subject:   "pkg upgrade -y" behavior differs in script vs command line
Message-ID:  <20130726174743.GA37930@bewilderbeast.blackhelicopters.org>

next in thread | raw e-mail | index | archive | help
Hi,

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.

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.

--
#!/bin/sh
FTP_PROXY=blah
HTTP_PROXY=blah
ftp_proxy=blah
http_proxy=blah

pkg_add -r pkg
echo "WITH_PKGNG=YES" >> /etc/make.conf
pkg2ng

cp pkg.conf /usr/local/etc/
chown root:wheel /usr/local/etc/pkg.conf

echo ""
echo "basic pkg config done, now let pkg upgrade itself"
pkg upgrade -y
pkg upgrade -y

echo "pkgng now installed, so installing packages"
--

(My setup script has more, but I've stripped the rest out while
debugging this one problem.)

When I run the script I get:

...
basic pkg config done, now let pkg upgrade itself
Updating repository catalogue
digests.txz                         100% 1040KB   1.0MB/s   1.0MB/s   00:00    
packagesite.txz                     100% 5689KB   1.9MB/s   2.2MB/s   00:03    
pkg: Invalid manifest format: mapping values are not allowed in this context
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

pkg install can't find any packages, even though 23554 should be there.

I run the command interactively and get:

# pkg upgrade -y
Updating repository catalogue
digests.txz                                100% 1011KB   1.0MB/s   1.0MB/s   00:00    
packagesite.txz                            100% 5689KB   5.6MB/s   3.3MB/s   00:01 
(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'

Uprgades have been requested for the following 1 packages:

        Reinstalling pkg-1.1.4_1 (needed shared library changed)

The upgrade will free 10 kB

1 MB to be downloaded
pkg-1.1.4_1.txz                            100% 1598KB   1.6MB/s   1.6MB/s   00:01    
Checking integrity... done
[1/1] Reinstalling pkg-1.1.4_1... done
#

Do I need to do something special to script pkg commands?

Thanks,
==ml

-- 
Michael W. Lucas  -  mwlucas@michaelwlucas.com, Twitter @mwlauthor 
http://www.MichaelWLucas.com/, http://blather.MichaelWLucas.com/
Absolute OpenBSD 2/e - http://www.nostarch.com/openbsd2e
coupon code "ILUVMICHAEL" gets you 30% off & helps me.



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