Ah, perhaps pkg -c simply cannot access /var/db/pkg/repo-FreeBSD.sqlite because 
it is chrooted?

> On 2 Jan 2018, at 19:19, Rafal Lukawiecki <[email protected]> wrote:
> 
> 
>> On 2 Jan 2018, at 03:05, Julian Elischer <[email protected] 
>> <mailto:[email protected]>> wrote:
>>> #!/bin/sh
>>> export ASSUME_ALWAYS_YES=YES
>>> PKGS_TO_INSTALL=lots of packages go here
>>> pkg -r /mnt fetch -d $PKGS_TO_INSTALL
>>> pkg -c /mnt install $PKGS_TO_INSTALL
>> please explain to me the  use of -r AND -c?
>> if you use -r to populate a chroot for -c then should that be pkg add rater 
>> than pkg install?
> 
> Julian, I am afraid I have blindly followed the suggestion from 
> http://www.daemonology.net/blog/2015-11-21-FreeBSD-AMI-builder-AMI.html 
> <http://www.daemonology.net/blog/2015-11-21-FreeBSD-AMI-builder-AMI.html> 
> which suggested this script to preinstall the packages in the system mounted 
> on /mnt 
> 
> #!/bin/sh
> export ASSUME_ALWAYS_YES=YES
> pkg -r /mnt fetch -d apache24
> pkg -c /mnt install apache24
> echo apache24_enable=YES >> /mnt/etc/rc.conf
> mkami "FreeBSD 10.2 w/ Apache 2.4" "FreeBSD with Apache pre-installed"
> shutdown -p now
> 
> Perhaps Colin might be able to chime in on the original intent?
> 
> My goal is to have packages installed, together with the patched kernel, then 
> to power off the machine and use it as a template for others, saving the 3 
> minutes of the initial package installation process, in our case. I have 
> tried your suggestion of “add” but it did not work, either. I wonder if this 
> somehow related to inability of pkg -c to resolve names in this AMI.
> 
> When I try this manually, not using the above scripts, these are the results 
> and errors I get:
> 
> $ pkg -r /mnt update -f
> Updating FreeBSD repository catalogue...
> pkg: Repository FreeBSD load error: access repo 
> file(/mnt/var/db/pkg/repo-FreeBSD.sqlite) failed: No such file or directory
> Fetching meta.txz: 100%    944 B   0.9kB/s    00:01
> Fetching packagesite.txz: 100%    6 MiB   6.1MB/s    00:01
> Processing entries: 100%
> FreeBSD repository update completed. 26993 packages processed.
> All repositories are up to date.
> 
> $ pkg -c /mnt install awscli
> Updating FreeBSD repository catalogue...
> pkg: http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly/meta.txz: 
> <http://pkg.freebsd.org/FreeBSD:11:amd64/quarterly/meta.txz:> No address 
> record
> repository FreeBSD has no meta file, using default settings
> pkg: http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly/packagesite.txz: 
> <http://pkg.freebsd.org/FreeBSD:11:amd64/quarterly/packagesite.txz:> No 
> address record
> Unable to update repository FreeBSD
> Error updating repositories!
> 
> $ pkg -c /mnt add awscli
> pkg: awscli: No such file or directory
> pkg: Was 'pkg install awscli' meant?
> Failed to install the following 1 package(s): awscli
> 
> Many thanks, everyone.
> Rafal

_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-cloud
To unsubscribe, send any mail to "[email protected]"

Reply via email to