#!/bin/sh set -e mkdir -p /var/lib/moodle mkdir -p /etc/dbconfig-common chown www-data:www-data /var/lib/moodle || true /usr/sbin/lliurex-preseed --update || true mysql_root_passwd -i if [ $? -ne 0 ] ; then echo "Mysql is not working properly" exit 1 fi resp=$(lliurex-sgbd --db_is_present lliurex-moodle) if [ "$resp" = "NO" ] ; then lliurex-sgbd --install lliurex-moodle else lliurex-sgbd --upgrade lliurex-moodle fi a2ensite moodle service apache2 reload # create file moodle in /var/lib/dnsmasq/config if [ ! -d /var/lib/dnsmasq/config ]; then mkdir -p /var/lib/dnsmasq/config fi INTERNA=$(n4d-vars getvalues INTERNAL_DOMAIN | cut -d"'" -f2) if [ -z $INTERNA ]; then echo "Error al obtener INTERNAL_DOMAIN" echo "Se deja sin configurar dnsmasq para moodle" else if [ ! -d /var/lib/dnsmasq/config ]; then mkdir -p /var/lib/dnsmasq/config fi hostname=$(hostname) echo "cname=moodle."$INTERNA",$hostname."$INTERNA > /var/lib/dnsmasq/config/moodle service dnsmasq restart 2>/dev/null|| true fi cp -f /usr/share/lliurex-moodle/etc/moodle/* /etc/moodle || true cp -f /usr/share/lliurex-moodle/etc/dbconfig-common/* /etc/dbconfig-common || true #create ldap users in moodle if [ -n $INTERNA ]; then /usr/bin/python /usr/share/lliurex-moodle/update_moodle_sql.py fi #DEBHELPER# exit 0