1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Move scripts/netwarn* to roles/network/templates/netwarn/

This commit is contained in:
root 2022-07-21 15:14:09 -04:00
parent a5610dd7d5
commit a442bd7b26
4 changed files with 40 additions and 40 deletions

View file

@ -1,7 +1,7 @@
# 2022-03-16: 'apt show <pkg> | grep Size' revealed download sizes, on 64-bit RasPiOS with desktop.
- name: Install dnsmasq -- configure LATER in 'network', after Stage 9
include_tasks: roles/network/tasks/dnsmasq.yml
include_tasks: dnsmasq.yml
- name: Install package networkd-dispatcher (OS's other than RasPiOS)
package:
@ -94,50 +94,13 @@
template:
src: "{{ item }}"
dest: /usr/bin/
# owner: root
# group: root
mode: 0755
with_items:
- gateway/iiab-internet-on
- gateway/iiab-internet-off
# mate desktop detection based on 'register: nd_dir' in enable_services
- name: Check if /usr/share/mate/autostart/ exists
stat:
path: /usr/share/mate/autostart/
register: mate_dir
# contents work with mate as of 'switch to using dash via sh'
# 'text' is up for debate other structural changes I do not recommend JV
# if need be cut a second version for RasPiOS
- name: Link /usr/local/sbin/netwarn to {{ iiab_dir }}/scripts/netwarn
file:
src: "{{ iiab_dir }}/scripts/netwarn"
dest: /usr/local/sbin/netwarn
state: link
when: mate_dir.stat.exists and mate_dir.stat.isdir
- name: Link /usr/share/mate/autostart/netwarn-iiab-network.desktop to {{ iiab_dir }}/scripts/netwarn-iiab-network.desktop
file:
src: "{{ iiab_dir }}/scripts/netwarn-iiab-network.desktop"
dest: /usr/share/mate/autostart/netwarn-iiab-network.desktop
state: link
when: mate_dir.stat.exists and mate_dir.stat.isdir
- name: Does /etc/xdg/lxsession/LXDE-pi/autostart exist?
stat:
path: /etc/xdg/lxsession/LXDE-pi/autostart
register: lxde_pi_autostart_present
- name: If so, add /usr/local/sbin/netwarn to /etc/xdg/lxsession/LXDE-pi/autostart
lineinfile:
path: /etc/xdg/lxsession/LXDE-pi/autostart
regexp: '^/usr/local/sbin/netwarn$'
line: '/usr/local/sbin/netwarn'
when: lxde_pi_autostart_present.stat.exists
# Add logic for Mint & stock Ubuntu here? (in addition to Mate & LXDE-pi)
- name: 'Install /usr/local/sbin/netwarn for pop-ups on boot, if iiab-network should be run'
include_tasks: netwarn.yml
# RECORD Network AS INSTALLED

View file

@ -0,0 +1,37 @@
# mate desktop detection based on 'register: nd_dir' in enable_services
- name: Does /usr/share/mate/autostart/ exist?
stat:
path: /usr/share/mate/autostart/
register: mate_dir
# contents work with mate as of 'switch to using dash via sh'
# 'text' is up for debate other structural changes I do not recommend JV
- name: 'Install from template: /usr/local/sbin/netwarn'
file:
src: netwarn/netwarn
dest: /usr/local/sbin/
mode: 0755
when: mate_dir.stat.exists and mate_dir.stat.isdir
- name: 'Install from template: /usr/share/mate/autostart/netwarn-iiab-network.desktop'
file:
src: netwarn/netwarn-iiab-network.desktop
dest: /usr/share/mate/autostart/
when: mate_dir.stat.exists and mate_dir.stat.isdir
- name: Does /etc/xdg/lxsession/LXDE-pi/autostart exist?
stat:
path: /etc/xdg/lxsession/LXDE-pi/autostart
register: lxde_pi_autostart_present
- name: If so, add /usr/local/sbin/netwarn to /etc/xdg/lxsession/LXDE-pi/autostart
lineinfile:
path: /etc/xdg/lxsession/LXDE-pi/autostart
regexp: '^/usr/local/sbin/netwarn$'
line: '/usr/local/sbin/netwarn'
when: lxde_pi_autostart_present.stat.exists
# 2022-07-21: Is autostart pop-up logic for Mint & stock Ubuntu much the same?

View file