-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchlinux-basebox.pkr.hcl
96 lines (87 loc) · 2.83 KB
/
archlinux-basebox.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
packer {
required_plugins {
virtualbox = {
version = "~> 1"
source = "github.com/hashicorp/virtualbox"
}
sshkey = {
version = "~> 1"
source = "github.com/ivoronin/sshkey"
}
vagrant = {
version = "~> 1"
source = "github.com/hashicorp/vagrant"
}
}
}
variable "download_mirror" {
type = string
default = "ftp.halifax.rwth-aachen.de"
}
variable "arch_version" {
type = string
default = "2024.01.01"
}
data "sshkey" "vagrant" {
name = "vagrant_id"
}
source "virtualbox-iso" "autogenerated_1" {
boot_command = [
"<enter><wait20>",
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/user_configuration.json<enter><wait1>",
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/user_credentials.json<enter><wait1>",
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/user_disk_layout.json<enter><wait1>",
"archinstall --config user_configuration.json --creds user_credentials.json --disk_layout user_disk_layout.json<enter><wait30><wait5>",
"<up><up><enter><wait5><enter><wait6m><wait30>",
"<down><enter>",
"reboot<enter><wait5>"
]
boot_wait = "5s"
cpus = 5
disk_size = 20480
memory = 768
gfx_controller = "vboxsvga"
gfx_vram_size = 128
guest_os_type = "ArchLinux_64"
hard_drive_interface = "sata"
headless = "false"
http_directory = "srv"
iso_checksum = "file:https://${var.download_mirror}/archlinux/iso/${var.arch_version}/sha256sums.txt"
iso_url = "https://${var.download_mirror}/archlinux/iso/${var.arch_version}/archlinux-${var.arch_version}-x86_64.iso"
shutdown_command = "sudo shutdown -P now"
disable_shutdown = false
audio_controller = "ac97"
sound = "dsound"
ssh_username = "vagrant"
ssh_password = "vagrant"
ssh_timeout = "10m"
vboxmanage = [
["modifyvm", "{{ .Name }}", "--nat-localhostreachable1", "on"],
]
}
build {
sources = ["source.virtualbox-iso.autogenerated_1"]
provisioner "shell" {
inline = [
"#!/bin/bash -e",
"echo 'Saving public SSH key for vagrant user...'",
"[[ -d /home/vagrant/.ssh ]] || mkdir /home/vagrant/.ssh",
"echo ${data.sshkey.vagrant.public_key} > /home/vagrant/.ssh/authorized_keys"
]
}
provisioner "shell" {
inline = [
"echo 'Installing VirtualBox Guest Additions...'",
"sudo mkdir /mnt/cdrom",
"sudo mount /home/vagrant/VBoxGuestAdditions.iso /mnt/cdrom",
"sudo /mnt/cdrom/VBoxLinuxAdditions.run || sudo rcvboxadd reload",
"echo 'Finished installing VirtualBox Guest Additions.'"
]
}
provisioner "shell" {
script = "provision/pikaur.sh"
}
post-processor "vagrant" {
output = "output/my-arch-base.box"
}
}