cloud.json 2.82 KB
Newer Older
Christian Rebischke's avatar
Christian Rebischke committed
1
2
{
    "variables": {
3
        "iso_url": "https://mirror.pkgbuild.com/iso/latest/archlinux-2019.10.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
            "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,
            "ssh_wait_timeout": "10000s",
            "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
                "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-cloud}.sh'<enter><wait>",
Christian Rebischke's avatar
Christian Rebischke committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
                "bash install.sh < install-cloud.sh && systemctl reboot<enter>"
            ]
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "scripts": [
                "provision/postinstall.sh",
                "provision/qemu.sh",
		"provision/cloud-init.sh",
                "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
70
71
72
                "type": "checksum",
		"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
            },
	    {
		"type": "shell-local",
		"inline": [
78
79
80
			"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
81
82
83
84
85
		]
	    }
	]
    ]
}