-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbox-metadata.sh
executable file
·35 lines (31 loc) · 946 Bytes
/
box-metadata.sh
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
#!/bin/bash
set -euo pipefail
provider="$1"
name="$2"
path="$3"
# see https://developer.hashicorp.com/vagrant/docs/boxes/format#box-metadata
# see https://developer.hashicorp.com/vagrant/docs/boxes/format#box-file
# see https://github.com/hashicorp/packer-plugin-vagrant/blob/v1.0.3/post-processor/vagrant/libvirt.go#L100-L105
# see https://github.com/vagrant-libvirt/vagrant-libvirt/blob/0.11.2/spec/unit/action/handle_box_image_spec.rb#L96-L125
# see https://github.com/vagrant-libvirt/vagrant-libvirt/blob/0.11.2/lib/vagrant-libvirt/action/handle_box_image.rb
# see https://github.com/vagrant-libvirt/vagrant-libvirt/blob/0.11.2/docs/boxes.markdown
cat >"$path.json" <<EOF
{
"name": "$name",
"versions": [
{
"version": "0.0.0",
"providers": [
{
"name": "$provider",
"url": "$path"
}
]
}
]
}
EOF
cat <<EOF
Add the Vagrant Box with:
vagrant box add -f $name $path.json
EOF