2023-10-31 13:37:27 +01:00
|
|
|
# This is not working quite yet
|
2023-10-31 13:40:49 +01:00
|
|
|
# https://github.com/mkaczanowski/packer-builder-arm/pull/172
|
2023-11-15 09:51:27 +01:00
|
|
|
packer {
|
|
|
|
required_plugins {
|
|
|
|
#arm = {
|
|
|
|
# version = ">= 1.0.0"
|
|
|
|
# source = "github.com/cdecoux/builder-arm"
|
|
|
|
#}
|
|
|
|
ansible = {
|
|
|
|
source = "github.com/hashicorp/ansible"
|
|
|
|
version = "~> 1"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-31 13:37:13 +01:00
|
|
|
|
2023-10-29 22:13:19 +01:00
|
|
|
variable "pwn_hostname" {
|
|
|
|
type = string
|
|
|
|
}
|
|
|
|
|
|
|
|
variable "pwn_version" {
|
|
|
|
type = string
|
|
|
|
}
|
2023-10-29 23:31:05 +01:00
|
|
|
|
2023-10-31 22:49:00 +01:00
|
|
|
source "arm" "rpi64-pwnagotchi" {
|
2023-10-31 16:28:27 +01:00
|
|
|
file_checksum_url = "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz.sha256"
|
|
|
|
file_urls = ["https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz"]
|
|
|
|
file_checksum_type = "sha256"
|
|
|
|
file_target_extension = "xz"
|
|
|
|
file_unarchive_cmd = ["unxz", "$ARCHIVE_PATH"]
|
2023-10-31 18:06:55 +01:00
|
|
|
image_path = "../../pwnagotchi-rpi-bullseye-${var.pwn_version}-arm64.img"
|
2023-10-31 16:28:27 +01:00
|
|
|
qemu_binary_source_path = "/usr/bin/qemu-aarch64-static"
|
|
|
|
qemu_binary_destination_path = "/usr/bin/qemu-aarch64-static"
|
|
|
|
image_build_method = "resize"
|
|
|
|
image_size = "9G"
|
|
|
|
image_type = "dos"
|
|
|
|
image_partitions {
|
|
|
|
name = "boot"
|
|
|
|
type = "c"
|
|
|
|
start_sector = "8192"
|
|
|
|
filesystem = "fat"
|
|
|
|
size = "256M"
|
|
|
|
mountpoint = "/boot"
|
|
|
|
}
|
|
|
|
image_partitions {
|
|
|
|
name = "root"
|
|
|
|
type = "83"
|
|
|
|
start_sector = "532480"
|
|
|
|
filesystem = "ext4"
|
|
|
|
size = "0"
|
|
|
|
mountpoint = "/"
|
|
|
|
}
|
|
|
|
}
|
2023-10-31 22:49:00 +01:00
|
|
|
source "arm" "rpi32-pwnagotchi" {
|
|
|
|
file_checksum_url = "https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2023-05-03/2023-05-03-raspios-bullseye-armhf-lite.img.xz.sha256"
|
|
|
|
file_urls = ["https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2023-05-03/2023-05-03-raspios-bullseye-armhf-lite.img.xz"]
|
|
|
|
file_checksum_type = "sha256"
|
|
|
|
file_target_extension = "xz"
|
|
|
|
file_unarchive_cmd = ["unxz", "$ARCHIVE_PATH"]
|
|
|
|
image_path = "../../pwnagotchi-rpi-bullseye-${var.pwn_version}-armhf.img"
|
|
|
|
qemu_binary_source_path = "/usr/bin/qemu-arm-static"
|
|
|
|
qemu_binary_destination_path = "/usr/bin/qemu-arm-static"
|
|
|
|
image_build_method = "resize"
|
|
|
|
image_size = "9G"
|
|
|
|
image_type = "dos"
|
|
|
|
image_partitions {
|
|
|
|
name = "boot"
|
|
|
|
type = "c"
|
|
|
|
start_sector = "8192"
|
|
|
|
filesystem = "fat"
|
|
|
|
size = "256M"
|
|
|
|
mountpoint = "/boot"
|
|
|
|
}
|
|
|
|
image_partitions {
|
|
|
|
name = "root"
|
|
|
|
type = "83"
|
|
|
|
start_sector = "532480"
|
|
|
|
filesystem = "ext4"
|
|
|
|
size = "0"
|
|
|
|
mountpoint = "/"
|
|
|
|
}
|
|
|
|
}
|
2023-10-31 16:28:27 +01:00
|
|
|
source "arm" "opi-pwnagotchi" {
|
|
|
|
file_checksum_url = "../../images/pwnagotchi-orangepi-raspios.img.xz.sha256"
|
|
|
|
file_urls = ["../../images/pwnagotchi-orangepi-raspios.img.xz"]
|
|
|
|
file_checksum_type = "sha256"
|
|
|
|
file_target_extension = "xz"
|
|
|
|
file_unarchive_cmd = ["unxz", "$ARCHIVE_PATH"]
|
2023-10-31 18:06:55 +01:00
|
|
|
image_path = "../../pwnagotchi-opi-bullseye-${var.pwn_version}-arm64.img"
|
2023-10-31 16:28:27 +01:00
|
|
|
qemu_binary_source_path = "/usr/bin/qemu-aarch64-static"
|
|
|
|
qemu_binary_destination_path = "/usr/bin/qemu-aarch64-static"
|
|
|
|
image_build_method = "resize"
|
|
|
|
image_size = "9G"
|
|
|
|
image_type = "dos"
|
|
|
|
image_partitions {
|
|
|
|
name = "root"
|
|
|
|
type = "83"
|
|
|
|
start_sector = "8192"
|
|
|
|
filesystem = "ext4"
|
|
|
|
size = "0"
|
|
|
|
mountpoint = "/"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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-31 22:49:00 +01:00
|
|
|
name = "Raspberry Pi 64 Pwnagotchi"
|
|
|
|
sources = ["source.arm.rpi64-pwnagotchi"]
|
|
|
|
|
|
|
|
provisioner "file" {
|
|
|
|
destination = "/usr/bin/"
|
|
|
|
sources = [
|
2023-11-04 10:55:05 +01:00
|
|
|
"data/usr/bin/bettercap-launcher",
|
|
|
|
"data/usr/bin/hdmioff",
|
2023-11-07 11:11:12 +01:00
|
|
|
"data/usr/bin/hdmion",
|
|
|
|
"data/usr/bin/monstart",
|
|
|
|
"data/usr/bin/monstop",
|
|
|
|
"data/usr/bin/pwnagotchi-launcher",
|
|
|
|
"data/usr/bin/pwnlib",
|
2023-10-31 22:49:00 +01:00
|
|
|
]
|
|
|
|
}
|
|
|
|
provisioner "shell" {
|
|
|
|
inline = ["chmod +x /usr/bin/*"]
|
|
|
|
}
|
|
|
|
|
|
|
|
provisioner "file" {
|
|
|
|
destination = "/etc/systemd/system/"
|
|
|
|
sources = [
|
2023-11-04 10:55:05 +01:00
|
|
|
"data/etc/systemd/system/bettercap.service",
|
2023-11-07 11:11:12 +01:00
|
|
|
"data/etc/systemd/system/pwnagotchi.service",
|
|
|
|
"data/etc/systemd/system/pwngrid-peer.service",
|
2023-10-31 22:49:00 +01:00
|
|
|
]
|
|
|
|
}
|
|
|
|
provisioner "file" {
|
|
|
|
destination = "/etc/update-motd.d/01-motd"
|
2023-11-04 10:55:05 +01:00
|
|
|
source = "data/etc/update-motd.d/01-motd"
|
2023-10-31 22:49:00 +01:00
|
|
|
}
|
|
|
|
provisioner "shell" {
|
|
|
|
inline = ["chmod +x /etc/update-motd.d/*"]
|
|
|
|
}
|
|
|
|
provisioner "shell" {
|
|
|
|
inline = ["apt-get -y --allow-releaseinfo-change update", "apt-get -y dist-upgrade", "apt-get install -y --no-install-recommends ansible"]
|
|
|
|
}
|
|
|
|
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\""]
|
2023-11-04 10:55:05 +01:00
|
|
|
playbook_file = "raspberrypi64.yml"
|
2023-10-31 22:49:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-02 20:04:28 +01:00
|
|
|
build {
|
|
|
|
name = "Raspberry Pi 32 Pwnagotchi"
|
|
|
|
sources = ["source.arm.rpi32-pwnagotchi"]
|
|
|
|
provisioner "file" {
|
|
|
|
destination = "/usr/bin/"
|
|
|
|
sources = [
|
2023-11-04 10:55:05 +01:00
|
|
|
"data/usr/bin/bettercap-launcher",
|
|
|
|
"data/usr/bin/hdmioff",
|
2023-11-07 11:11:12 +01:00
|
|
|
"data/usr/bin/hdmion",
|
|
|
|
"data/usr/bin/monstart",
|
|
|
|
"data/usr/bin/monstop",
|
|
|
|
"data/usr/bin/pwnagotchi-launcher",
|
|
|
|
"data/usr/bin/pwnlib",
|
2023-11-02 20:04:28 +01:00
|
|
|
]
|
|
|
|
}
|
|
|
|
provisioner "shell" {
|
|
|
|
inline = ["chmod +x /usr/bin/*"]
|
|
|
|
}
|
2023-10-31 16:24:22 +01:00
|
|
|
|
2023-11-02 20:04:28 +01:00
|
|
|
provisioner "file" {
|
|
|
|
destination = "/etc/systemd/system/"
|
|
|
|
sources = [
|
2023-11-04 10:55:05 +01:00
|
|
|
"data/etc/systemd/system/bettercap.service",
|
2023-11-07 11:11:12 +01:00
|
|
|
"data/etc/systemd/system/pwnagotchi.service",
|
|
|
|
"data/etc/systemd/system/pwngrid-peer.service",
|
2023-11-02 20:04:28 +01:00
|
|
|
]
|
|
|
|
}
|
|
|
|
provisioner "file" {
|
|
|
|
destination = "/etc/update-motd.d/01-motd"
|
2023-11-04 10:55:05 +01:00
|
|
|
source = "data/etc/update-motd.d/01-motd"
|
2023-11-02 20:04:28 +01:00
|
|
|
}
|
|
|
|
provisioner "shell" {
|
|
|
|
inline = ["chmod +x /etc/update-motd.d/*"]
|
|
|
|
}
|
|
|
|
provisioner "shell" {
|
|
|
|
inline = ["apt-get -y --allow-releaseinfo-change update", "apt-get -y dist-upgrade", "apt-get install -y --no-install-recommends ansible"]
|
|
|
|
}
|
|
|
|
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\""]
|
2023-11-04 10:55:05 +01:00
|
|
|
playbook_dir = "extras/"
|
|
|
|
playbook_file = "raspberrypi32.yml"
|
2023-11-02 20:04:28 +01:00
|
|
|
}
|
|
|
|
}
|
2023-10-31 16:28:27 +01:00
|
|
|
|
2023-10-31 16:24:22 +01:00
|
|
|
build {
|
2023-10-31 16:28:27 +01:00
|
|
|
name = "Orange Pi Pwnagotchi"
|
|
|
|
sources = ["source.arm.opi-pwnagotchi"]
|
2023-10-31 16:19:45 +01:00
|
|
|
|
2023-09-29 10:08:38 +02:00
|
|
|
provisioner "file" {
|
2023-10-29 22:13:19 +01:00
|
|
|
destination = "/usr/bin/"
|
|
|
|
sources = [
|
2023-11-04 10:55:05 +01:00
|
|
|
"data/usr/bin/bettercap-launcher",
|
|
|
|
"data/usr/bin/hdmioff",
|
2023-11-07 11:11:12 +01:00
|
|
|
"data/usr/bin/hdmion",
|
|
|
|
"data/usr/bin/monstart",
|
|
|
|
"data/usr/bin/monstop",
|
|
|
|
"data/usr/bin/pwnagotchi-launcher",
|
|
|
|
"data/usr/bin/pwnlib",
|
2023-10-29 22:13:19 +01:00
|
|
|
]
|
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 = [
|
2023-11-04 10:55:05 +01:00
|
|
|
"data/etc/systemd/system/bettercap.service",
|
2023-11-07 11:11:12 +01:00
|
|
|
"data/etc/systemd/system/pwnagotchi.service",
|
|
|
|
"data/etc/systemd/system/pwngrid-peer.service",
|
2023-10-29 22:13:19 +01:00
|
|
|
]
|
|
|
|
}
|
2023-09-29 10:16:39 +02:00
|
|
|
provisioner "file" {
|
|
|
|
destination = "/etc/update-motd.d/01-motd"
|
2023-11-04 10:55:05 +01:00
|
|
|
source = "data/etc/update-motd.d/01-motd"
|
2023-09-29 10:16:39 +02:00
|
|
|
}
|
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\""]
|
2023-11-04 10:55:05 +01:00
|
|
|
playbook_file = "orangepi.yml"
|
2023-09-29 10:08:38 +02:00
|
|
|
}
|
2023-10-31 16:24:22 +01:00
|
|
|
}
|