From 13f768ce0eb7067833700cb3612974052857c002 Mon Sep 17 00:00:00 2001 From: Christian Rebischke Date: Sat, 10 Aug 2019 09:50:45 +0200 Subject: [PATCH] added a possibility to build boxes locally This approach disables vagrant cloud uploads. It's supposed to fix #44 Signed-off-by: Christian Rebischke --- README.md | 7 +-- local.json | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 143 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7a2228c..093b285 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,12 @@ Here is an overview over all variables you can set in `vagrant.json` or the ISO before entering any command. ## how to start the build process locally -Edit the `local.json` before you start the build. set the right -`iso_url` and the right `iso_checksum_url`. Then you can start the build +If you want to build the boxes locally without uploading them to the Vagrant +cloud you need to edit the `local.json` before you start the build. set the +right `iso_url` and the right `iso_checksum_url`. Then you can start the build for virtualbox only with the following command: -`packer build -only=virtualbox-iso -var-file=local.json vagrant.json` +`packer build -only=virtualbox-iso local.json` ## how to start the build process for official builds The official builds are done on our Arch Linux Buildserver. diff --git a/local.json b/local.json index 5f6f671..5397abd 100644 --- a/local.json +++ b/local.json @@ -1,4 +1,6 @@ { + "variables": { + "iso_url": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2018.10.01-x86_64.iso", "iso_checksum_url": "https://mirror.rackspace.com/archlinux/iso/latest/sha1sums.txt", "iso_checksum_type": "sha1", @@ -6,8 +8,144 @@ "memory": "1024", "cpus": "2", "headless": "true", - "vagrant_cloud_token": "PLACEHOLDER", "write_zeroes": "", "boot_wait": "60s" + }, + "builders": [ + { + "type": "virtualbox-iso", + "boot_wait": "{{user `boot_wait`}}", + "http_directory": "http", + "disk_size": "{{user `disk_size`}}", + "guest_os_type": "ArchLinux_64", + "iso_checksum_url": "{{user `iso_checksum_url`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "sudo systemctl poweroff", + "guest_additions_mode": "disable", + "headless": "{{user `headless`}}", + "vboxmanage": [ + [ + "modifyvm", + "{{.Name}}", + "--memory", + "{{user `memory`}}" + ], + [ + "modifyvm", + "{{.Name}}", + "--cpus", + "{{user `cpus`}}" + ] + ], + "boot_command": [ + "", + "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-chroot}.sh'", + "bash install.sh < install-chroot.sh && systemctl reboot" + ] + }, { + "type": "qemu", + "boot_wait": "{{user `boot_wait`}}", + "http_directory": "http", + "disk_size": "{{user `disk_size`}}", + "iso_checksum_url": "{{user `iso_checksum_url`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "sudo systemctl poweroff", + "headless": "{{user `headless`}}", + "qemuargs": [ + [ + "-m", + "{{user `memory`}}" + ], + [ + "-smp", + "{{user `cpus`}}" + ] + ], + "boot_command": [ + "", + "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-chroot}.sh'", + "bash install.sh < install-chroot.sh && systemctl reboot" + ] + }, { + "type": "vmware-iso", + "boot_wait": "{{user `boot_wait`}}", + "http_directory": "http", + "disk_size": "{{user `disk_size`}}", + "iso_checksum_url": "{{user `iso_checksum_url`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "sudo systemctl poweroff", + "headless": "{{user `headless`}}", + "memory": "{{user `memory`}}", + "cpus": "{{user `cpus`}}", + "boot_command": [ + "", + "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-chroot}.sh'", + "bash install.sh < install-chroot.sh && systemctl reboot" + ] + } + ], + "provisioners": [ + { + "type": "shell", + "scripts": [ + "provision/postinstall.sh", + "provision/virtualbox.sh", + "provision/cleanup.sh" + ], + "execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'", + "only": ["virtualbox-iso"] + }, + { + "type": "shell", + "scripts": [ + "provision/postinstall.sh", + "provision/qemu.sh", + "provision/cleanup.sh" + ], + "execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'", + "only": ["qemu"] + }, + { + "type": "shell", + "scripts": [ + "provision/postinstall.sh", + "provision/vmware.sh", + "provision/cleanup.sh" + ], + "execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'", + "only": ["vmware-iso"] + }, + { + "type": "shell", + "scripts": [ + "provision/write_zeroes.sh" + ], + "execute_command": "if [ ! -z \"{{user `write_zeroes`}}\" ]; then echo 'vagrant'|sudo -S sh '{{.Path}}'; fi" + } + ], + "post-processors": [ + [ + { + "type": "vagrant", + "keep_input_artifact": false, + "output": "Arch-Linux-x86_64-{{ .Provider }}-{{isotime \"2006-01-02\"}}.box" + } + ] + ] }