Browse Source

Checkpoint of not quite working progress.

Douglas Thrift 7 years ago
commit
2a2ee3ea3e
4 changed files with 77 additions and 0 deletions
  1. 3 0
      .gitignore
  2. 47 0
      dt-freebsd-9.2-RC4.json
  3. 22 0
      http/installerconfig.sh
  4. 5 0
      scripts/vm_cleanup.sh

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+*.box
+output-*
+packer_cache

+ 47 - 0
dt-freebsd-9.2-RC4.json

@@ -0,0 +1,47 @@
+{
+    "builders": [
+        {
+            "type": "virtualbox",
+            "iso_checksum": "9379c1466b4b4d5c0a31a71f051dec7dae50e9d18379b58e5efd3ec59f8a6b40",
+            "iso_checksum_type": "sha256",
+            "iso_url": "http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/9.2/FreeBSD-9.2-RC4-amd64-disc1.iso",
+            "ssh_username": "vagrant",
+            "boot_command": [
+                "<enter>",
+                "<wait10><wait5>",
+                "s",
+                "mkdir -p /tmp/bsdinstall_etc<enter>",
+                "dhclient em0<enter>",
+                "<wait5>",
+                "fetch -o /tmp/installerconfig http://{{ .HTTPIP }}:{{ .HTTPPort }}/installerconfig.sh<enter>",
+                "<wait>",
+                "bsdinstall script /tmp/installerconfig<enter>",
+                "<wait10><wait10><wait10>",
+                "shutdown -r now<enter>"
+            ],
+            "guest_os_type": "FreeBSD_64",
+            "http_directory": "http",
+            "shutdown_command": "shutdown -p now",
+            "ssh_password": "vagrant"
+        }
+    ],
+
+    "provisioners": [
+        {
+            "type": "shell",
+            "script": "scripts/vm_cleanup.sh",
+            "override": {
+                "virtualbox": {
+                    "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
+                }
+            }
+        }
+    ],
+
+    "post-processors": [
+        {
+            "type": "vagrant",
+            "keep_input_artifact": true
+        }
+    ]
+}

+ 22 - 0
http/installerconfig.sh

@@ -0,0 +1,22 @@
+PARTITIONS=ada0
+DISTRIBUTIONS="base.txz kernel.txz games.txz lib32.txz"
+
+#!/bin/sh
+cat >> /etc/rc.conf <<EOF
+ifconfig_em0="DHCP"
+sshd_enable="YES"
+# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
+dumpdev="AUTO"
+EOF
+
+pw usermod root -h 0 <<EOF
+vagrant
+EOF
+
+pkg_add -r bash sudo
+sed -e 's/^# \(%wheel ALL=(ALL) ALL\)$/&/' -i .bak /usr/local/etc/sudoers
+
+adduser -f <<EOF
+vagrant::::::vagrant::bash:vagrant
+EOF
+pw usermod vagrant -G wheel

+ 5 - 0
scripts/vm_cleanup.sh

@@ -0,0 +1,5 @@
+#!/bin/sh
+
+rm -fv /var/db/dhclient.leases.*
+dd if=/dev/zero of=/EMPTY bs=1M
+rm -f /EMPTY