|
| 1 | +{ |
| 2 | + "variables": { |
| 3 | + "iso_url": "https://mirror.pkgbuild.com/iso/latest/archlinux-2019.10.01-x86_64.iso", |
| 4 | + "iso_checksum_url": "https://mirror.pkgbuild.com/iso/latest/sha1sums.txt", |
| 5 | + "iso_checksum_type": "sha1", |
| 6 | + "disk_size": "20480", |
| 7 | + "memory": "1024", |
| 8 | + "cpus": "2", |
| 9 | + "headless": "true", |
| 10 | + "write_zeroes": "", |
| 11 | + "boot_wait": "60s" |
| 12 | + }, |
| 13 | + "builders": [ |
| 14 | + { |
| 15 | + "name": "Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.img", |
| 16 | + "type": "qemu", |
| 17 | + "output_directory": "release", |
| 18 | + "boot_wait": "{{user `boot_wait`}}", |
| 19 | + "http_directory": "http", |
| 20 | + "disk_size": "{{user `disk_size`}}", |
| 21 | + "iso_checksum_url": "{{user `iso_checksum_url`}}", |
| 22 | + "iso_checksum_type": "{{user `iso_checksum_type`}}", |
| 23 | + "iso_url": "{{user `iso_url`}}", |
| 24 | + "ssh_username": "arch", |
| 25 | + "ssh_password": "arch", |
| 26 | + "ssh_port": 22, |
| 27 | + "ssh_wait_timeout": "10000s", |
| 28 | + "shutdown_command": "sudo systemctl poweroff", |
| 29 | + "headless": "{{user `headless`}}", |
| 30 | + "qemuargs": [ |
| 31 | + [ |
| 32 | + "-m", |
| 33 | + "{{user `memory`}}" |
| 34 | + ], |
| 35 | + [ |
| 36 | + "-smp", |
| 37 | + "{{user `cpus`}}" |
| 38 | + ] |
| 39 | + ], |
| 40 | + "boot_command": [ |
| 41 | + "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>", |
| 42 | + "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-cloud}.sh'<enter><wait>", |
| 43 | + "bash install.sh < install-cloud.sh && systemctl reboot<enter>" |
| 44 | + ] |
| 45 | + } |
| 46 | + ], |
| 47 | + "provisioners": [ |
| 48 | + { |
| 49 | + "type": "shell", |
| 50 | + "scripts": [ |
| 51 | + "provision/postinstall.sh", |
| 52 | + "provision/qemu.sh", |
| 53 | + "provision/cloud-init.sh", |
| 54 | + "provision/cleanup.sh" |
| 55 | + ], |
| 56 | + "execute_command": "echo 'arch'|sudo -S sh '{{.Path}}'" |
| 57 | + }, |
| 58 | + { |
| 59 | + "type": "shell", |
| 60 | + "scripts": [ |
| 61 | + "provision/write_zeroes.sh" |
| 62 | + ], |
| 63 | + "execute_command": "if [ ! -z \"{{user `write_zeroes`}}\" ]; then echo 'arch'|sudo -S sh '{{.Path}}'; fi" |
| 64 | + } |
| 65 | + ], |
| 66 | + "post-processors": [ |
| 67 | + [ |
| 68 | + { |
| 69 | + "type": "checksum", |
| 70 | + "checksum_types": [ |
| 71 | + "sha256" |
| 72 | + ], |
| 73 | + "output": "Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.SHA256" |
| 74 | + }, |
| 75 | + { |
| 76 | + "type": "shell-local", |
| 77 | + "inline": [ |
| 78 | + "mv release/packer-Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.img release/Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.img", |
| 79 | + "sed -i 's/packer-//' Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.SHA256", |
| 80 | + "gpg --sign --detach-sign Arch-Linux-cloudimg-amd64-{{isotime \"2006-01-02\"}}.SHA256" |
| 81 | + ] |
| 82 | + } |
| 83 | + ] |
| 84 | + ] |
| 85 | +} |
0 commit comments