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

Merge pull request #272 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2019-07-18 11:49:57 -04:00 committed by GitHub
commit 15221a2832
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 23 deletions

View file

@ -21,20 +21,21 @@
state: present state: present
when: udev_unit.stat.exists is defined and udev_unit.stat.exists 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: Add udev-reload.service after all filesystems are available as read-write during boot
- name: Ask systemd to reread unit files (daemon-reload)
systemd:
daemon_reload: yes
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
template: template:
src: udev-reload.service src: udev-reload.service
dest: /etc/systemd/system/ dest: /etc/systemd/system/
when: udev_unit.stat.exists is defined and udev_unit.stat.exists
- name: Enable the reload service - name: Ask systemd to reread unit files (daemon-reload) and restart so systemd recognizes the changes
shell: systemctl enable udev-reload.service systemd:
daemon_reload: yes
name: systemd-udevd
state: restarted
when: udev_unit.stat.exists is defined and udev_unit.stat.exists
- 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

View file

@ -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 # Line used to work (in August 2018) but prevented http://box/books from working in October 2018: https://github.com/iiab/iiab/issues/1196
#<VirtualHost *:80> #<VirtualHost *:80>
# Unnec when "{{ calibreweb_url }}" is added to Proxy* directive(s) further below # Unnec when "{{ calibreweb_url1 }}" is added to Proxy* directive(s) further below
# <Location "{{ calibreweb_url }}" > # <Location "{{ calibreweb_url1 }}" >
# 2019-07-14: this line remains necessary (page barely renders without it!) # 2019-07-14: this line remains necessary (page barely renders without it!)
RequestHeader set X-SCRIPT-NAME {{ calibreweb_url1 }} RequestHeader set X-SCRIPT-NAME {{ calibreweb_url1 }}

View file

@ -53,6 +53,9 @@ menuDefs = doc_root + "/js-menu/menu-files/menu-defs/"
menuImages = doc_root + "/js-menu/menu-files/images/" menuImages = doc_root + "/js-menu/menu-files/images/"
menuJsonPath = doc_root + "/home/menu.json" 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"} old_zim_map = {"bad.zim" : "unparseable name"}
# Working variables # Working variables
@ -184,6 +187,16 @@ def add_libr_xml(kiwix_library_xml, zim_path, zimname, zimidx):
#print 'skipping ' + zimname #print 'skipping ' + zimname
pass 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(): def init():
global iiab_base_path global iiab_base_path
@ -197,6 +210,7 @@ def init():
zim_path = config.get('kiwix','iiab_zim_path') zim_path = config.get('kiwix','iiab_zim_path')
kiwix_library_xml = config.get('kiwix','kiwix_library_xml') kiwix_library_xml = config.get('kiwix','kiwix_library_xml')
kiwix_manage = iiab_base_path + "/kiwix/bin/kiwix-manage" kiwix_manage = iiab_base_path + "/kiwix/bin/kiwix-manage"
read_lang_codes()
def parse_args(): def parse_args():
parser = argparse.ArgumentParser(description="Create library.xml for Kiwix.") 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 size = human_readable(float(size) * 1024) # kiwix reports in K
zim_versions[perma_ref]['size'] = size zim_versions[perma_ref]['size'] = size
zim_versions[perma_ref]['tags'] = tags zim_versions[perma_ref]['tags'] = tags
zim_versions[perma_ref]['language'] = lang zim_versions[perma_ref]['language'] = lang
zim_versions[perma_ref]['zim_date'] = date 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' path = 'content/' + zim_versions[perma_ref]['file_name'] + '.zim'
id = path_to_id_map[path] id = path_to_id_map[path]
item = zims_installed[id] item = zims_installed[id]
if len(item) != 0 or perma_ref == 'test': if len(item) != 0 or perma_ref == 'test':
mediacount = item.get('mediaCount','') mediacount = item.get('mediaCount','')
articlecount = item.get('articleCount','') articlecount = item.get('articleCount','')
size = item.get('size','') size = item.get('size','')
tags = item.get('tags','') tags = item.get('tags','')
lang = item.get('language','') zim_lang = item.get('language')
if len(lang) > 2: menu_def_lang = kiwix_lang_to_iso2(zim_lang)
lang = lang[:2]
date = item.get('date','') 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') return ('0','0','0','0','0','0')
def get_menu_def_zimnames(intended_use='zim'): def get_menu_def_zimnames(intended_use='zim'):

View file

@ -71,9 +71,9 @@ This command will remove all users and all emails from the system.
Nightly Internet Email Sync (Not Easy!) 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 <https://github.com/iiab/iiab/blob/master/roles/lokole/templates/webapp_secrets.sh.j2>`_. 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 <https://ascoderu.ca/>`_) 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 <https://github.com/ascoderu/opwen-webapp/blob/master/README.rst>`_ 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 <https://ascoderu.ca/>`_) 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 <https://github.com/ascoderu/opwen-webapp/blob/master/README.rst>`_ 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 <http://wiki.laptop.org/go/IIAB/FAQ#What_are_the_best_places_for_community_support.3F>`_ if you have the capacity to help make such a social enterprise happen. 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 <http://wiki.laptop.org/go/IIAB/FAQ#What_are_the_best_places_for_community_support.3F>`_ if you have the capacity to help make such a social enterprise happen.

View file

@ -49,11 +49,11 @@
src: network/rpi.j2 src: network/rpi.j2
when: is_rpi and iiab_lan_iface == "br0" 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: template:
dest: /etc/network/interfaces.d/patch_auto dest: /etc/network/interfaces.d/patch_auto
src: network/debian-auto.j2 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) - name: Clearing out /etc/network/interfaces for static addresses (debian-9)
lineinfile: lineinfile: