From 1b961b46464996fa3a9011f054b1aaffb58b1ab8 Mon Sep 17 00:00:00 2001 From: "Julian C. Dunn" Date: Tue, 25 Nov 2014 18:18:31 -0500 Subject: [PATCH] Convert FreeBSD 9 to use pkgng. Closes #296. --- packer/scripts/freebsd/postinstall.sh | 21 ++++++++++----------- packer/scripts/freebsd/vmtools.sh | 3 +-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/packer/scripts/freebsd/postinstall.sh b/packer/scripts/freebsd/postinstall.sh index 195bcedff..d741ad298 100644 --- a/packer/scripts/freebsd/postinstall.sh +++ b/packer/scripts/freebsd/postinstall.sh @@ -15,19 +15,18 @@ chmod +x /tmp/freebsd-update env PAGER=/bin/cat /tmp/freebsd-update fetch env PAGER=/bin/cat /tmp/freebsd-update install -#Install sudo, curl and ca_root_nss -if [ $freebsd_major -gt 9 ]; then - # Use pkgng - env ASSUME_ALWAYS_YES=true pkg bootstrap - pkg update - pkg install -y sudo - pkg install -y curl - pkg install -y ca_root_nss -else - # Use old pkg - pkg_add -r sudo curl ca_root_nss +# always use pkgng - pkg_add is EOL as of 1 September 2014 +env ASSUME_ALWAYS_YES=true pkg bootstrap +if [ $freebsd_major -lt 10 ]; then + echo WITH_PKGNG=yes >> /etc/make.conf fi +#Install sudo, curl and ca_root_nss +pkg update +pkg install -y sudo +pkg install -y curl +pkg install -y ca_root_nss + # Emulate the ETCSYMLINK behavior of ca_root_nss; this is for FreeBSD 10, where fetch(1) was # massively refactored and doesn't come with SSL CAcerts anymore ln -sf /usr/local/share/certs/ca-root-nss.crt /etc/ssl/cert.pem diff --git a/packer/scripts/freebsd/vmtools.sh b/packer/scripts/freebsd/vmtools.sh index 1d7b9a5b8..9927f1760 100644 --- a/packer/scripts/freebsd/vmtools.sh +++ b/packer/scripts/freebsd/vmtools.sh @@ -1,11 +1,10 @@ #!/bin/sh freebsd_major=`uname -r | awk -F. '{ print $1 }'` +pkg_command="pkg install -y" if [ $freebsd_major -gt 9 ]; then - pkg_command="pkg install -y" perl_pkg="perl5" else - pkg_command="pkg_add -r" perl_pkg="perl" fi