diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e34970ba8065b4365157b20794abafcdb536e9ec..89fa28db8e6b062f2d698c998dab3acdbbcc24de 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -47,6 +47,15 @@ build:cloud-qemu:
- "Arch-Linux-x86_64-cloudimg-*.*"
expire_in: 2d
+build:vagrant-virtualbox:
+ stage: build
+ tags:
+ - ipv6
+ before_script:
+ - pacman -Syu --needed --noconfirm packer qemu-headless
+ script:
+ - packer build -only=virtualbox -except publish vagrant.json
+
build:vagrant-qemu:
stage: build
tags:
@@ -54,7 +63,7 @@ build:vagrant-qemu:
before_script:
- pacman -Syu --needed --noconfirm packer qemu-headless
script:
- - packer build -only=qemu -except publish vagrant.json
+ - packer build -only=libvirt -except publish vagrant.json
publish:
stage: publish
@@ -62,7 +71,7 @@ publish:
- ipv6
- secure
before_script:
- - pacman -Syu --needed --noconfirm qemu-headless virtualbox packer
+ - pacman -Syu --needed --noconfirm qemu-headless packer
script:
- packer build -var "vagrant_cloud_token=$VAGRANT_API_TOKEN" vagrant.json
only:
diff --git a/box.ovf b/box.ovf
new file mode 100644
index 0000000000000000000000000000000000000000..3c54d1427317704d8402b8f9c39be1725940efeb
--- /dev/null
+++ b/box.ovf
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+ List of the virtual disks used in the package
+
+
+
+ Logical networks used in the package
+
+ Logical network used by this appliance.
+
+
+
+ A virtual machine
+
+ The kind of installed guest operating system
+ Linux26_64
+ ArchLinux_64
+
+
+ Virtual hardware requirements for a virtual machine
+
+ Virtual Hardware Family
+ 0
+ packer-virtualbox-UNIX
+ virtualbox-2.2
+
+ -
+ 2 virtual CPU
+ Number of virtual CPUs
+ 2 virtual CPU
+ 1
+ 3
+ 2
+
+ -
+ MegaBytes
+ 1024 MB of memory
+ Memory Size
+ 1024 MB of memory
+ 2
+ 4
+ 1024
+
+ -
+ 0
+ ideController0
+ IDE Controller
+ ideController0
+ 3
+ PIIX4
+ 5
+
+ -
+ 1
+ ideController1
+ IDE Controller
+ ideController1
+ 4
+ PIIX4
+ 5
+
+ -
+ 0
+ disk1
+ Disk Image
+ disk1
+ /disk/vmdisk1
+ 5
+ 3
+ 17
+
+ -
+ true
+ Ethernet adapter on 'NAT'
+ NAT
+ Ethernet adapter on 'NAT'
+ 6
+ E1000
+ 10
+
+
+
+ Complete VirtualBox machine configuration in VirtualBox format
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/post-processor/virtualbox.sh b/post-processor/virtualbox.sh
new file mode 100755
index 0000000000000000000000000000000000000000..aea54462e522f1906cab178221a4027aad7d7c7c
--- /dev/null
+++ b/post-processor/virtualbox.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+set -x
+
+cd "${OUTPUT}"
+qemu-img convert -f qcow2 -O vmdk "${VM_NAME}" "${VM_NAME}.vmdk"
+rm "${VM_NAME}"
+cp ../box.ovf .
+# VirtualBox-6.1.12 src/VBox/NetworkServices/Dhcpd/Config.cpp line 276
+sed -e "s/MACHINE_UUID/$(uuidgen)/" \
+ -e "s/DISK_UUID/$(uuidgen)/" \
+ -e "s/DISK_CAPACITY/$(qemu-img info --output=json "${VM_NAME}.vmdk" | jq '."virtual-size"')/" \
+ -e "s/UNIX/$(date +%s)/" \
+ -e "s/MAC_ADDRESS/080027$(openssl rand -hex 3 | tr '[:lower:]' '[:upper:]')/" \
+ -i box.ovf
diff --git a/vagrant.json b/vagrant.json
index 75e6d31866da128f7efa8b364945bf2d11940213..25c19efdd27d68dc908f0387d8979d13bc19c709 100644
--- a/vagrant.json
+++ b/vagrant.json
@@ -11,14 +11,14 @@
},
"builders": [
{
- "type": "virtualbox-iso",
+ "type": "qemu",
+ "name": "virtualbox",
"cpus": 2,
"memory": 1024,
"boot_wait": "{{user `boot_wait`}}",
"http_directory": "http",
+ "disk_discard": "unmap",
"disk_size": "{{user `disk_size`}}",
- "hard_drive_discard": "true",
- "guest_os_type": "ArchLinux_64",
"iso_checksum": "file:{{user `iso_checksum_url`}}",
"iso_url": "{{user `iso_url`}}",
"ssh_username": "vagrant",
@@ -26,8 +26,9 @@
"ssh_port": 22,
"ssh_timeout": "2000s",
"shutdown_command": "sudo systemctl poweroff",
- "guest_additions_mode": "disable",
"headless": "{{user `headless`}}",
+ "accelerator": "{{user `accelerator`}}",
+ "disk_compression": true,
"boot_command": [
"",
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'",
@@ -36,6 +37,7 @@
},
{
"type": "qemu",
+ "name": "libvirt",
"cpus": 2,
"memory": 1024,
"boot_wait": "{{user `boot_wait`}}",
@@ -69,7 +71,7 @@
],
"execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'",
"only": [
- "virtualbox-iso"
+ "virtualbox"
]
},
{
@@ -81,32 +83,42 @@
],
"execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'",
"only": [
- "qemu"
+ "libvirt"
]
}
],
"post-processors": [
[
{
- "name": "publish",
- "type": "vagrant",
- "keep_input_artifact": false,
- "output": "Arch-Linux-x86_64-{{ .Provider }}-{{isotime \"2006-01-02\"}}.box"
+ "type": "shell-local",
+ "only": [
+ "virtualbox"
+ ],
+ "environment_vars": [
+ "OUTPUT=output-{{build_name}}",
+ "VM_NAME=packer-{{build_name}}"
+ ],
+ "script": "post-processor/virtualbox.sh"
},
{
- "type": "vagrant-cloud",
+ "type": "artifice",
"only": [
- "virtualbox-iso"
+ "virtualbox"
],
- "access_token": "{{user `vagrant_cloud_token`}}",
- "box_tag": "archlinux/archlinux",
- "version": "{{isotime \"2006.01.02\"}}"
+ "files": [
+ "output-{{build_name}}/packer-{{build_name}}.vmdk",
+ "output-{{build_name}}/box.ovf"
+ ]
+ },
+ {
+ "name": "publish",
+ "type": "vagrant",
+ "keep_input_artifact": false,
+ "output": "Arch-Linux-x86_64-{{ .Provider }}-{{isotime \"2006-01-02\"}}.box",
+ "provider_override": "{{build_name}}"
},
{
"type": "vagrant-cloud",
- "only": [
- "qemu"
- ],
"access_token": "{{user `vagrant_cloud_token`}}",
"box_tag": "archlinux/archlinux",
"version": "{{isotime \"2006.01.02\"}}"