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:
parent
a5610dd7d5
commit
a442bd7b26
4 changed files with 40 additions and 40 deletions
|
|
@ -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
|
||||
|
|
|
|||
37
roles/network/tasks/netwarn.yml
Normal file
37
roles/network/tasks/netwarn.yml
Normal 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?
|
||||
32
roles/network/templates/netwarn/netwarn
Executable file
32
roles/network/templates/netwarn/netwarn
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Some OS's like Ubuntu with LightDM *IGNORE* the above shebang line when this
|
||||
# script is invcked from /usr/share/mate/autostart/netwarn-iiab-network.desktop
|
||||
#
|
||||
# WHAT HAPPENS: sh (dash) NOT BASH will always be run! As confirmed by:
|
||||
#
|
||||
# ps -p $$ # Whereas 'echo $SHELL' DOES NOT show the actual running shell!
|
||||
#
|
||||
# RECAP: We hard-code the above '#!/bin/sh' for uniformity across all distros.
|
||||
|
||||
if [ -f /etc/iiab/install-flags/iiab-network-complete ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
zenity --question --width=360 --text="IIAB needs to configure networking:\n\n► Internet must be live before you begin.\n►You might be prompted for your password.\n\nContinue? (This can take 2-3 minutes)"
|
||||
rc=$?
|
||||
if [ "$rc" != "0" ]; then
|
||||
exit $rc
|
||||
fi
|
||||
|
||||
x-terminal-emulator -e /usr/local/bin/iiab-network
|
||||
rc=$?
|
||||
if [ "$rc" != "0" ]; then
|
||||
zenity --warning --width=360 --text="iiab-network exited with error: $rc\n\nPlease review /opt/iiab/iiab/iiab-network.log"
|
||||
exit $rc
|
||||
fi
|
||||
|
||||
zenity --question --width=360 --text="iiab-network complete.\n\nWould you like to REBOOT now? (Recommended)"
|
||||
if [ "$?" = "0" ]; then
|
||||
x-terminal-emulator -e "sudo reboot"
|
||||
fi
|
||||
10
roles/network/templates/netwarn/netwarn-iiab-network.desktop
Normal file
10
roles/network/templates/netwarn/netwarn-iiab-network.desktop
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[Desktop Entry]
|
||||
Name[en_US]=iiab-network
|
||||
Comment[en_US]=iiab-network
|
||||
Name[en_CA]=iiab-network
|
||||
Comment[en_CA]=iiab-network
|
||||
Type=Application
|
||||
Exec=/usr/local/sbin/netwarn
|
||||
Hidden=false
|
||||
Name=iiab-network
|
||||
Comment=iiab-network
|
||||
Loading…
Add table
Add a link
Reference in a new issue