diff --git a/roles/9-local-addons/tasks/main.yml b/roles/9-local-addons/tasks/main.yml index 54420a743..3f79a3e89 100644 --- a/roles/9-local-addons/tasks/main.yml +++ b/roles/9-local-addons/tasks/main.yml @@ -43,6 +43,15 @@ state: present when: admin_console_install +# Taken directly from 'iiab' has builtin checking via /etc/iiab/install-flags/ so safe to rerun. Now +# 'iiab' could just reference this new file like scripts/ansible or the file can live in iiab-factory +# use stage 9 so the stanzas from 'iiab' are used on the first pass, installs that add the kalite later +# will get picked up during iiab-configure or ICO in admin-console but not preset's runroles but could +# call this script to get the job done. +- name: Install kalite support if iiab-install was completed but kalite was not installed on the first pass during 'iiab' + command scripts/kalite_support.sh + when: iiab_stage == 9 and kalite_installed is defined + - name: Recording STAGE 9 HAS COMPLETED ==================== lineinfile: path: "{{ iiab_env_file }}" diff --git a/scripts/kalite_support.sh b/scripts/kalite_support.sh new file mode 100755 index 000000000..ed74cdf3c --- /dev/null +++ b/scripts/kalite_support.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# K. KA Lite prep +if [ -d /library/ka-lite ]; then + echo -e "\n\nKA LITE REQUIRES 2 THINGS...\n" + + echo -e "Register with KA Lite - just the anonymous registration...\n" + # /usr/bin/kalite venv wrapper invokes 'export KALITE_HOME=/library/ka-lite' + if [ ! -f $FLAGDIR/kalite-zone-complete ]; then + echo -e "Now running 'kalite manage generate_zone' ...\n" + kalite manage generate_zone || true # Overrides 'set -e' + touch $FLAGDIR/kalite-zone-complete + else + echo -e "'kalite manage generate_zone' IS ALREADY COMPLETE -- per existence of:" + echo -e "$FLAGDIR/kalite-zone-complete\n" + fi + + echo -e "\nInstall KA Lite's mandatory 0.9 GB English Pack... (en.zip)\n" + if [ ! -f $FLAGDIR/kalite-en.zip-complete ]; then + #echo -e 'Now retrieving it...\n' + cd /tmp + if [ -f en.zip ]; then + if [ $(wc -c < en.zip) -ne 929916955 ]; then + echo -e "\nERROR: /tmp/en.zip must be 929,916,955 bytes to proceed.\n" >&2 + exit 1 + else + echo -e "\nUsing existing /tmp/en.zip whose 929,916,955 byte size is correct!\n" + fi + else + wget http://pantry.learningequality.org/downloads/ka-lite/0.17/content/contentpacks/en.zip + fi + echo -e 'Now installing /tmp/en.zip into /library/ka-lite/content/*\n' + kalite manage retrievecontentpack local en en.zip + touch $FLAGDIR/kalite-en.zip-complete + fi +fi +# WARNING: /tmp/en.zip (and all stuff in /tmp) is auto-deleted during reboots +# NEW WAY ABOVE - since 2018-07-03 - installs KA Lite's mandatory English Pack +# +# kalite manage retrievecontentpack download en +# OLD WAY ABOVE - fails w/ sev ISPs per https://github.com/iiab/iiab/issues/871