From 63d95a53c01997f0b3bbcce0bbba2035f8b5babd Mon Sep 17 00:00:00 2001
From: Cassiano Aquino <cassianoaquino@me.com>
Date: Wed, 9 Oct 2019 16:57:00 +0100
Subject: [PATCH] add papirus display system requirements

---
 builder/pwnagotchi.yml | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml
index 7f29ded..c57e38c 100644
--- a/builder/pwnagotchi.yml
+++ b/builder/pwnagotchi.yml
@@ -11,11 +11,14 @@
         - "dtoverlay=dwc2"
         - "dtparam=spi=on"
         - "dtoverlay=spi1-3cs"
+        - "dtoverlay=i2c_arm=on"
+        - "dtoverlay=i2c1=on"
     services:
       enable:
         - dphys-swapfile.service
         - pwnagotchi.service
         - bettercap.service
+        - epd-fuse.service
       disable:
         - apt-daily.timer
         - apt-daily.service
@@ -78,6 +81,10 @@
           - fonts-dejavu-core
           - fonts-dejavu-extra
           - python3-pil
+          - python3-smbus
+          - libfuse-dev
+          - bc
+          - fonts-freefont-ttf
 
   tasks:
 
@@ -134,6 +141,33 @@
       path: /etc/dphys-swapfile
       content: "CONF_SWAPSIZE=1024"
 
+  - name: clone papirus repository
+    git:
+      repo: https://github.com/repaper/gratis.git
+      dest: /usr/local/src/gratis
+
+  - name: build papirus service
+    make:
+      chdir: /usr/local/src/gratis
+      target: rpi
+      params:
+        EPD_IO: epd_io.h
+        PANEL_VERSION: 'V231_G2'
+
+  - name: install papirus service
+    make:
+      chdir: /usr/local/src/gratis
+      target: rpi-install
+      params:
+        EPD_IO: epd_io.h
+        PANEL_VERSION: 'V231_G2'
+
+  - name: configure papirus display size
+    lineinfile:
+      dest: /etc/default/epd-fuse
+      regexp: "#EPD_SIZE=2.0"
+      line: "EPD_SIZE=2.0"
+
   - name: acquire python3 pip target
     command: "python3 -c 'import sys;print(sys.path.pop())'"
     register: pip_target