Skip to content

Commit 13f768c

Browse files
author
Christian Rebischke
committed
added a possibility to build boxes locally
This approach disables vagrant cloud uploads. It's supposed to fix #44 Signed-off-by: Christian Rebischke <[email protected]>
1 parent e4bbbe0 commit 13f768c

File tree

2 files changed

+143
-4
lines changed

2 files changed

+143
-4
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ Here is an overview over all variables you can set in `vagrant.json` or
4040
the ISO before entering any command.
4141

4242
## how to start the build process locally
43-
Edit the `local.json` before you start the build. set the right
44-
`iso_url` and the right `iso_checksum_url`. Then you can start the build
43+
If you want to build the boxes locally without uploading them to the Vagrant
44+
cloud you need to edit the `local.json` before you start the build. set the
45+
right `iso_url` and the right `iso_checksum_url`. Then you can start the build
4546
for virtualbox only with the following command:
4647

47-
`packer build -only=virtualbox-iso -var-file=local.json vagrant.json`
48+
`packer build -only=virtualbox-iso local.json`
4849

4950
## how to start the build process for official builds
5051
The official builds are done on our Arch Linux Buildserver.

local.json

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,151 @@
11
{
2+
"variables": {
3+
24
"iso_url": "https://mirror.rackspace.com/archlinux/iso/latest/archlinux-2018.10.01-x86_64.iso",
35
"iso_checksum_url": "https://mirror.rackspace.com/archlinux/iso/latest/sha1sums.txt",
46
"iso_checksum_type": "sha1",
57
"disk_size": "20480",
68
"memory": "1024",
79
"cpus": "2",
810
"headless": "true",
9-
"vagrant_cloud_token": "PLACEHOLDER",
1011
"write_zeroes": "",
1112
"boot_wait": "60s"
13+
},
14+
"builders": [
15+
{
16+
"type": "virtualbox-iso",
17+
"boot_wait": "{{user `boot_wait`}}",
18+
"http_directory": "http",
19+
"disk_size": "{{user `disk_size`}}",
20+
"guest_os_type": "ArchLinux_64",
21+
"iso_checksum_url": "{{user `iso_checksum_url`}}",
22+
"iso_checksum_type": "{{user `iso_checksum_type`}}",
23+
"iso_url": "{{user `iso_url`}}",
24+
"ssh_username": "vagrant",
25+
"ssh_password": "vagrant",
26+
"ssh_port": 22,
27+
"ssh_wait_timeout": "10000s",
28+
"shutdown_command": "sudo systemctl poweroff",
29+
"guest_additions_mode": "disable",
30+
"headless": "{{user `headless`}}",
31+
"vboxmanage": [
32+
[
33+
"modifyvm",
34+
"{{.Name}}",
35+
"--memory",
36+
"{{user `memory`}}"
37+
],
38+
[
39+
"modifyvm",
40+
"{{.Name}}",
41+
"--cpus",
42+
"{{user `cpus`}}"
43+
]
44+
],
45+
"boot_command": [
46+
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
47+
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-chroot}.sh'<enter><wait>",
48+
"bash install.sh < install-chroot.sh && systemctl reboot<enter>"
49+
]
50+
}, {
51+
"type": "qemu",
52+
"boot_wait": "{{user `boot_wait`}}",
53+
"http_directory": "http",
54+
"disk_size": "{{user `disk_size`}}",
55+
"iso_checksum_url": "{{user `iso_checksum_url`}}",
56+
"iso_checksum_type": "{{user `iso_checksum_type`}}",
57+
"iso_url": "{{user `iso_url`}}",
58+
"ssh_username": "vagrant",
59+
"ssh_password": "vagrant",
60+
"ssh_port": 22,
61+
"ssh_wait_timeout": "10000s",
62+
"shutdown_command": "sudo systemctl poweroff",
63+
"headless": "{{user `headless`}}",
64+
"qemuargs": [
65+
[
66+
"-m",
67+
"{{user `memory`}}"
68+
],
69+
[
70+
"-smp",
71+
"{{user `cpus`}}"
72+
]
73+
],
74+
"boot_command": [
75+
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
76+
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-chroot}.sh'<enter><wait>",
77+
"bash install.sh < install-chroot.sh && systemctl reboot<enter>"
78+
]
79+
}, {
80+
"type": "vmware-iso",
81+
"boot_wait": "{{user `boot_wait`}}",
82+
"http_directory": "http",
83+
"disk_size": "{{user `disk_size`}}",
84+
"iso_checksum_url": "{{user `iso_checksum_url`}}",
85+
"iso_checksum_type": "{{user `iso_checksum_type`}}",
86+
"iso_url": "{{user `iso_url`}}",
87+
"ssh_username": "vagrant",
88+
"ssh_password": "vagrant",
89+
"ssh_port": 22,
90+
"ssh_wait_timeout": "10000s",
91+
"shutdown_command": "sudo systemctl poweroff",
92+
"headless": "{{user `headless`}}",
93+
"memory": "{{user `memory`}}",
94+
"cpus": "{{user `cpus`}}",
95+
"boot_command": [
96+
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
97+
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-chroot}.sh'<enter><wait>",
98+
"bash install.sh < install-chroot.sh && systemctl reboot<enter>"
99+
]
100+
}
12101

102+
],
103+
"provisioners": [
104+
{
105+
"type": "shell",
106+
"scripts": [
107+
"provision/postinstall.sh",
108+
"provision/virtualbox.sh",
109+
"provision/cleanup.sh"
110+
],
111+
"execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'",
112+
"only": ["virtualbox-iso"]
113+
},
114+
{
115+
"type": "shell",
116+
"scripts": [
117+
"provision/postinstall.sh",
118+
"provision/qemu.sh",
119+
"provision/cleanup.sh"
120+
],
121+
"execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'",
122+
"only": ["qemu"]
123+
},
124+
{
125+
"type": "shell",
126+
"scripts": [
127+
"provision/postinstall.sh",
128+
"provision/vmware.sh",
129+
"provision/cleanup.sh"
130+
],
131+
"execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'",
132+
"only": ["vmware-iso"]
133+
},
134+
{
135+
"type": "shell",
136+
"scripts": [
137+
"provision/write_zeroes.sh"
138+
],
139+
"execute_command": "if [ ! -z \"{{user `write_zeroes`}}\" ]; then echo 'vagrant'|sudo -S sh '{{.Path}}'; fi"
140+
}
141+
],
142+
"post-processors": [
143+
[
144+
{
145+
"type": "vagrant",
146+
"keep_input_artifact": false,
147+
"output": "Arch-Linux-x86_64-{{ .Provider }}-{{isotime \"2006-01-02\"}}.box"
148+
}
149+
]
150+
]
13151
}

0 commit comments

Comments
 (0)