Skip to content

Commit

Permalink
Improve FreeBSD Support
Browse files Browse the repository at this point in the history
  • Loading branch information
zachfi authored and mcanevet committed Oct 11, 2017
1 parent cb5266f commit 369c1ec
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
12 changes: 11 additions & 1 deletion facts/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,18 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
host.vm.provision "shell", path: "get_facts.sh"
host.vm.provision "shell", inline: "/sbin/shutdown -h now"
end
config.vm.define "freebsd-11-x86_64" do |host|
host.vm.box = "bento/freebsd-11.1"
host.ssh.shell = '/bin/sh'
host.vm.network :private_network, ip: '10.0.0.2'
host.vm.synced_folder ".", "/vagrant", :nfs => true
host.vm.provision "shell", inline: "pkg install -y devel/ruby-gems"
host.vm.provision "file", source: "Gemfile", destination: "Gemfile"
host.vm.provision "shell", path: "get_facts.sh"
host.vm.provision "shell", inline: "/sbin/shutdown -h now"
end
config.vm.define "freebsd-10-x86_64" do |host|
host.vm.box = "chef/freebsd-10.0"
host.vm.box = "bento/freebsd-10.3"
host.vm.network :private_network, ip: '10.0.0.2'
host.vm.synced_folder ".", "/vagrant", :nfs => true
host.vm.provision "shell", inline: "pkg install -y devel/ruby-gems"
Expand Down
13 changes: 11 additions & 2 deletions facts/get_facts.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

export PATH=/opt/puppetlabs/bin:$PATH

Expand All @@ -15,6 +15,8 @@ elif test -f /usr/bin/dnf; then
elif test -f /usr/bin/yum; then
operatingsystemmajrelease=$(cat /etc/redhat-release | cut -d' ' -f4 | cut -c1)
osfamily='RedHat'
else
osfamily=$(uname)
fi

case "${osfamily}" in
Expand Down Expand Up @@ -58,6 +60,13 @@ case "${osfamily}" in
done
apt-get install -y make gcc libgmp-dev
;;
'FreeBSD')
pkg update
pkg install -y sysutils/puppet5 sysutils/facter
output_file="/vagrant/$(facter --version | cut -c1-3)/$(facter operatingsystem | tr '[:upper:]' '[:lower:]')-$(facter operatingsystemmajrelease)-$(facter hardwaremodel).facts"
mkdir -p $(dirname ${output_file})
[ ! -f ${output_file} ] && facter --show-legacy -p -j | tee ${output_file}
;;
esac

operatingsystem=$(facter operatingsystem | tr '[:upper:]' '[:lower:]')
Expand All @@ -71,7 +80,7 @@ PATH=/opt/puppetlabs/puppet/bin:$PATH
gem install bundler --no-ri --no-rdoc --no-format-executable
bundle install --path vendor/bundler

for version in 1.6.0 1.7.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0; do
for version in 1.6.0 1.7.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0; do
FACTER_GEM_VERSION="~> ${version}" bundle update
case "${operatingsystem}" in
openbsd)
Expand Down

0 comments on commit 369c1ec

Please sign in to comment.