Dear Colin, Julian,

I am afraid the script is not working reliably when it is launched by Colin’s 
very useful configinit from EC2 user-data. If I run the same script from the 
shell prompt, it works. The difference is that pkg -r /mnt update -f fails a 
good few times, each time with these errors:

        /bin/sh: indexinfo: not found
        pkg: POST-INSTALL script failed

Is indexinfo something that I could manually add? I am sorry I am not more 
familiar with the inner workings of pkg…

Many thanks indeed,
Rafal 
 
> On 2 Jan 2018, at 21:17, Rafal Lukawiecki <r...@rafal.net> wrote:
> 
> Colin, Everyone,
> 
> Here is the final script that has managed to run, unattended! On a c4.x4large 
> it completes the task in 11 minutes, which is impressive, considering the 
> long list of packages (126). Following that, I am able to encrypt the AMI 
> while copying it across regions using:
> 
> aws ec2 copy-image --source-region us-east-1 --region eu-west-1 
> --source-image-id ami-x --encrypted --name “My FreeBSD"
> 
> If you would like to update your blog post with this, now fully tested 
> script, perhaps others would benefit. Please note credit is due to Julian, 
> who got me unstuck regarding pkg -c and resolv.conf, many thanks, Julian.
> 
> #!/bin/sh
> set -x
> export ASSUME_ALWAYS_YES=YES
> PKGS_TO_INSTALL=“list of packages to install"
> pkg -r /mnt fetch -d $PKGS_TO_INSTALL
> pkg -r /mnt update -f
> mv /mnt/etc/resolv.conf /mnt/etc/resolv.conf.orig
> cp /etc/resolv.conf /mnt/etc/resolv.conf
> yes n | pkg -c /mnt -o ASSUME_ALWAYS_YES=YES install $PKGS_TO_INSTALL
> mv /mnt/etc/resolv.conf.orig /mnt/etc/resolv.conf
> svnlite --non-interactive --trust-server-cert-failures=unknown-ca co 
> https://svn.freebsd.org/base/releng/11.1/ /usr/src/
> cd /usr/src
> cat > /tmp/kernel.patch <<EOT
> *** patches to apply ***
> EOT
> patch < /tmp/kernel.patch
> make DESTDIR=/mnt kernel -j16
> mkami "FreeBSD 11.1 Custom AMI” “My custom AMI description"
> shutdown -p now
> 
> Rafal
> --
> Rafal Lukawiecki
> Data Scientist 
> Project Botticelli Ltd

_______________________________________________
freebsd-cloud@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-cloud
To unsubscribe, send any mail to "freebsd-cloud-unsubscr...@freebsd.org"

Reply via email to