From 57e62cc75e8a77205e6b7550f9ea01c3b68d4f1b Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 15 Jul 2019 14:27:20 -0400 Subject: [PATCH 1/6] roles/lokole/README.rst path/filename fix + refinements --- roles/lokole/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/lokole/README.rst b/roles/lokole/README.rst index d6d8b61c2..6e07ecfd4 100644 --- a/roles/lokole/README.rst +++ b/roles/lokole/README.rst @@ -71,9 +71,9 @@ This command will remove all users and all emails from the system. Nightly Internet Email Sync (Not Easy!) --------------------------------------- -The Lokole software can be configured to access the Internet via USB modem, SIM card, or Ethernet, by setting the environment variable ``OPWEN_SIM_TYPE`` in the configuration file ``/etc/apache2/sites-enabled/lokole.conf``. By default, this installation of Lokole is set to local-only (offline) mode, in which users can only send emails to other users on the same installation and cannot send emails over the Internet. This has been done by setting ``OPWEN_SIM_TYPE`` to ``LocalOnly``. +The Lokole software can be configured to access the Internet via USB modem, SIM card, or Ethernet, by setting the environment variable ``OPWEN_SIM_TYPE`` in configuration file `/home/lokole/state/webapp_secrets.sh `_. By default, this installation of Lokole is set to local-only (offline) mode, in which users can only send emails to other users on the same Internet-in-a-Box, and cannot send emails over the Internet. This has been done by setting ``OPWEN_SIM_TYPE`` to ``LocalOnly``. -If configured to work with a USB modem or other form of Internet connection, Lokole will sync with the cloud server (operated by `Ascoderu `_) on a nightly basis to deliver and receive emails globally. However, arranging this is extremely complicated. You would need a compatible form of connection and an Internet expert familiar with modem protocols, MX records, etc. Ask that person to read the `Lokole software README `_ in its entirety, to help you understand whether this is realistic for your organization. +If configured to work with a USB modem or other form of Internet connection, Lokole will sync with the cloud server (operated by `Ascoderu `_) on a nightly basis to deliver and receive emails globally. *However, arranging this is extremely complicated.* You would need a compatible form of connection and an Internet expert familiar with modem protocols, MX records, etc. Ask that person to read the `Lokole software README `_ in its entirety, to help you understand whether this is realistic for your organization. Lokole and Internet-in-a-Box would welcome a business plan (whether volunteer-based, grant-based or for-profit) from someone willing to operationalize this — making it relatively hassle-free for schools, clinics, libraries and orphanages around the world — that generally do not have access to technical experts. Please `contact us `_ if you have the capacity to help make such a social enterprise happen. From f0acae6992b0c723f867f49bf33327401e5d3137 Mon Sep 17 00:00:00 2001 From: Tim Moody Date: Mon, 15 Jul 2019 16:20:26 -0400 Subject: [PATCH 2/6] lots of stuff to fix kiwix lang codes used for kiwix_versions and menu defs --- roles/kiwix/templates/iiab-make-kiwix-lib.py | 23 ++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/roles/kiwix/templates/iiab-make-kiwix-lib.py b/roles/kiwix/templates/iiab-make-kiwix-lib.py index 7c9cb7412..95652ba3c 100755 --- a/roles/kiwix/templates/iiab-make-kiwix-lib.py +++ b/roles/kiwix/templates/iiab-make-kiwix-lib.py @@ -53,6 +53,9 @@ menuDefs = doc_root + "/js-menu/menu-files/menu-defs/" menuImages = doc_root + "/js-menu/menu-files/images/" menuJsonPath = doc_root + "/home/menu.json" +assets_dir = doc_root + "/common/assets/" +lang_codes_path = assets_dir + "lang_codes.json" +lang_codes = {} old_zim_map = {"bad.zim" : "unparseable name"} # Working variables @@ -184,6 +187,16 @@ def add_libr_xml(kiwix_library_xml, zim_path, zimname, zimidx): #print 'skipping ' + zimname pass +def read_lang_codes(): + global lang_codes + with open(lang_codes_path,"r") as f: + reads = f.read() + #print("menu.json:%s"%reads) + lang_codes = json.loads(reads) + +def kiwix_lang_to_iso2(zim_lang_code): + return lang_codes[zim_lang_code]['iso2'] + def init(): global iiab_base_path @@ -197,6 +210,7 @@ def init(): zim_path = config.get('kiwix','iiab_zim_path') kiwix_library_xml = config.get('kiwix','kiwix_library_xml') kiwix_manage = iiab_base_path + "/kiwix/bin/kiwix-manage" + read_lang_codes() def parse_args(): parser = argparse.ArgumentParser(description="Create library.xml for Kiwix.") @@ -218,6 +232,7 @@ def write_zim_versions_idx(): size = human_readable(float(size) * 1024) # kiwix reports in K zim_versions[perma_ref]['size'] = size zim_versions[perma_ref]['tags'] = tags + zim_versions[perma_ref]['language'] = lang zim_versions[perma_ref]['zim_date'] = date @@ -234,16 +249,16 @@ def get_substitution_data(perma_ref,zims_installed, path_to_id_map): path = 'content/' + zim_versions[perma_ref]['file_name'] + '.zim' id = path_to_id_map[path] item = zims_installed[id] + if len(item) != 0 or perma_ref == 'test': mediacount = item.get('mediaCount','') articlecount = item.get('articleCount','') size = item.get('size','') tags = item.get('tags','') - lang = item.get('language','') - if len(lang) > 2: - lang = lang[:2] + zim_lang = item.get('language') + menu_def_lang = kiwix_lang_to_iso2(zim_lang) date = item.get('date','') - return (articlecount,mediacount,size,tags,lang,date) + return (articlecount,mediacount,size,tags,menu_def_lang,date) return ('0','0','0','0','0','0') def get_menu_def_zimnames(intended_use='zim'): From 77956e368784820cb160301fdd8abd47a06477a7 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 16 Jul 2019 12:53:23 -0500 Subject: [PATCH 3/6] drop the use of shell, use ansible's systemd instead --- roles/2-common/tasks/udev.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/roles/2-common/tasks/udev.yml b/roles/2-common/tasks/udev.yml index 293280d6c..39ff410d4 100644 --- a/roles/2-common/tasks/udev.yml +++ b/roles/2-common/tasks/udev.yml @@ -21,20 +21,19 @@ state: present when: udev_unit.stat.exists is defined and udev_unit.stat.exists -# ubuntu 16.04 comes with ansible 2.0.0.2 -- no systemd module -- name: Ask systemd to reread unit files (daemon-reload) +- name: Ask systemd to reread unit files (daemon-reload) and restart so systemd recognizes the changes systemd: daemon_reload: yes + name: systemd-udevd + state: restarted when: udev_unit.stat.exists is defined and udev_unit.stat.exists -- name: Restart so systemd recognizes the changes - shell: systemctl restart systemd-udevd.service - when: udev_unit.stat.exists is defined and udev_unit.stat.exists - -- name: Reload systemd-udevd so it has rootfs open read-write +- name: Add udev-reload.service after all filesystems are available as read-write during boot template: src: udev-reload.service dest: /etc/systemd/system/ -- name: Enable the reload service - shell: systemctl enable udev-reload.service +- name: Enable the udev-reload service during boot. + systemd: + name: udev-reload + enabled: yes From 2298ece41625414a0b89961bd33b2e848df6254f Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 16 Jul 2019 12:55:47 -0500 Subject: [PATCH 4/6] add all config files before calling daemon_reload --- roles/2-common/tasks/udev.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/roles/2-common/tasks/udev.yml b/roles/2-common/tasks/udev.yml index 39ff410d4..2e16038d2 100644 --- a/roles/2-common/tasks/udev.yml +++ b/roles/2-common/tasks/udev.yml @@ -21,6 +21,12 @@ state: present when: udev_unit.stat.exists is defined and udev_unit.stat.exists +- name: Add udev-reload.service after all filesystems are available as read-write during boot + template: + src: udev-reload.service + dest: /etc/systemd/system/ + when: udev_unit.stat.exists is defined and udev_unit.stat.exists + - name: Ask systemd to reread unit files (daemon-reload) and restart so systemd recognizes the changes systemd: daemon_reload: yes @@ -28,12 +34,8 @@ state: restarted when: udev_unit.stat.exists is defined and udev_unit.stat.exists -- name: Add udev-reload.service after all filesystems are available as read-write during boot - template: - src: udev-reload.service - dest: /etc/systemd/system/ - - name: Enable the udev-reload service during boot. systemd: name: udev-reload enabled: yes + when: udev_unit.stat.exists is defined and udev_unit.stat.exists From 8bff00b9579e600983f087fc03af20edb6409cae Mon Sep 17 00:00:00 2001 From: A Holt Date: Tue, 16 Jul 2019 15:27:32 -0400 Subject: [PATCH 5/6] calibreweb_url -> calibreweb_url1 fix in comment, for Ansible --- roles/calibre-web/templates/calibre-web.conf.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/calibre-web/templates/calibre-web.conf.j2 b/roles/calibre-web/templates/calibre-web.conf.j2 index 369270aed..a24f25f6b 100644 --- a/roles/calibre-web/templates/calibre-web.conf.j2 +++ b/roles/calibre-web/templates/calibre-web.conf.j2 @@ -3,8 +3,8 @@ # Line used to work (in August 2018) but prevented http://box/books from working in October 2018: https://github.com/iiab/iiab/issues/1196 # -# Unnec when "{{ calibreweb_url }}" is added to Proxy* directive(s) further below -# +# Unnec when "{{ calibreweb_url1 }}" is added to Proxy* directive(s) further below +# # 2019-07-14: this line remains necessary (page barely renders without it!) RequestHeader set X-SCRIPT-NAME {{ calibreweb_url1 }} From 9c4dc791d48cff754b0c5dc1f1c74d1638320e4f Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 18 Jul 2019 10:28:03 -0500 Subject: [PATCH 6/6] don't supply patch_auto for debian-10 --- roles/network/tasks/debian.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network/tasks/debian.yml b/roles/network/tasks/debian.yml index 0c18c323b..43d40af23 100644 --- a/roles/network/tasks/debian.yml +++ b/roles/network/tasks/debian.yml @@ -49,11 +49,11 @@ src: network/rpi.j2 when: is_rpi and iiab_lan_iface == "br0" -- name: Workaround auto issue - ifupdown compatibility mode (debian-9 or debian-10) +- name: Workaround auto issue - ifupdown compatibility mode (debian-9) template: dest: /etc/network/interfaces.d/patch_auto src: network/debian-auto.j2 - when: iiab_wan_iface != "none" and (is_debian_9 or is_debian_10) + when: iiab_wan_iface != "none" and is_debian_9 - name: Clearing out /etc/network/interfaces for static addresses (debian-9) lineinfile: