From cf66848908f58e3dcf269b7c4bcd1f5a5615349a Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 1 Apr 2016 22:52:55 -0700 Subject: [PATCH 1/2] Add FreeBSD 10.3 Also move the install script for FreeBSD 10 into a major version directory --- freebsd-10.2-amd64.json | 2 +- freebsd-10.2-i386.json | 2 +- freebsd-10.3-amd64.json | 229 +++++++++++++++++++ freebsd-10.3-i386.json | 229 +++++++++++++++++++ http/{freebsd-10.2 => freebsd-10}/install.sh | 2 +- http/freebsd-9.3/install.sh | 2 +- scripts/freebsd/postinstall.sh | 2 +- 7 files changed, 463 insertions(+), 5 deletions(-) create mode 100644 freebsd-10.3-amd64.json create mode 100644 freebsd-10.3-i386.json rename http/{freebsd-10.2 => freebsd-10}/install.sh (98%) diff --git a/freebsd-10.2-amd64.json b/freebsd-10.2-amd64.json index 51741705c..1d8c17db6 100644 --- a/freebsd-10.2-amd64.json +++ b/freebsd-10.2-amd64.json @@ -214,7 +214,7 @@ "headless": "", "http_proxy": "{{env `http_proxy`}}", "https_proxy": "{{env `https_proxy`}}", - "install_path": "freebsd-10.2/install.sh", + "install_path": "freebsd-10/install.sh", "iso_checksum": "97908f5cd00d86cafeb2c265bfabbd0aa79f87e9b6b31ecdb756bc96a4a62e93", "iso_checksum_type": "sha256", "iso_name": "FreeBSD-10.2-RELEASE-amd64-disc1.iso", diff --git a/freebsd-10.2-i386.json b/freebsd-10.2-i386.json index fbbe73571..73bb9e98b 100644 --- a/freebsd-10.2-i386.json +++ b/freebsd-10.2-i386.json @@ -214,7 +214,7 @@ "headless": "", "http_proxy": "{{env `http_proxy`}}", "https_proxy": "{{env `https_proxy`}}", - "install_path": "freebsd-10.2/install.sh", + "install_path": "freebsd-10/install.sh", "iso_checksum": "0e7094ae9f4f79d8955f193a1f2f5ab4f8b300e57eccd3b9bd959951ee079020", "iso_checksum_type": "sha256", "iso_name": "FreeBSD-10.2-RELEASE-i386-disc1.iso", diff --git a/freebsd-10.3-amd64.json b/freebsd-10.3-amd64.json new file mode 100644 index 000000000..a87504926 --- /dev/null +++ b/freebsd-10.3-amd64.json @@ -0,0 +1,229 @@ +{ + "builders": [ + { + "boot_command": [ + "", + "boot -s", + "", + "", + "/bin/sh", + "mdmfs -s 100m md1 /tmp", + "mdmfs -s 100m md2 /mnt", + "dhclient -l /tmp/dhclient.lease.em0 em0", + "fetch -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `install_path`}} && chmod +x /tmp/install.sh && /tmp/install.sh {{ .Name }}" + ], + "boot_wait": "10s", + "disk_size": 10140, + "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", + "guest_os_type": "FreeBSD_64", + "headless": "{{ user `headless` }}", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}", + "output_directory": "packer-{{user `template`}}-virtualbox", + "shutdown_command": "su -m root -c 'shutdown -p now'", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "type": "virtualbox-iso", + "vboxmanage": [ + [ + "modifyvm", + "{{.Name}}", + "--memory", + "512" + ], + [ + "modifyvm", + "{{.Name}}", + "--cpus", + "1" + ] + ], + "virtualbox_version_file": ".vbox_version", + "vm_name": "{{ user `template` }}" + }, + { + "boot_command": [ + "", + "boot -s", + "", + "", + "/bin/sh", + "mdmfs -s 100m md1 /tmp", + "mdmfs -s 100m md2 /mnt", + "dhclient -l /tmp/dhclient.lease.em0 em0", + "", + "fetch -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `install_path`}} && chmod +x /tmp/install.sh && /tmp/install.sh {{ .Name }}" + ], + "boot_wait": "10s", + "disk_size": 10140, + "guest_os_type": "freebsd-64", + "headless": "{{ user `headless` }}", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}", + "output_directory": "packer-{{user `template`}}-vmare", + "shutdown_command": "su -m root -c 'shutdown -p now'", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "tools_upload_flavor": "freebsd", + "type": "vmware-iso", + "vm_name": "{{ user `template` }}", + "vmx_data": { + "cpuid.coresPerSocket": "1", + "memsize": "512", + "numvcpus": "1" + } + }, + { + "boot_command": [ + "", + "boot -s", + "", + "", + "/bin/sh", + "mdmfs -s 100m md1 /tmp", + "mdmfs -s 100m md2 /mnt", + "dhclient -l /tmp/dhclient.lease.em0 em0", + "fetch -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `install_path`}} && chmod +x /tmp/install.sh && /tmp/install.sh {{ .Name }}" + ], + "boot_wait": "8s", + "disk_size": 10140, + "guest_os_type": "freebsd", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}", + "output_directory": "packer-{{user `template`}}-parallels", + "parallels_tools_mode": "disable", + "prlctl": [ + [ + "set", + "{{.Name}}", + "--memsize", + "512" + ], + [ + "set", + "{{.Name}}", + "--cpus", + "1" + ], + [ + "set", + "{{.Name}}", + "--device-set", + "cdrom0", + "--iface", + "ide" + ], + [ + "set", + "{{.Name}}", + "--device-del", + "fdd0" + ], + [ + "set", + "{{.Name}}", + "--device-del", + "parallel0" + ] + ], + "prlctl_version_file": ".prlctl_version", + "shutdown_command": "su -m root -c 'shutdown -p now'", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "type": "parallels-iso", + "vm_name": "{{ user `template` }}" + }, + { + "boot_command": [ + "", + "boot -s", + "", + "", + "/bin/sh", + "mdmfs -s 100m md1 /tmp", + "mdmfs -s 100m md2 /mnt", + "dhclient -l /tmp/dhclient.lease.vtnet0 vtnet0", + "fetch -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `install_path`}} && chmod +x /tmp/install.sh && /tmp/install.sh {{ .Name }} vtnet0" + ], + "boot_wait": "7s", + "disk_size": 10140, + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}", + "output_directory": "packer-{{user `template`}}-qemu", + "shutdown_command": "su -m root -c 'shutdown -p now'", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "type": "qemu", + "vm_name": "{{ user `template` }}" + } + ], + "post-processors": [ + { + "output": "builds/{{user `box_basename`}}.{{.Provider}}.box", + "type": "vagrant", + "vagrantfile_template": "vagrantfile_templates/freebsd.rb" + } + ], + "provisioners": [ + { + "destination": "/tmp/bento-metadata.json", + "source": "{{user `metadata`}}", + "type": "file" + }, + { + "environment_vars": [ + "HOME_DIR=/home/vagrant", + "http_proxy={{user `http_proxy`}}", + "https_proxy={{user `https_proxy`}}", + "no_proxy={{user `no_proxy`}}" + ], + "execute_command": "{{.Vars}} su -m root -c 'sh -eux {{.Path}}'", + "scripts": [ + "scripts/common/metadata.sh", + "scripts/freebsd/update.sh", + "scripts/freebsd/postinstall.sh", + "scripts/freebsd/sudoers.sh", + "scripts/common/vagrant.sh", + "scripts/freebsd/vmtools.sh", + "scripts/freebsd/cleanup.sh", + "scripts/freebsd/minimize.sh" + ], + "type": "shell" + } + ], + "variables": { + "box_basename": "freebsd-10.3", + "build_timestamp": "{{isotime \"20060102150405\"}}", + "git_revision": "__unknown_git_revision__", + "headless": "", + "http_proxy": "{{env `http_proxy`}}", + "https_proxy": "{{env `https_proxy`}}", + "install_path": "freebsd-10/install.sh", + "iso_checksum": "fef068cf6dea26923ab84b62ba9f21461ca0bdec90a0741c8ffb0e1ca29e410d", + "iso_checksum_type": "sha256", + "iso_name": "FreeBSD-10.3-RELEASE-amd64-disc1.iso", + "metadata": "floppy/dummy_metadata.json", + "mirror": "http://ftp.freebsd.org/pub/FreeBSD", + "mirror_directory": "releases/amd64/amd64/ISO-IMAGES/10.3", + "name": "freebsd-10.3", + "no_proxy": "{{env `no_proxy`}}", + "template": "freebsd-10.3-amd64", + "version": "2.1.TIMESTAMP" + } +} diff --git a/freebsd-10.3-i386.json b/freebsd-10.3-i386.json new file mode 100644 index 000000000..ce1f83050 --- /dev/null +++ b/freebsd-10.3-i386.json @@ -0,0 +1,229 @@ +{ + "builders": [ + { + "boot_command": [ + "", + "boot -s", + "", + "", + "/bin/sh", + "mdmfs -s 100m md1 /tmp", + "mdmfs -s 100m md2 /mnt", + "dhclient -l /tmp/dhclient.lease.em0 em0", + "fetch -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `install_path`}} && chmod +x /tmp/install.sh && /tmp/install.sh {{ .Name }}" + ], + "boot_wait": "10s", + "disk_size": 10140, + "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", + "guest_os_type": "FreeBSD", + "headless": "{{ user `headless` }}", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}", + "output_directory": "packer-{{user `template`}}-virtualbox", + "shutdown_command": "su -m root -c 'shutdown -p now'", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "type": "virtualbox-iso", + "vboxmanage": [ + [ + "modifyvm", + "{{.Name}}", + "--memory", + "512" + ], + [ + "modifyvm", + "{{.Name}}", + "--cpus", + "1" + ] + ], + "virtualbox_version_file": ".vbox_version", + "vm_name": "{{ user `template` }}" + }, + { + "boot_command": [ + "", + "boot -s", + "", + "", + "/bin/sh", + "mdmfs -s 100m md1 /tmp", + "mdmfs -s 100m md2 /mnt", + "dhclient -l /tmp/dhclient.lease.em0 em0", + "", + "fetch -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `install_path`}} && chmod +x /tmp/install.sh && /tmp/install.sh {{ .Name }}" + ], + "boot_wait": "10s", + "disk_size": 10140, + "guest_os_type": "freebsd", + "headless": "{{ user `headless` }}", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}", + "output_directory": "packer-{{user `template`}}-vmare", + "shutdown_command": "su -m root -c 'shutdown -p now'", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "tools_upload_flavor": "freebsd", + "type": "vmware-iso", + "vm_name": "{{ user `template` }}", + "vmx_data": { + "cpuid.coresPerSocket": "1", + "memsize": "512", + "numvcpus": "1" + } + }, + { + "boot_command": [ + "", + "boot -s", + "", + "", + "/bin/sh", + "mdmfs -s 100m md1 /tmp", + "mdmfs -s 100m md2 /mnt", + "dhclient -l /tmp/dhclient.lease.em0 em0", + "fetch -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `install_path`}} && chmod +x /tmp/install.sh && /tmp/install.sh {{ .Name }}" + ], + "boot_wait": "8s", + "disk_size": 10140, + "guest_os_type": "freebsd", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}", + "output_directory": "packer-{{user `template`}}-parallels", + "parallels_tools_mode": "disable", + "prlctl": [ + [ + "set", + "{{.Name}}", + "--memsize", + "512" + ], + [ + "set", + "{{.Name}}", + "--cpus", + "1" + ], + [ + "set", + "{{.Name}}", + "--device-set", + "cdrom0", + "--iface", + "ide" + ], + [ + "set", + "{{.Name}}", + "--device-del", + "fdd0" + ], + [ + "set", + "{{.Name}}", + "--device-del", + "parallel0" + ] + ], + "prlctl_version_file": ".prlctl_version", + "shutdown_command": "su -m root -c 'shutdown -p now'", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "type": "parallels-iso", + "vm_name": "{{ user `template` }}" + }, + { + "boot_command": [ + "", + "boot -s", + "", + "", + "/bin/sh", + "mdmfs -s 100m md1 /tmp", + "mdmfs -s 100m md2 /mnt", + "dhclient -l /tmp/dhclient.lease.vtnet0 vtnet0", + "fetch -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `install_path`}} && chmod +x /tmp/install.sh && /tmp/install.sh {{ .Name }}" + ], + "boot_wait": "7s", + "disk_size": 10140, + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}", + "output_directory": "packer-{{user `template`}}-qemu", + "shutdown_command": "su -m root -c 'shutdown -p now'", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "type": "qemu", + "vm_name": "{{ user `template` }}" + } + ], + "post-processors": [ + { + "output": "builds/{{user `box_basename`}}.{{.Provider}}.box", + "type": "vagrant", + "vagrantfile_template": "vagrantfile_templates/freebsd.rb" + } + ], + "provisioners": [ + { + "destination": "/tmp/bento-metadata.json", + "source": "{{user `metadata`}}", + "type": "file" + }, + { + "environment_vars": [ + "HOME_DIR=/home/vagrant", + "http_proxy={{user `http_proxy`}}", + "https_proxy={{user `https_proxy`}}", + "no_proxy={{user `no_proxy`}}" + ], + "execute_command": "{{.Vars}} su -m root -c 'sh -eux {{.Path}}'", + "scripts": [ + "scripts/common/metadata.sh", + "scripts/freebsd/update.sh", + "scripts/freebsd/postinstall.sh", + "scripts/freebsd/sudoers.sh", + "scripts/common/vagrant.sh", + "scripts/freebsd/vmtools.sh", + "scripts/freebsd/cleanup.sh", + "scripts/freebsd/minimize.sh" + ], + "type": "shell" + } + ], + "variables": { + "box_basename": "freebsd-10.3-i386", + "build_timestamp": "{{isotime \"20060102150405\"}}", + "git_revision": "__unknown_git_revision__", + "headless": "", + "http_proxy": "{{env `http_proxy`}}", + "https_proxy": "{{env `https_proxy`}}", + "install_path": "freebsd-10/install.sh", + "iso_checksum": "8329ee2ca4779892edbb001c303670d74642e4353e97d02f4521895023cacd5d", + "iso_checksum_type": "sha256", + "iso_name": "FreeBSD-10.3-RELEASE-i386-disc1.iso", + "metadata": "floppy/dummy_metadata.json", + "mirror": "http://ftp.freebsd.org/pub/FreeBSD", + "mirror_directory": "releases/i386/i386/ISO-IMAGES/10.3", + "name": "freebsd-10.3-i386", + "no_proxy": "{{env `no_proxy`}}", + "template": "freebsd-10.3-i386", + "version": "2.1.TIMESTAMP" + } +} diff --git a/http/freebsd-10.2/install.sh b/http/freebsd-10/install.sh similarity index 98% rename from http/freebsd-10.2/install.sh rename to http/freebsd-10/install.sh index aab273fe8..8757ffdbd 100644 --- a/http/freebsd-10.2/install.sh +++ b/http/freebsd-10/install.sh @@ -3,7 +3,7 @@ # Credit: http://www.aisecure.net/2011/05/01/root-on-zfs-freebsd-current/ # # Heavily re-adapted from https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot -# by Julian Dunn (jdunn@opscode.com) to remove legacy junk +# by Julian Dunn (jdunn@chef.io) to remove legacy junk NAME=$1 diff --git a/http/freebsd-9.3/install.sh b/http/freebsd-9.3/install.sh index aab273fe8..8757ffdbd 100644 --- a/http/freebsd-9.3/install.sh +++ b/http/freebsd-9.3/install.sh @@ -3,7 +3,7 @@ # Credit: http://www.aisecure.net/2011/05/01/root-on-zfs-freebsd-current/ # # Heavily re-adapted from https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot -# by Julian Dunn (jdunn@opscode.com) to remove legacy junk +# by Julian Dunn (jdunn@chef.io) to remove legacy junk NAME=$1 diff --git a/scripts/freebsd/postinstall.sh b/scripts/freebsd/postinstall.sh index 5fb23ad3e..649e90ee1 100644 --- a/scripts/freebsd/postinstall.sh +++ b/scripts/freebsd/postinstall.sh @@ -3,7 +3,7 @@ # Set the time correctly ntpdate -v -b in.pool.ntp.org; -# Install sudo, curl and ca_root_nss +# Install curl and ca_root_nss pkg install -y curl; pkg install -y ca_root_nss; From 11375c1573a4aaa6bdcf5ce785d268d253b56b5f Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 4 Apr 2016 12:21:05 -0700 Subject: [PATCH 2/2] Handle FreeBSD systems without any updates to install --- scripts/freebsd/update.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/freebsd/update.sh b/scripts/freebsd/update.sh index c98d0d163..5c17fcff6 100644 --- a/scripts/freebsd/update.sh +++ b/scripts/freebsd/update.sh @@ -18,9 +18,9 @@ else fi # Update FreeBSD -# NOTE: this will fail if there aren't any patches available for the release yet +# NOTE: the install action fails if there are no updates so || true it env PAGER=/bin/cat $freebsd_update fetch; -env PAGER=/bin/cat $freebsd_update install; +env PAGER=/bin/cat $freebsd_update install || true; # Always use pkgng - pkg_add is EOL as of 1 September 2014 env ASSUME_ALWAYS_YES=true pkg bootstrap;