config.json 7.12 KB
Newer Older
1
2
{
    "variables": {
3
4
        "iso_url": "https://mirror.pkgbuild.com/iso/latest/archlinux-{{isotime \"2006.01\"}}.01-x86_64.iso",
        "iso_checksum_url": "https://mirror.pkgbuild.com/iso/latest/sha1sums.txt",
Christian Rebischke's avatar
Christian Rebischke committed
5
        "disk_size": "20480",
6
        "headless": "true",
Kristian Klausen's avatar
Kristian Klausen committed
7
        "boot_wait": "60s",
8
9
        "accelerator": "",
        "mirror": "https://mirror.pkgbuild.com/$repo/os/$arch"
10
11
12
    },
    "builders": [
        {
13
14
            "type": "qemu",
            "name": "virtualbox",
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
15
16
            "cpus": 2,
            "memory": 1024,
17
            "boot_wait": "{{user `boot_wait`}}",
18
            "http_directory": "http",
19
            "disk_discard": "unmap",
Christian Rebischke's avatar
Christian Rebischke committed
20
            "disk_size": "{{user `disk_size`}}",
21
            "iso_checksum": "file:{{user `iso_checksum_url`}}",
22
23
24
25
            "iso_url": "{{user `iso_url`}}",
            "ssh_username": "vagrant",
            "ssh_password": "vagrant",
            "ssh_port": 22,
26
            "ssh_timeout": "2000s",
Christian Rebischke's avatar
Christian Rebischke committed
27
            "shutdown_command": "sudo systemctl poweroff",
Christian Rebischke's avatar
Christian Rebischke committed
28
            "headless": "{{user `headless`}}",
29
30
            "accelerator": "{{user `accelerator`}}",
            "disk_compression": true,
31
            "boot_command": [
32
                "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
33
                "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>",
Kristian Klausen's avatar
Kristian Klausen committed
34
                "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>"
35
            ]
36
37
        },
        {
Christian Rebischke's avatar
Christian Rebischke committed
38
            "type": "qemu",
39
            "name": "libvirt",
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
40
41
            "cpus": 2,
            "memory": 1024,
42
            "boot_wait": "{{user `boot_wait`}}",
Christian Rebischke's avatar
Christian Rebischke committed
43
            "http_directory": "http",
44
            "disk_discard": "unmap",
Christian Rebischke's avatar
Christian Rebischke committed
45
            "disk_size": "{{user `disk_size`}}",
46
            "iso_checksum": "file:{{user `iso_checksum_url`}}",
Christian Rebischke's avatar
Christian Rebischke committed
47
48
49
50
            "iso_url": "{{user `iso_url`}}",
            "ssh_username": "vagrant",
            "ssh_password": "vagrant",
            "ssh_port": 22,
51
            "ssh_timeout": "2000s",
Christian Rebischke's avatar
Christian Rebischke committed
52
            "shutdown_command": "sudo systemctl poweroff",
Christian Rebischke's avatar
Christian Rebischke committed
53
            "headless": "{{user `headless`}}",
54
55
            "accelerator": "{{user `accelerator`}}",
            "disk_compression": true,
56
            "boot_command": [
57
                "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
58
                "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>",
Kristian Klausen's avatar
Kristian Klausen committed
59
                "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>"
Christian Rebischke's avatar
Christian Rebischke committed
60
            ]
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
        },
        {
            "type": "qemu",
            "name": "cloud",
            "cpus": 2,
            "memory": 1024,
            "boot_wait": "{{user `boot_wait`}}",
            "http_directory": "http",
            "disk_size": "{{user `disk_size`}}",
            "disk_discard": "unmap",
            "iso_checksum": "file:{{user `iso_checksum_url`}}",
            "iso_url": "{{user `iso_url`}}",
            "ssh_username": "arch",
            "ssh_password": "arch",
            "ssh_port": 22,
            "ssh_timeout": "2000s",
            "shutdown_command": "sudo systemctl poweroff",
            "vm_name": "Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.qcow2",
            "headless": "{{user `headless`}}",
            "accelerator": "{{user `accelerator`}}",
            "disk_compression": true,
            "boot_command": [
                "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
                "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-cloud}.sh'<enter><wait>",
                "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{cloud,common}.sh) && systemctl reboot<enter>"
            ]
87
88
89
90
91
92
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "scripts": [
93
                "provision/postinstall.sh",
Christian Rebischke's avatar
Christian Rebischke committed
94
95
                "provision/virtualbox.sh",
                "provision/cleanup.sh"
96
            ],
97
            "execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'",
98
            "only": [
99
                "virtualbox"
100
            ]
101
102
103
104
105
106
107
108
109
        },
        {
            "type": "shell",
            "scripts": [
                "provision/postinstall.sh",
                "provision/qemu.sh",
                "provision/cleanup.sh"
            ],
            "execute_command": "echo 'vagrant'|sudo -S sh '{{.Path}}'",
110
            "only": [
111
                "libvirt"
112
            ]
113
114
115
116
117
118
119
120
121
122
123
124
125
        },
        {
            "type": "shell",
            "scripts": [
                "provision/postinstall.sh",
                "provision/qemu.sh",
                "provision/cloud-init.sh",
                "provision/cleanup.sh"
            ],
            "execute_command": "echo 'arch'|sudo -S sh '{{.Path}}'",
            "only": [
                "cloud"
            ]
126
127
128
        }
    ],
    "post-processors": [
129
130
        [
            {
131
132
133
134
135
136
137
138
139
                "type": "shell-local",
                "only": [
                    "virtualbox"
                ],
                "environment_vars": [
                    "OUTPUT=output-{{build_name}}",
                    "VM_NAME=packer-{{build_name}}"
                ],
                "script": "post-processor/virtualbox.sh"
140
141
            },
            {
142
                "type": "artifice",
143
                "only": [
144
                    "virtualbox"
145
                ],
146
147
148
149
150
151
152
                "files": [
                    "output-{{build_name}}/packer-{{build_name}}.vmdk",
                    "output-{{build_name}}/box.ovf"
                ]
            },
            {
                "type": "vagrant",
153
154
155
                "except": [
                    "cloud"
                ],
156
157
158
                "keep_input_artifact": false,
                "output": "Arch-Linux-x86_64-{{ .Provider }}-{{isotime \"2006-01-02\"}}.box",
                "provider_override": "{{build_name}}"
159
160
            },
            {
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
                "name": "cleanup",
                "type": "shell-local",
                "only": [
                    "virtualbox"
                ],
                "inline": [
                    "rm -r output-virtualbox"
                ]
            },
            {
                "type": "checksum",
                "only": [
                    "cloud"
                ],
                "checksum_types": [
                    "sha256"
                ],
                "output": "Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.SHA256"
            },
            {
                "name": "rename",
                "type": "shell-local",
                "only": [
                    "cloud"
                ],
                "inline": [
                    "mv output-cloud/Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.qcow2 Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.qcow2 && rm -r output-cloud"
                ]
            },
            {
                "name": "sign",
                "type": "shell-local",
                "only": [
                    "cloud"
                ],
                "inline": [
                    "gpg --sign --detach-sign Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.SHA256"
                ]
199
200
            }
        ]
201
    ]
202
}