cloud.json 3.02 KB
Newer Older
Christian Rebischke's avatar
Christian Rebischke committed
1
2
{
    "variables": {
juadde's avatar
juadde committed
3
        "iso_url": "https://mirror.pkgbuild.com/iso/latest/archlinux-{{isotime \"2006.01\"}}.01-x86_64.iso",
Christian Rebischke's avatar
Christian Rebischke committed
4
5
6
        "iso_checksum_url": "https://mirror.pkgbuild.com/iso/latest/sha1sums.txt",
        "disk_size": "20480",
        "headless": "true",
Kristian Klausen's avatar
Kristian Klausen committed
7
        "boot_wait": "60s",
8
        "accelerator": "",
9
        "mirror": "https://mirror.pkgbuild.com/$repo/os/$arch"
Christian Rebischke's avatar
Christian Rebischke committed
10
11
12
    },
    "builders": [
        {
13
            "name": "Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.img",
Christian Rebischke's avatar
Christian Rebischke committed
14
            "type": "qemu",
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
15
16
            "cpus": 2,
            "memory": 1024,
17
            "output_directory": "release",
Christian Rebischke's avatar
Christian Rebischke committed
18
19
20
            "boot_wait": "{{user `boot_wait`}}",
            "http_directory": "http",
            "disk_size": "{{user `disk_size`}}",
21
            "iso_checksum": "file:{{user `iso_checksum_url`}}",
Christian Rebischke's avatar
Christian Rebischke committed
22
23
24
25
            "iso_url": "{{user `iso_url`}}",
            "ssh_username": "arch",
            "ssh_password": "arch",
            "ssh_port": 22,
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
26
            "ssh_timeout": "2000s",
Christian Rebischke's avatar
Christian Rebischke committed
27
28
            "shutdown_command": "sudo systemctl poweroff",
            "headless": "{{user `headless`}}",
29
            "accelerator": "{{user `accelerator`}}",
30
            "disk_compression": true,
Christian Rebischke's avatar
Christian Rebischke committed
31
32
            "boot_command": [
                "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
33
                "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-cloud}.sh'<enter><wait>",
Kristian Klausen's avatar
Kristian Klausen committed
34
                "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{cloud,common}.sh) && systemctl reboot<enter>"
Christian Rebischke's avatar
Christian Rebischke committed
35
36
37
38
39
40
41
42
43
            ]
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "scripts": [
                "provision/postinstall.sh",
                "provision/qemu.sh",
44
                "provision/cloud-init.sh",
Christian Rebischke's avatar
Christian Rebischke committed
45
46
47
48
49
50
51
52
53
                "provision/cleanup.sh"
            ],
            "execute_command": "echo 'arch'|sudo -S sh '{{.Path}}'"
        },
        {
            "type": "shell",
            "scripts": [
                "provision/write_zeroes.sh"
            ],
Sven-Hendrik Haase's avatar
Sven-Hendrik Haase committed
54
            "execute_command": "'arch'|sudo -S sh '{{.Path}}'"
Christian Rebischke's avatar
Christian Rebischke committed
55
56
57
58
        }
    ],
    "post-processors": [
        [
59
            {
Christian Rebischke's avatar
Christian Rebischke committed
60
                "type": "checksum",
61
                "checksum_types": [
62
                    "sha256"
63
                ],
64
                "output": "release/Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.SHA256"
Christian Rebischke's avatar
Christian Rebischke committed
65
            },
66
            {
67
                "name": "rename",
68
69
                "type": "shell-local",
                "inline": [
70
71
                    "mv release/packer-Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.img release/Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.img",
                    "sed -i 's/packer-//' release/Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.SHA256"
72
73
74
75
76
77
                ]
            },
            {
                "name": "sign",
                "type": "shell-local",
                "inline": [
78
                    "gpg --sign --detach-sign Arch-Linux-x86_64-cloudimg-{{isotime \"2006-01-02\"}}.SHA256"
79
80
81
                ]
            }
        ]
Christian Rebischke's avatar
Christian Rebischke committed
82
83
    ]
}