mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
51e5dee408
4 changed files with 27 additions and 15 deletions
|
@ -88,6 +88,9 @@ gui_static_wan_ip: "unset"
|
||||||
wondershaper_dspeed: "4096"
|
wondershaper_dspeed: "4096"
|
||||||
wondershaper_upspeed: "1024"
|
wondershaper_upspeed: "1024"
|
||||||
|
|
||||||
|
# netplan
|
||||||
|
fix_dispatcher: True
|
||||||
|
|
||||||
# Unused
|
# Unused
|
||||||
# network_config_dir: /etc/network/interfaces.d
|
# network_config_dir: /etc/network/interfaces.d
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,12 @@
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ netplan.stdout_lines }}"
|
- "{{ netplan.stdout_lines }}"
|
||||||
|
|
||||||
|
- name: Replace networkd-dispatcher #2585 for "groovy"
|
||||||
|
get_url:
|
||||||
|
url: https://gitlab.com/craftyguy/networkd-dispatcher/-/raw/2.1/networkd-dispatcher
|
||||||
|
dest: /usr/bin/networkd-dispatcher
|
||||||
|
when: internet_available and fix_dispatcher and ansible_distribution_release == "groovy"
|
||||||
|
|
||||||
#- name: Supply netplan template
|
#- name: Supply netplan template
|
||||||
# template:
|
# template:
|
||||||
# dest: /etc/netplan/01-iiab-config.yaml
|
# dest: /etc/netplan/01-iiab-config.yaml
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/bash -x
|
#!/bin/bash -x
|
||||||
# Small daemon to identify this machine to the OpenVPN server
|
# Small daemon to identify this machine to the OpenVPN server
|
||||||
|
|
||||||
HANDLE=
|
#HANDLE=
|
||||||
UUID=
|
#UUID=
|
||||||
if [ -f /etc/iiab/openvpn_handle ]; then
|
#if [ -f /etc/iiab/openvpn_handle ]; then
|
||||||
# Option #1: Source directly from /etc/iiab/local_vars.yml in future?
|
# Option #1: Source directly from /etc/iiab/local_vars.yml in future?
|
||||||
# Option #2
|
# Option #2
|
||||||
HANDLE=`cat /etc/iiab/openvpn_handle`
|
HANDLE=$(cat /etc/iiab/openvpn_handle) # Sets to "" if file doesn't exist (error is ok!)
|
||||||
|
|
||||||
# Sourcing a variable from ~4 different places is a recipe for total confusion
|
# Sourcing a variable from ~4 different places is a recipe for total confusion
|
||||||
# (or worse!) Far better to make variable openvpn_handle and file
|
# (or worse!) Far better to make variable openvpn_handle and file
|
||||||
|
@ -25,20 +25,24 @@ if [ -f /etc/iiab/openvpn_handle ]; then
|
||||||
# HANDLE=`cat {{ iiab_ini_file }} | gawk \
|
# HANDLE=`cat {{ iiab_ini_file }} | gawk \
|
||||||
# '{ if((toupper($1) == "HANDLE") && ($2 == "=")) { print $3;}}'`
|
# '{ if((toupper($1) == "HANDLE") && ($2 == "=")) { print $3;}}'`
|
||||||
# fi
|
# fi
|
||||||
fi
|
#fi
|
||||||
HANDLE=${HANDLE// /_}
|
HANDLE=${HANDLE// /_} # Change all spaces to underscores
|
||||||
if [ -f /etc/iiab/uuid ]; then
|
#if [ -f /etc/iiab/uuid ]; then
|
||||||
UUID=`cat /etc/iiab/uuid`
|
UUID=$(cat /etc/iiab/uuid) # Sets to "" if file doesn't exist (error is ok!)
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
SERVER=/usr/bin/ncat
|
SERVER=/usr/bin/ncat
|
||||||
ID=`printf "HANDLE = %s|UUID = %s" $HANDLE $UUID`
|
#ID=$(printf "HANDLE = %s|UUID = %s" $HANDLE $UUID)
|
||||||
# August 2018: Removal of trailing slash tested on Raspbian, Ubuntu 18.04 & Ubuntu 16.04
|
#ID=$(echo "HANDLE = ${HANDLE}|UUID = ${UUID}")
|
||||||
|
ID=$(echo "HANDLE = $HANDLE|UUID = $UUID")
|
||||||
|
# August 2018: Removal of trailing '|' tested on Raspbian, Ubuntu 18.04 & Ubuntu 16.04
|
||||||
#ID=`printf "HANDLE = %s|UUID = %s|" $HANDLE $UUID`
|
#ID=`printf "HANDLE = %s|UUID = %s|" $HANDLE $UUID`
|
||||||
|
|
||||||
# Start the daemon which will serve the handle on demand
|
# Start the daemon which will serve the handle on demand
|
||||||
{% if is_debuntu %}
|
{% if is_debuntu %}
|
||||||
$SERVER -l -k -p1705 --exec "/bin/echo $ID" &
|
$SERVER -l -k -p1705 --exec "/bin/echo $ID" &
|
||||||
|
# 2020-11-23: USE 1 LINE INSTEAD OF 9 LINES, IF WE MANDATE debuntu:
|
||||||
|
#/usr/bin/ncat -l -k -p1705 --exec "/bin/echo HANDLE = $HANDLE|UUID = $UUID" &
|
||||||
{% else %}
|
{% else %}
|
||||||
source /etc/init.d/functions
|
source /etc/init.d/functions
|
||||||
PID_FILE=/var/run/openvpn/announce.pid
|
PID_FILE=/var/run/openvpn/announce.pid
|
||||||
|
|
|
@ -55,7 +55,7 @@ def get_zim_list(path):
|
||||||
zim_versions[perma_ref] = zim_info # if there are multiples, last should win
|
zim_versions[perma_ref] = zim_info # if there are multiples, last should win
|
||||||
return files_processed, zim_versions
|
return files_processed, zim_versions
|
||||||
|
|
||||||
def read_library_xml(lib_xml_file, kiwix_exclude_attr=[""]): # duplicated from iiab-cmdsrv
|
def read_library_xml(lib_xml_file, kiwix_exclude_attr=["favicon"]): # duplicated from iiab-cmdsrv but changed
|
||||||
'''
|
'''
|
||||||
Read zim properties from library.xml
|
Read zim properties from library.xml
|
||||||
Returns dict of library.xml and map of zim id to zim file name (under <dev>/library/zims)
|
Returns dict of library.xml and map of zim id to zim file name (under <dev>/library/zims)
|
||||||
|
@ -69,8 +69,7 @@ def read_library_xml(lib_xml_file, kiwix_exclude_attr=[""]): # duplicated from i
|
||||||
path_to_id_map (dict): A dictionary that translates zim ids to physical names
|
path_to_id_map (dict): A dictionary that translates zim ids to physical names
|
||||||
'''
|
'''
|
||||||
|
|
||||||
kiwix_exclude_attr.append("id") # don't include id
|
kiwix_exclude_attr.append("id") # don't include id because is key
|
||||||
kiwix_exclude_attr.append("favicon") # don't include large favicon
|
|
||||||
zims_installed = {}
|
zims_installed = {}
|
||||||
path_to_id_map = {}
|
path_to_id_map = {}
|
||||||
try:
|
try:
|
||||||
|
@ -108,7 +107,7 @@ def rem_libr_xml(zim_id, kiwix_library_xml):
|
||||||
if e.returncode != 2: # skip bogus file open error in kiwix-manage
|
if e.returncode != 2: # skip bogus file open error in kiwix-manage
|
||||||
print(outp)
|
print(outp)
|
||||||
|
|
||||||
def add_libr_xml(kiwix_library_xml, zim_path, zimname, zimidx):
|
def add_libr_xml(kiwix_library_xml, zim_path, zimname, zimidx=None):
|
||||||
'''
|
'''
|
||||||
Add a zim to library.xml
|
Add a zim to library.xml
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue