cloud.json 3.05 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
10
11
12
13
14
        "iso_checksum_url": "https://mirror.pkgbuild.com/iso/latest/sha1sums.txt",
        "iso_checksum_type": "sha1",
        "disk_size": "20480",
        "memory": "1024",
        "cpus": "2",
        "headless": "true",
        "write_zeroes": "",
        "boot_wait": "60s"
    },
    "builders": [
        {
15
            "name": "Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.img",
Christian Rebischke's avatar
Christian Rebischke committed
16
            "type": "qemu",
17
            "output_directory": "release",
Christian Rebischke's avatar
Christian Rebischke committed
18
19
20
21
22
23
24
25
26
            "boot_wait": "{{user `boot_wait`}}",
            "http_directory": "http",
            "disk_size": "{{user `disk_size`}}",
            "iso_checksum_url": "{{user `iso_checksum_url`}}",
            "iso_checksum_type": "{{user `iso_checksum_type`}}",
            "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
30
31
32
33
34
35
36
37
38
39
40
41
            "shutdown_command": "sudo systemctl poweroff",
            "headless": "{{user `headless`}}",
            "qemuargs": [
                [
                    "-m",
                    "{{user `memory`}}"
                ],
                [
                    "-smp",
                    "{{user `cpus`}}"
                ]
            ],
            "boot_command": [
                "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
42
43
                "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-cloud}.sh'<enter><wait>",
                "bash install.sh < <(cat install-{cloud,common}.sh) && systemctl reboot<enter>"
Christian Rebischke's avatar
Christian Rebischke committed
44
45
46
47
48
49
50
51
52
            ]
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "scripts": [
                "provision/postinstall.sh",
                "provision/qemu.sh",
53
                "provision/cloud-init.sh",
Christian Rebischke's avatar
Christian Rebischke committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
                "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": [
        [
68
           {
Christian Rebischke's avatar
Christian Rebischke committed
69
                "type": "checksum",
70
71
72
                "checksum_types": [
                        "sha256"
                ],
73
                "output": "Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.SHA256"
Christian Rebischke's avatar
Christian Rebischke committed
74
            },
75
76
77
78
79
80
81
82
83
            {
                "type": "shell-local",
                "inline": [
                        "mv release/packer-Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.img release/Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.img",
                        "sed -i 's/packer-//' Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.SHA256",
                        "gpg --sign --detach-sign Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.SHA256"
                ]
            }
        ]
Christian Rebischke's avatar
Christian Rebischke committed
84
85
    ]
}