Merge pull request #354 from caquino/caquino/papirus
papirus, fbi and idempotency changes
This commit is contained in:
commit
cdf11df270
@ -9,10 +9,12 @@
|
|||||||
system:
|
system:
|
||||||
boot_options:
|
boot_options:
|
||||||
- "dtoverlay=dwc2"
|
- "dtoverlay=dwc2"
|
||||||
- "dtparam=spi=on"
|
|
||||||
- "dtoverlay=spi1-3cs"
|
- "dtoverlay=spi1-3cs"
|
||||||
- "dtoverlay=i2c_arm=on"
|
- "dtparam=spi=on"
|
||||||
- "dtoverlay=i2c1=on"
|
- "dtparam=i2c_arm=on"
|
||||||
|
- "dtparam=i2c1=on"
|
||||||
|
modules:
|
||||||
|
- "i2c-dev"
|
||||||
services:
|
services:
|
||||||
enable:
|
enable:
|
||||||
- dphys-swapfile.service
|
- dphys-swapfile.service
|
||||||
@ -95,26 +97,28 @@
|
|||||||
- libfuse-dev
|
- libfuse-dev
|
||||||
- bc
|
- bc
|
||||||
- fonts-freefont-ttf
|
- fonts-freefont-ttf
|
||||||
|
- fbi
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: selected hostname
|
|
||||||
debug:
|
|
||||||
msg: "{{ pwnagotchi.hostname }}"
|
|
||||||
|
|
||||||
- name: build version
|
|
||||||
debug:
|
|
||||||
msg: "{{ pwnagotchi.version }}"
|
|
||||||
|
|
||||||
- name: change hostname
|
- name: change hostname
|
||||||
hostname:
|
hostname:
|
||||||
name: "{{pwnagotchi.hostname}}"
|
name: "{{pwnagotchi.hostname}}"
|
||||||
|
when: lookup('file', '/etc/hostname') == "raspberrypi"
|
||||||
|
register: hostname
|
||||||
|
|
||||||
- name: add hostname to /etc/hosts
|
- name: add hostname to /etc/hosts
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/hosts
|
dest: /etc/hosts
|
||||||
regexp: '^127\.0\.0\.1[ \t]+localhost'
|
regexp: '^127\.0\.1\.1[ \t]+raspberrypi'
|
||||||
line: '127.0.0.1 localhost {{pwnagotchi.hostname}} {{pwnagotchi.hostname}}.local'
|
line: "127.0.1.1\t{{pwnagotchi.hostname}}"
|
||||||
|
state: present
|
||||||
|
when: hostname.changed
|
||||||
|
|
||||||
|
- name: disable sap plugin for bluetooth.service
|
||||||
|
lineinfile:
|
||||||
|
dest: /lib/systemd/system/bluetooth.service
|
||||||
|
regexp: '^ExecStart=/usr/lib/bluetooth/bluetoothd$'
|
||||||
|
line: 'ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Add re4son-kernel repo key
|
- name: Add re4son-kernel repo key
|
||||||
@ -161,6 +165,7 @@
|
|||||||
git:
|
git:
|
||||||
repo: https://github.com/repaper/gratis.git
|
repo: https://github.com/repaper/gratis.git
|
||||||
dest: /usr/local/src/gratis
|
dest: /usr/local/src/gratis
|
||||||
|
register: gratisgit
|
||||||
|
|
||||||
- name: build papirus service
|
- name: build papirus service
|
||||||
make:
|
make:
|
||||||
@ -169,6 +174,7 @@
|
|||||||
params:
|
params:
|
||||||
EPD_IO: epd_io.h
|
EPD_IO: epd_io.h
|
||||||
PANEL_VERSION: 'V231_G2'
|
PANEL_VERSION: 'V231_G2'
|
||||||
|
when: gratisgit.changed
|
||||||
|
|
||||||
- name: install papirus service
|
- name: install papirus service
|
||||||
make:
|
make:
|
||||||
@ -177,6 +183,7 @@
|
|||||||
params:
|
params:
|
||||||
EPD_IO: epd_io.h
|
EPD_IO: epd_io.h
|
||||||
PANEL_VERSION: 'V231_G2'
|
PANEL_VERSION: 'V231_G2'
|
||||||
|
when: gratisgit.changed
|
||||||
|
|
||||||
- name: configure papirus display size
|
- name: configure papirus display size
|
||||||
lineinfile:
|
lineinfile:
|
||||||
@ -184,6 +191,16 @@
|
|||||||
regexp: "#EPD_SIZE=2.0"
|
regexp: "#EPD_SIZE=2.0"
|
||||||
line: "EPD_SIZE=2.0"
|
line: "EPD_SIZE=2.0"
|
||||||
|
|
||||||
|
- name: collect python pip package list
|
||||||
|
command: "pip3 list"
|
||||||
|
register: pip_output
|
||||||
|
|
||||||
|
- name: set python pip package facts
|
||||||
|
set_fact:
|
||||||
|
pip_packages: >
|
||||||
|
{{ pip_packages | default({}) | combine( { item.split()[0]: item.split()[1] } ) }}
|
||||||
|
with_items: "{{ pip_output.stdout_lines }}"
|
||||||
|
|
||||||
- name: acquire python3 pip target
|
- name: acquire python3 pip target
|
||||||
command: "python3 -c 'import sys;print(sys.path.pop())'"
|
command: "python3 -c 'import sys;print(sys.path.pop())'"
|
||||||
register: pip_target
|
register: pip_target
|
||||||
@ -192,26 +209,39 @@
|
|||||||
git:
|
git:
|
||||||
repo: https://github.com/evilsocket/pwnagotchi.git
|
repo: https://github.com/evilsocket/pwnagotchi.git
|
||||||
dest: /usr/local/src/pwnagotchi
|
dest: /usr/local/src/pwnagotchi
|
||||||
|
register: pwnagotchigit
|
||||||
|
|
||||||
|
- name: fetch pwnagotchi version
|
||||||
|
set_fact:
|
||||||
|
pwnagotchi_version: "{{ lookup('file', '/usr/local/src/pwnagotchi/pwnagotchi/__init__.py') | replace('\n', ' ') | regex_replace('.*version.*=.*''([0-9]+\\.[0-9]+\\.[0-9]+[A-Za-z0-9]*)''.*', '\\1') }}"
|
||||||
|
|
||||||
|
- name: pwnagotchi version found
|
||||||
|
debug:
|
||||||
|
msg: "{{ pwnagotchi_version }}"
|
||||||
|
|
||||||
- name: build pwnagotchi wheel
|
- name: build pwnagotchi wheel
|
||||||
command: "python3 setup.py sdist bdist_wheel"
|
command: "python3 setup.py sdist bdist_wheel"
|
||||||
args:
|
args:
|
||||||
chdir: /usr/local/src/pwnagotchi
|
chdir: /usr/local/src/pwnagotchi
|
||||||
|
when: (pwnagotchigit.changed) or (pip_packages['pwnagotchi'] is undefined) or (pip_packages['pwnagotchi'] != pwnagotchi.version)
|
||||||
|
|
||||||
- name: install opencv-python
|
- name: install opencv-python
|
||||||
pip:
|
pip:
|
||||||
name: "https://www.piwheels.hostedpi.com/simple/opencv-python/opencv_python-3.4.3.18-cp37-cp37m-linux_armv6l.whl"
|
name: "https://www.piwheels.hostedpi.com/simple/opencv-python/opencv_python-3.4.3.18-cp37-cp37m-linux_armv6l.whl"
|
||||||
extra_args: "--no-deps --no-cache-dir --platform=linux_armv6l --only-binary=:all: --target={{ pip_target.stdout }}"
|
extra_args: "--no-deps --no-cache-dir --platform=linux_armv6l --only-binary=:all: --target={{ pip_target.stdout }}"
|
||||||
|
when: (pip_packages['opencv-python'] is undefined) or (pip_packages['opencv-python'] != '3.4.3.18')
|
||||||
|
|
||||||
- name: install tensorflow
|
- name: install tensorflow
|
||||||
pip:
|
pip:
|
||||||
name: "https://www.piwheels.hostedpi.com/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl"
|
name: "https://www.piwheels.hostedpi.com/simple/tensorflow/tensorflow-1.13.1-cp37-none-linux_armv6l.whl"
|
||||||
extra_args: "--no-deps --no-cache-dir --platform=linux_armv6l --only-binary=:all: --target={{ pip_target.stdout }}"
|
extra_args: "--no-deps --no-cache-dir --platform=linux_armv6l --only-binary=:all: --target={{ pip_target.stdout }}"
|
||||||
|
when: (pip_packages['tensorflow'] is undefined) or (pip_packages['tensorflow'] != '1.13.1')
|
||||||
|
|
||||||
- name: install pwnagotchi wheel and dependencies
|
- name: install pwnagotchi wheel and dependencies
|
||||||
pip:
|
pip:
|
||||||
name: "{{ lookup('fileglob', '/usr/local/src/pwnagotchi/dist/pwnagotchi*.whl') }}"
|
name: "{{ lookup('fileglob', '/usr/local/src/pwnagotchi/dist/pwnagotchi*.whl') }}"
|
||||||
extra_args: "--no-cache-dir"
|
extra_args: "--no-cache-dir"
|
||||||
|
when: (pwnagotchigit.changed) or (pip_packages['pwnagotchi'] is undefined) or (pip_packages['pwnagotchi'] != pwnagotchi.version)
|
||||||
|
|
||||||
- name: download and install pwngrid
|
- name: download and install pwngrid
|
||||||
unarchive:
|
unarchive:
|
||||||
@ -234,11 +264,13 @@
|
|||||||
git:
|
git:
|
||||||
repo: https://github.com/bettercap/caplets.git
|
repo: https://github.com/bettercap/caplets.git
|
||||||
dest: /tmp/caplets
|
dest: /tmp/caplets
|
||||||
|
register: capletsgit
|
||||||
|
|
||||||
- name: install bettercap caplets
|
- name: install bettercap caplets
|
||||||
make:
|
make:
|
||||||
chdir: /tmp/caplets
|
chdir: /tmp/caplets
|
||||||
target: install
|
target: install
|
||||||
|
when: capletsgit.changed
|
||||||
|
|
||||||
- name: download and install bettercap ui
|
- name: download and install bettercap ui
|
||||||
unarchive:
|
unarchive:
|
||||||
@ -247,26 +279,6 @@
|
|||||||
remote_src: yes
|
remote_src: yes
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: create cpuusage script
|
|
||||||
copy:
|
|
||||||
dest: /usr/bin/cpuusage
|
|
||||||
mode: 0755
|
|
||||||
content: |
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
top -b -n1 | awk '/Cpu\(s\)/ { printf("%d %", $2 + $4 + 0.5) }'
|
|
||||||
sleep 3
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: create memusage script
|
|
||||||
copy:
|
|
||||||
dest: /usr/bin/memusage
|
|
||||||
mode: 0755
|
|
||||||
content: |
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
free -m | awk '/Mem/ { printf( "%d %", $3 / $2 * 100 + 0.5 ) }'
|
|
||||||
|
|
||||||
- name: create bootblink script
|
- name: create bootblink script
|
||||||
copy:
|
copy:
|
||||||
dest: /usr/bin/bootblink
|
dest: /usr/bin/bootblink
|
||||||
@ -434,6 +446,13 @@
|
|||||||
line: '{{ item }}'
|
line: '{{ item }}'
|
||||||
with_items: "{{system.boot_options}}"
|
with_items: "{{system.boot_options}}"
|
||||||
|
|
||||||
|
- name: adjust /etc/modules
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/modules
|
||||||
|
insertafter: EOF
|
||||||
|
line: '{{ item }}'
|
||||||
|
with_items: "{{system.modules}}"
|
||||||
|
|
||||||
- name: change root partition
|
- name: change root partition
|
||||||
replace:
|
replace:
|
||||||
dest: /boot/cmdline.txt
|
dest: /boot/cmdline.txt
|
||||||
@ -480,6 +499,7 @@
|
|||||||
touch /root/.pwnagotchi-auto && systemctl restart pwnagotchi
|
touch /root/.pwnagotchi-auto && systemctl restart pwnagotchi
|
||||||
|
|
||||||
You learn more about me at https://pwnagotchi.ai/
|
You learn more about me at https://pwnagotchi.ai/
|
||||||
|
when: hostname.changed
|
||||||
|
|
||||||
- name: clean apt cache
|
- name: clean apt cache
|
||||||
apt:
|
apt:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user