2023-09-29 10:08:38 +02:00
|
|
|
packer {
|
|
|
|
required_plugins {
|
|
|
|
arm-image = {
|
|
|
|
version = ">= 0.2.7"
|
|
|
|
source = "github.com/solo-io/arm-image"
|
|
|
|
}
|
2023-10-29 22:13:19 +01:00
|
|
|
ansible = {
|
|
|
|
version = ">= 1.1.0"
|
|
|
|
source = "github.com/hashicorp/ansible"
|
|
|
|
}
|
2023-09-29 10:08:38 +02:00
|
|
|
}
|
|
|
|
}
|
2023-10-29 22:13:19 +01:00
|
|
|
|
|
|
|
variable "pwn_hostname" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "pwn_version" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
source "arm-image" "rpi-pwnagotchi" {
|
2023-09-29 10:08:38 +02:00
|
|
|
iso_checksum = "file:https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz.sha256"
|
|
|
|
iso_url = "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz"
|
2023-10-29 22:13:19 +01:00
|
|
|
output_filename = "../../../pwnagotchi-raspios-bullseye-${var.pwn_version}-arm64.img"
|
2023-09-29 10:08:38 +02:00
|
|
|
qemu_binary = "qemu-aarch64-static"
|
|
|
|
target_image_size = 9368709120
|
2023-10-29 22:13:19 +01:00
|
|
|
qemu_args = ["-r", "6.1.21-v8+"]
|
2023-09-29 10:08:38 +02:00
|
|
|
}
|
2023-10-29 23:12:37 +01:00
|
|
|
source "arm-image" "opi-pwnagotchi" {
|
|
|
|
iso_checksum = ""
|
|
|
|
iso_url = "https://drive.usercontent.google.com/download?id=1AJ_rrLAtCwurEB61VevSRKQwDOBF9GHN&export=download&authuser=0&confirm=t&uuid=ae4b66d9-adca-4fe1-9c4c-bf54bfc9d2ce&at=APZUnTV50dgaDoFFE0NnKqszShSm:1698614532340"
|
2023-10-29 23:16:27 +01:00
|
|
|
output_file ="../../../pwnagotchi-orangepi-bullseye-${var.pwn_version}-arm64.img"
|
2023-10-29 23:12:37 +01:00
|
|
|
qemu_binary = "qemu-aarch64-static"
|
|
|
|
target_image_size = 9368709120
|
|
|
|
qemu_args = ["-r", "6.1.31-sun50iw9"]
|
|
|
|
}
|
2023-09-29 10:08:38 +02:00
|
|
|
|
|
|
|
# a build block invokes sources and runs provisioning steps on them. The
|
|
|
|
# documentation for build blocks can be found here:
|
|
|
|
# https://www.packer.io/docs/from-1.5/blocks/build
|
|
|
|
build {
|
2023-10-29 22:13:19 +01:00
|
|
|
name = "Pwnagotchi Torch 64bit"
|
|
|
|
sources = [
|
|
|
|
"source.arm-image.rpi-pwnagotchi",
|
2023-10-29 23:12:37 +01:00
|
|
|
"source.arm-image.opi-pwnagotchi",
|
2023-10-29 22:13:19 +01:00
|
|
|
]
|
2023-09-29 10:08:38 +02:00
|
|
|
|
|
|
|
provisioner "file" {
|
2023-10-29 22:13:19 +01:00
|
|
|
destination = "/usr/bin/"
|
|
|
|
sources = [
|
|
|
|
"../builder/data/usr/bin/pwnlib",
|
|
|
|
"../builder/data/usr/bin/bettercap-launcher",
|
|
|
|
"../builder/data/usr/bin/pwnagotchi-launcher",
|
|
|
|
"../builder/data/usr/bin/monstop",
|
|
|
|
"../builder/data/usr/bin/monstart",
|
|
|
|
"../builder/data/usr/bin/hdmion",
|
|
|
|
"../builder/data/usr/bin/hdmioff",
|
|
|
|
]
|
2023-09-29 10:08:38 +02:00
|
|
|
}
|
|
|
|
provisioner "shell" {
|
|
|
|
inline = ["chmod +x /usr/bin/*"]
|
|
|
|
}
|
2023-10-29 22:13:19 +01:00
|
|
|
|
|
|
|
provisioner "file" {
|
|
|
|
destination = "/etc/systemd/system/"
|
|
|
|
sources = [
|
|
|
|
"../builder/data/etc/systemd/system/pwngrid-peer.service",
|
|
|
|
"../builder/data/etc/systemd/system/pwnagotchi.service",
|
|
|
|
"../builder/data/etc/systemd/system/bettercap.service",
|
|
|
|
]
|
|
|
|
}
|
2023-09-29 10:16:39 +02:00
|
|
|
provisioner "file" {
|
|
|
|
destination = "/etc/update-motd.d/01-motd"
|
|
|
|
source = "../builder/data/etc/update-motd.d/01-motd"
|
|
|
|
}
|
2023-09-29 10:08:38 +02:00
|
|
|
provisioner "shell" {
|
|
|
|
inline = ["chmod +x /etc/update-motd.d/*"]
|
|
|
|
}
|
|
|
|
provisioner "shell" {
|
2023-10-29 22:13:19 +01:00
|
|
|
inline = ["apt-get -y --allow-releaseinfo-change update", "apt-get -y dist-upgrade", "apt-get install -y --no-install-recommends ansible"]
|
2023-09-29 10:08:38 +02:00
|
|
|
}
|
|
|
|
provisioner "ansible-local" {
|
|
|
|
command = "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION=${var.pwn_version} PWN_HOSTNAME=${var.pwn_hostname} ansible-playbook"
|
|
|
|
extra_arguments = ["--extra-vars \"ansible_python_interpreter=/usr/bin/python3\""]
|
|
|
|
playbook_file = "../builder/pwnagotchi.yml"
|
|
|
|
}
|
|
|
|
}
|