diff --git a/builder/pwnagotchi.json.pkr.hcl b/builder/pwnagotchi.json.pkr.hcl new file mode 100644 index 00000000..5eadfcf4 --- /dev/null +++ b/builder/pwnagotchi.json.pkr.hcl @@ -0,0 +1,117 @@ +# This file was autogenerated by the BETA 'packer hcl2_upgrade' command. We +# recommend double checking that everything is correct before going forward. We +# also recommend treating this file as disposable. The HCL2 blocks in this +# file can be moved to other files. For example, the variable blocks could be +# moved to their own 'variables.pkr.hcl' file, etc. Those files need to be +# suffixed with '.pkr.hcl' to be visible to Packer. To use multiple files at +# once they also need to be in the same folder. 'packer inspect folder/' +# will describe to you what is in that folder. + +# Avoid mixing go templating calls ( for example ```{{ upper(`string`) }}``` ) +# and HCL2 calls (for example '${ var.string_value_example }' ). They won't be +# executed together and the outcome will be unknown. + +# All generated input variables will be of 'string' type as this is how Packer JSON +# views them; you can change their type later on. Read the variables type +# constraints documentation +# https://www.packer.io/docs/from-1.5/variables#type-constraints for more info. +# "timestamp" template function replacement +locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") } + +# source blocks are generated from your builders; a source can be referenced in +# build blocks. A build block runs provisioner and post-processors on a +# source. Read the documentation for source blocks here: +# https://www.packer.io/docs/from-1.5/blocks/source +packer { + required_plugins { + arm-image = { + version = ">= 0.2.7" + source = "github.com/solo-io/arm-image" + } + } +} +source "arm-image" "pwnagotchi" { + 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" + output_filename = "../../../pwnagotchi-${var.pwn_version}-arm64.img" + qemu_binary = "qemu-aarch64-static" + target_image_size = 9368709120 +} + +# 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 { + sources = ["source.arm-image.pwnagotchi"] + + provisioner "file" { + destination = "/usr/bin/pwnlib" + source = "../builder/data/usr/bin/pwnlib" + } + provisioner "file" { + destination = "/usr/bin/bettercap-launcher" + source = "../builder/data/usr/bin/bettercap-launcher" + } + provisioner "file" { + destination = "/usr/bin/pwnagotchi-launcher" + source = "../builder/data/usr/bin/pwnagotchi-launcher" + } + provisioner "file" { + destination = "/usr/bin/monstop" + source = "../builder/data/usr/bin/monstop" + } + provisioner "file" { + destination = "/usr/bin/monstart" + source = "../builder/data/usr/bin/monstart" + } + provisioner "file" { + destination = "/usr/bin/hdmion" + source = "../builder/data/usr/bin/hdmion" + } + provisioner "file" { + destination = "/usr/bin/hdmioff" + source = "../builder/data/usr/bin/hdmioff" + } + provisioner "file" { + destination = "/etc/network/interfaces.d/lo-cfg" + source = "../builder/data/etc/network/interfaces.d/lo-cfg" + } + provisioner "file" { + destination = "/etc/network/interfaces.d/wlan0-cfg" + source = "../builder/data/etc/network/interfaces.d/wlan0-cfg" + } + provisioner "file" { + destination = "/etc/network/interfaces.d/usb0-cfg" + source = "../builder/data/etc/network/interfaces.d/usb0-cfg" + } + provisioner "file" { + destination = "/etc/network/interfaces.d/eth0-cfg" + source = "../builder/data/etc/network/interfaces.d/eth0-cfg" + } + provisioner "file" { + destination = "/etc/systemd/system/pwngrid-peer.service" + source = "../builder/data/etc/systemd/system/pwngrid-peer.service" + } + provisioner "file" { + destination = "/etc/systemd/system/pwnagotchi.service" + source = "../builder/data/etc/systemd/system/pwnagotchi.service" + } + provisioner "file" { + destination = "/etc/systemd/system/bettercap.service" + source = "../builder/data/etc/systemd/system/bettercap.service" + } + provisioner "shell" { + inline = ["chmod +x /usr/bin/*"] + } + 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 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\""] + playbook_file = "../builder/pwnagotchi.yml" + } +} diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index a9ece67a..25ec666c 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -65,7 +65,6 @@ - libraspberrypi-dev - libraspberrypi-doc - libraspberrypi-bin - - ansible install: - bluez - raspberrypi-kernel-headers