packer: Use HCL2
This commit is contained in:
parent
d688ce55fc
commit
50fa3c8fde
|
@ -3,3 +3,4 @@ packer_cache
|
|||
crash.log
|
||||
*.box
|
||||
templates/
|
||||
cloud-generic
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
TEMPLATES=templates/digitalocean-glibc64.json templates/vagrant-glibc64.json
|
||||
|
||||
all: $(TEMPLATES)
|
||||
|
||||
templates:
|
||||
mkdir -p templates
|
||||
|
||||
templates/digitalocean-glibc64.json: templates fragments/base-qemu-glibc64.json fragments/provisioner-cloud.json fragments/platform-digitalocean.json
|
||||
jq -s 'add' fragments/base-qemu-glibc64.json fragments/provisioner-cloud.json fragments/platform-digitalocean.json > templates/digitalocean-glibc64.json
|
||||
|
||||
templates/vagrant-glibc64.json: templates fragments/base-vbox-glibc64.json fragments/platform-vagrant.json
|
||||
jq -s 'add' fragments/base-vbox-glibc64.json fragments/platform-vagrant.json > templates/vagrant-glibc64.json
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"builders": [
|
||||
{
|
||||
"accelerator": "kvm",
|
||||
"boot_command": [
|
||||
"<tab><wait>",
|
||||
"auto autourl=http://{{ .HTTPIP }}:{{ .HTTPPort }}/cloud.cfg",
|
||||
"<enter>"
|
||||
],
|
||||
"boot_wait": "5s",
|
||||
"disk_interface": "virtio",
|
||||
"disk_size": "1000M",
|
||||
"format": "qcow2",
|
||||
"http_directory": "http",
|
||||
"iso_checksum": "sha256:d95d40e1eb13a7776b5319a05660792fddd762662eaecee5df6b8feb3aa9b391",
|
||||
"iso_url": "https://alpha.de.repo.voidlinux.org/live/20200722/void-live-x86_64-5.7.10_1-20200722.iso",
|
||||
"output_directory": "output_void_qcow2",
|
||||
"shutdown_command": "echo 'void' | sudo -S shutdown -P now",
|
||||
"ssh_password": "void",
|
||||
"ssh_timeout": "20m",
|
||||
"ssh_username": "void",
|
||||
"type": "qemu",
|
||||
"vm_name": "DO-glibc64"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"builders": [
|
||||
{
|
||||
"boot_command": [
|
||||
"<tab><wait>",
|
||||
"auto autourl=http://{{ .HTTPIP }}:{{ .HTTPPort }}/vagrant.cfg",
|
||||
"<enter>"
|
||||
],
|
||||
"boot_wait": "5s",
|
||||
"guest_additions_mode": "disable",
|
||||
"guest_os_type": "Linux_64",
|
||||
"http_directory": "http",
|
||||
"iso_checksum": "sha256:d95d40e1eb13a7776b5319a05660792fddd762662eaecee5df6b8feb3aa9b391",
|
||||
"iso_url": "https://alpha.de.repo.voidlinux.org/live/20200722/void-live-x86_64-5.7.10_1-20200722.iso",
|
||||
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
|
||||
"ssh_password": "vagrant",
|
||||
"ssh_timeout": "20m",
|
||||
"ssh_username": "vagrant",
|
||||
"type": "virtualbox-iso",
|
||||
"vboxmanage": [
|
||||
[
|
||||
"modifyvm",
|
||||
"{{.Name}}",
|
||||
"--nictype1",
|
||||
"virtio"
|
||||
]
|
||||
],
|
||||
"virtualbox_version_file": ".vbox_version"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"post-processors": [
|
||||
{
|
||||
"image_description": "Packer import {{timestamp}}",
|
||||
"image_name": "void-linux-{{user `release`}}",
|
||||
"image_regions": "{{user `image_regions`}}",
|
||||
"image_tags": [
|
||||
"custom",
|
||||
"packer"
|
||||
],
|
||||
"space_name": "{{user `spaces_bucket`}}",
|
||||
"spaces_region": "{{user `spaces_region`}}",
|
||||
"type": "digitalocean-import"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"image_regions": "{{env `IMAGE_REGIONS`}}",
|
||||
"spaces_bucket": "{{env `SPACES_BUCKET`}}",
|
||||
"spaces_region": "{{env `SPACES_REGION`}}",
|
||||
"release": "{{env `RELEASE`}}"
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"post-processors": [
|
||||
[
|
||||
{
|
||||
"type": "vagrant"
|
||||
},
|
||||
{
|
||||
"box_tag": "voidlinux/glibc64",
|
||||
"type": "vagrant-cloud",
|
||||
"version": "{{user `version`}}"
|
||||
}
|
||||
]
|
||||
],
|
||||
"provisioners": [
|
||||
{
|
||||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
|
||||
"script": "scripts/vagrant.sh",
|
||||
"type": "shell"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"version": "{{env `RELEASE`}}"
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"provisioners": [
|
||||
{
|
||||
"execute_command": "echo 'void' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
|
||||
"script": "scripts/cloud.sh",
|
||||
"type": "shell"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
build {
|
||||
name = "cloud-generic-x86_64"
|
||||
|
||||
source "source.qemu.x86_64" {
|
||||
boot_command = [
|
||||
"<tab><wait>",
|
||||
"auto autourl=http://{{.HTTPIP}}:{{.HTTPPort}}/x86_64.cfg",
|
||||
"<enter>"
|
||||
]
|
||||
vm_name = "voidlinux-x86_64"
|
||||
output_directory = "cloud-generic-x86_64"
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
script = "scripts/cloud.sh"
|
||||
execute_command = "echo 'void' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
name = "cloud-generic-x86_64-musl"
|
||||
|
||||
source "source.qemu.x86_64" {
|
||||
boot_command = [
|
||||
"<tab><wait>",
|
||||
"auto autourl=http://{{.HTTPIP}}:{{.HTTPPort}}/x86_64-musl.cfg",
|
||||
"<enter>"
|
||||
]
|
||||
vm_name = "voidlinux-x86_64-musl"
|
||||
output_directory = "cloud-generic-x86_64-musl"
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
script = "scripts/cloud.sh"
|
||||
execute_command = "echo 'void' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
build {
|
||||
name = "vagrant-virtualbox-x86_64"
|
||||
|
||||
source "source.virtualbox-iso.x86_64" {
|
||||
boot_command = [
|
||||
"<tab><wait>",
|
||||
"auto autourl=http://{{.HTTPIP}}:{{.HTTPPort}}/x86_64.cfg",
|
||||
"<enter>"
|
||||
]
|
||||
vm_name = "voidlinux-x86_64"
|
||||
output_directory = "vagrant-virtualbox-x86_64"
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
script = "scripts/vagrant.sh"
|
||||
execute_command = "echo 'void' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
|
||||
}
|
||||
|
||||
post-processor "vagrant" {
|
||||
output = "vagrant-virtualbox-x86_64.box"
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
name = "vagrant-virtualbox-x86_64-musl"
|
||||
|
||||
source "source.virtualbox-iso.x86_64" {
|
||||
boot_command = [
|
||||
"<tab><wait>",
|
||||
"auto autourl=http://{{.HTTPIP}}:{{.HTTPPort}}/x86_64-musl.cfg",
|
||||
"<enter>"
|
||||
]
|
||||
vm_name = "voidlinux-x86_64-musl"
|
||||
output_directory = "vagrant-virtualbox-x86_64-musl"
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
script = "scripts/vagrant.sh"
|
||||
execute_command = "echo 'void' | {{.Vars}} sudo -E -S bash '{{.Path}}'"
|
||||
}
|
||||
|
||||
post-processor "vagrant" {
|
||||
output = "vagrant-virtualbox-x86_64-musl.box"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
source "qemu" "x86_64" {
|
||||
accelerator = "kvm"
|
||||
boot_wait = "5s"
|
||||
disk_interface = "virtio"
|
||||
disk_size = "1000M"
|
||||
format = "qcow2"
|
||||
http_directory = "http"
|
||||
iso_checksum = "sha256:d95d40e1eb13a7776b5319a05660792fddd762662eaecee5df6b8feb3aa9b391"
|
||||
iso_url = "https://alpha.de.repo.voidlinux.org/live/20200722/void-live-x86_64-5.7.10_1-20200722.iso"
|
||||
ssh_password = "void"
|
||||
ssh_timeout = "20m"
|
||||
ssh_username = "void"
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
source "virtualbox-iso" "x86_64" {
|
||||
guest_os_type = "Linux_64"
|
||||
iso_url = "https://alpha.de.repo.voidlinux.org/live/20200722/void-live-x86_64-5.7.10_1-20200722.iso"
|
||||
iso_checksum = "sha256:d95d40e1eb13a7776b5319a05660792fddd762662eaecee5df6b8feb3aa9b391"
|
||||
ssh_username = "void"
|
||||
ssh_password = "void"
|
||||
http_directory = "http"
|
||||
ssh_timeout = "20m"
|
||||
guest_additions_mode = "disable"
|
||||
|
||||
vboxmanage = [
|
||||
["modifyvm", "{{.Name}}", "--nictype1", "virtio"],
|
||||
]
|
||||
|
||||
boot_wait = "5s"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
../build-vagrant.pkr.hcl
|
|
@ -0,0 +1 @@
|
|||
../source-virtualbox-ose.pkr.hcl
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Void Linux Automatic Install Configuration
|
||||
|
||||
export username="vagrant"
|
||||
export password="vagrant"
|
||||
|
||||
export end_action=func
|
||||
end_function() {
|
||||
printf "Linking default services"
|
||||
chroot "$target" ln -s /etc/sv/dhcpcd /etc/runit/runsvdir/default/dhcpcd
|
||||
chroot "$target" ln -s /etc/sv/sshd /etc/runit/runsvdir/default/sshd
|
||||
|
||||
xbps-install -r "$target" -Sy dbus virtualbox-ose-guest
|
||||
|
||||
chroot "$target" ln -s /etc/sv/dbus /etc/runit/runsvdir/default/dbus
|
||||
chroot "$target" ln -s /etc/sv/vboxservice /etc/runit/runsvdir/default/vboxservice
|
||||
|
||||
sync
|
||||
reboot -f
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh
|
||||
# Void Linux Automatic Install Configuration
|
||||
|
||||
export username="void"
|
||||
export password="void"
|
||||
|
||||
export XBPS_ARCH=x86_64-musl
|
||||
export xbpsrepository=https://alpha.de.repo.voidlinux.org/current/musl
|
||||
|
||||
export end_action=func
|
||||
end_function() {
|
||||
printf "Linking default services"
|
||||
chroot "$target" ln -s /etc/sv/dhcpcd /etc/runit/runsvdir/default/dhcpcd
|
||||
chroot "$target" ln -s /etc/sv/sshd /etc/runit/runsvdir/default/sshd
|
||||
|
||||
sync
|
||||
reboot -f
|
||||
}
|
||||
|
||||
|
||||
VAI_partition_disk() {
|
||||
# Paritition Disk
|
||||
sfdisk "${disk}" <<EOF
|
||||
;
|
||||
EOF
|
||||
}
|
||||
|
||||
VAI_format_disk() {
|
||||
# Make Filesystems
|
||||
mkfs.ext4 -F "${disk}1"
|
||||
}
|
||||
|
||||
VAI_mount_target() {
|
||||
# Mount targetfs
|
||||
mkdir -p "${target}"
|
||||
mount "${disk}1" "${target}"
|
||||
}
|
||||
|
||||
VAI_configure_fstab() {
|
||||
uuid1="$(blkid -s UUID -o value "${disk}1")"
|
||||
echo "UUID=$uuid1 / ext4 defaults,errors=remount-ro 0 1" >> "${target}/etc/fstab"
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
# Void Linux Automatic Install Configuration
|
||||
|
||||
export username="void"
|
||||
export password="void"
|
||||
|
||||
export end_action=func
|
||||
end_function() {
|
||||
printf "Linking default services"
|
||||
chroot "$target" ln -s /etc/sv/dhcpcd /etc/runit/runsvdir/default/dhcpcd
|
||||
chroot "$target" ln -s /etc/sv/sshd /etc/runit/runsvdir/default/sshd
|
||||
|
||||
sync
|
||||
reboot -f
|
||||
}
|
||||
|
||||
|
||||
VAI_partition_disk() {
|
||||
# Paritition Disk
|
||||
sfdisk "${disk}" <<EOF
|
||||
;
|
||||
EOF
|
||||
}
|
||||
|
||||
VAI_format_disk() {
|
||||
# Make Filesystems
|
||||
mkfs.ext4 -F "${disk}1"
|
||||
}
|
||||
|
||||
VAI_mount_target() {
|
||||
# Mount targetfs
|
||||
mkdir -p "${target}"
|
||||
mount "${disk}1" "${target}"
|
||||
}
|
||||
|
||||
VAI_configure_fstab() {
|
||||
uuid1="$(blkid -s UUID -o value "${disk}1")"
|
||||
echo "UUID=$uuid1 / ext4 defaults,errors=remount-ro 0 1" >> "${target}/etc/fstab"
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
useradd -m -s /bin/bash vagrant
|
||||
|
||||
# Set up sudo
|
||||
echo '%vagrant ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/vagrant
|
||||
echo 'Defaults:vagrant !requiretty' >> /etc/sudoers.d/vagrant
|
||||
|
@ -19,3 +21,11 @@ chown -R vagrant /home/vagrant/.ssh
|
|||
|
||||
# Install NFS for Vagrant
|
||||
xbps-install -Sy nfs-utils
|
||||
|
||||
passwd -dl vagrant
|
||||
passwd -dl void
|
||||
passwd -dl root
|
||||
|
||||
rm -rf /var/cache/xbps
|
||||
|
||||
shutdown -P now
|
||||
|
|
Loading…
Reference in New Issue