#!/bin/bash -x

# May 2018: lowercase "--adminuser=admin" is still required for some odd
# reason, otherwise one cannot login to http://box.lan/moodle (with
# Admin/changeme).  At the same time --dbuser=Admin still begins with
# a capital letter, in keeping with Internet-in-a-Box's other server apps?

sudo -u {{ apache_user }} \
     /usr/bin/php {{ moodle_base }}/admin/cli/install.php \
     --wwwroot=http://{{ iiab_hostname }}.{{ iiab_domain }}/moodle \
     --dataroot={{ moodle_data }} \
     --dbtype=pgsql \
     --dbname={{ moodle_database_name }} \
     --dbuser=Admin --dbpass=changeme \
     --fullname=Your_School \
     --shortname=School \
     --adminuser=admin --adminpass=changeme \
     --non-interactive \
     --agree-license \
     --allow-unstable   # TEMPORARY DURING MAY 2018 TESTING

chown {{ apache_user }}:{{ apache_user }} {{ moodle_base }}/config.php
