-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbatman-adv.pkr.hcl
94 lines (82 loc) · 2.24 KB
/
batman-adv.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
source "vagrant" "batman-adv-virt" {
communicator = "ssh"
source_path = "debian/bullseye64"
provider = "virtualbox"
add_force = true
}
build {
sources = ["source.vagrant.batman-adv-virt"]
# install dependencies
provisioner "shell" {
inline = [
"sudo apt-get update -y",
"sudo apt-get install -y batctl net-tools alfred git cmake libjansson-dev zlib1g-dev curl pkg-config avahi-autoipd iproute2"
]
}
# install node and npm
provisioner "shell" {
inline = [
"curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash",
"export NVM_DIR=\"$HOME/.nvm\"",
"[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"",
"[ -s \"$NVM_DIR/bash_completion\" ] && . \"$NVM_DIR/bash_completion\"",
"nvm install 16.16.0"
]
}
# install alfred
provisioner "shell" {
inline = [
"git clone https://github.com/ffnord/alfred-json.git",
"cd alfred-json",
"mkdir build/",
"cd build",
"cmake ../",
"make",
"sudo make install",
"cd ../..",
"rm -rf alfred-json"
]
}
# copy interfaces
provisioner "file" {
source = "bat0"
destination = "/tmp/bat0"
}
provisioner "file" {
source = "eth1"
destination = "/tmp/eth1"
}
provisioner "shell" {
inline = [
"sudo mv /tmp/bat0 /etc/network/interfaces.d/bat0",
"sudo mv /tmp/eth1 /etc/network/interfaces.d/eth1"
]
}
# batman config
provisioner "shell" {
inline = ["echo 'batman-adv' | sudo tee --append /etc/modules"]
}
# batman startup script
provisioner "file" {
source = "start-batman-adv.sh"
destination = "/tmp/start-batman-adv.sh"
}
provisioner "file" {
source = "batman-adv.service"
destination = "/tmp/batman-adv.service"
}
provisioner "shell" {
inline = [
"sudo mv /tmp/start-batman-adv.sh /etc/start-batman-adv.sh",
"sudo chmod u+x /etc/start-batman-adv.sh",
"sudo mv /tmp/batman-adv.service /etc/systemd/system/batman-adv.service",
"sudo chmod u+x /etc/systemd/system/batman-adv.service",
"sudo systemctl enable batman-adv.service"
]
}
# make checksum
post-processor "checksum" {
checksum_types = [ "md5", "sha512" ]
keep_input_artifact = true
}
}