{
  "builders": [
    {
      "name": "pwnagotchi",
      "type": "arm-image",
      "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",
      "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",
      "target_image_size": 9368709120,
      "qemu_binary": "qemu-aarch64-static",
      "output_filename": "images/pwnagotchi-{{user `pwn_version`}}-arm64.img"
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "uname -a",
        "dpkg-architecture",
        "mkdir -p /usr/local/src/pwnagotchi"
      ]
    },
    {
      "type": "file",
      "source": "../builder/data/usr/bin/pwnlib",
      "destination": "/usr/bin/pwnlib"
    },
    {
      "type": "file",
      "source": "../builder/data/usr/bin/bettercap-launcher",
      "destination": "/usr/bin/bettercap-launcher"
    },
    {
      "type": "file",
      "source": "../builder/data/usr/bin/pwnagotchi-launcher",
      "destination": "/usr/bin/pwnagotchi-launcher"
    },
    {
      "type": "file",
      "source": "../builder/data/usr/bin/monstop",
      "destination": "/usr/bin/monstop"
    },
    {
      "type": "file",
      "source": "../builder/data/usr/bin/monstart",
      "destination": "/usr/bin/monstart"
    },
    {
      "type": "file",
      "source": "../builder/data/usr/bin/hdmion",
      "destination": "/usr/bin/hdmion"
    },
    {
      "type": "file",
      "source": "../builder/data/usr/bin/hdmioff",
      "destination": "/usr/bin/hdmioff"
    },
    {
      "type": "file",
      "source": "../builder/data/etc/network/interfaces.d/lo-cfg",
      "destination": "/etc/network/interfaces.d/lo-cfg"
    },
    {
      "type": "file",
      "source": "../builder/data/etc/network/interfaces.d/wlan0-cfg",
      "destination": "/etc/network/interfaces.d/wlan0-cfg"
    },
    {
      "type": "file",
      "source": "../builder/data/etc/network/interfaces.d/usb0-cfg",
      "destination": "/etc/network/interfaces.d/usb0-cfg"
    },
    {
      "type": "file",
      "source": "../builder/data/etc/network/interfaces.d/eth0-cfg",
      "destination": "/etc/network/interfaces.d/eth0-cfg"
    },
    {
      "type": "file",
      "source": "../builder/data/etc/systemd/system/pwngrid-peer.service",
      "destination": "/etc/systemd/system/pwngrid-peer.service"
    },
    {
      "type": "file",
      "source": "../builder/data/etc/systemd/system/pwnagotchi.service",
      "destination": "/etc/systemd/system/pwnagotchi.service"
    },
    {
      "type": "file",
      "source": "../builder/data/etc/systemd/system/bettercap.service",
      "destination": "/etc/systemd/system/bettercap.service"
    },
    {
      "type": "shell",
      "inline": [
        "chmod +x /usr/bin/*"
      ]
    },
    {
      "type": "shell",
      "inline": [
        "chmod +x /etc/update-motd.d/*"
      ]
    },
    {
      "type": "shell",
      "inline": [
        "apt-get -y --allow-releaseinfo-change update",
        "apt-get -y dist-upgrade",
        "apt-get install -y ansible"
      ]
    },
    {
      "type": "ansible-local",
      "playbook_file": "../builder/pwnagotchi.yml",
      "extra_arguments": [
        "--extra-vars \"ansible_python_interpreter=/usr/bin/python3\""
      ],
      "command": "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION={{user `pwn_version`}} PWN_HOSTNAME={{user `pwn_hostname`}} ansible-playbook"
    }
  ]
}
