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