[moodle] Reduce unnecessary diff against upstream

mejoras_instalacion
Evilham 2022-09-22 15:38:09 +02:00
parent 3ae974432a
commit ede83e1514
No known key found for this signature in database
GPG Key ID: AE3EE30D970886BF
2 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,10 @@
#!/bin/sh #!/bin/sh
#
# Moodle configuration script
#
set -eo pipefail set -eo pipefail
# Check that the database is available
echo "Waiting for $database:$port to be ready" echo "Waiting for $database:$port to be ready"
while ! nc -w 1 $DB_HOST $DB_PORT; do while ! nc -w 1 $DB_HOST $DB_PORT; do
# Show some progress # Show some progress
@ -8,10 +12,13 @@ while ! nc -w 1 $DB_HOST $DB_PORT; do
sleep 1; sleep 1;
done done
echo "$database is ready" echo "$database is ready"
# Give it another 3 seconds.
sleep 3; sleep 3;
if [ ! -f /var/www/html/config.php ]; then
# Check if the config.php file exists
if [ ! -f /var/www/html/config.php ]; then
# TODO: Why is this image even using the src/rootfs dir? Just for cron?
curl --location https://github.com/moodle/moodle/archive/$MOODLE_VERSION.tar.gz | tar xz --strip-components=1 -C /var/www/html/ curl --location https://github.com/moodle/moodle/archive/$MOODLE_VERSION.tar.gz | tar xz --strip-components=1 -C /var/www/html/
cp /isinstalled.php /var/www/html/admin/cli/ cp /isinstalled.php /var/www/html/admin/cli/
chown nobody:root /var/www/html -R chown nobody:root /var/www/html -R
@ -43,6 +50,7 @@ if [ ! -f /var/www/html/config.php ]; then
fi fi
# Check if the database is already installed
if php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/isinstalled.php ; then if php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/isinstalled.php ; then
echo "Installing database..." echo "Installing database..."
@ -56,8 +64,13 @@ if php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/isinstalled.php
--agree-license --agree-license
echo "Configuring settings..." echo "Configuring settings..."
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=slasharguments --set=0
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtophp --set=/usr/bin/php php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtophp --set=/usr/bin/php
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtodu --set=/usr/bin/du php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtodu --set=/usr/bin/du
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=aspellpath --set=/usr/bin/aspell
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtodot --set=/usr/bin/dot
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtogs --set=/usr/bin/gs
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtopython --set=/usr/bin/python3
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=enableblogs --set=0 php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=enableblogs --set=0
@ -67,10 +80,14 @@ if php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/isinstalled.php
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=smtpsecure --set=$SMTP_PROTOCOL php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=smtpsecure --set=$SMTP_PROTOCOL
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=noreplyaddress --set=$MOODLE_MAIL_NOREPLY_ADDRESS php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=noreplyaddress --set=$MOODLE_MAIL_NOREPLY_ADDRESS
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=emailsubjectprefix --set=$MOODLE_MAIL_PREFIX php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=emailsubjectprefix --set=$MOODLE_MAIL_PREFIX
elif false; then
echo "Upgrading moodle..."
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/maintenance.php --enable
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/upgrade.php --non-interactive --allow-unstable
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/maintenance.php --disable
fi fi
chown -R nobody:root /var/www/html

View File

@ -2,6 +2,7 @@
# Check exclusively whether moodle has been installed and the web service is up # Check exclusively whether moodle has been installed and the web service is up
if test -f /var/www/html/admin/cli/isinstalled.php && \ if test -f /var/www/html/admin/cli/isinstalled.php && \
test -f /var/www/html/config.php && \
! php -d max_input_vars=$max_input_vars \ ! php -d max_input_vars=$max_input_vars \
/var/www/html/admin/cli/isinstalled.php 2>&1 > /dev/null && \ /var/www/html/admin/cli/isinstalled.php 2>&1 > /dev/null && \
curl -s --output /dev/null localhost:8080; then curl -s --output /dev/null localhost:8080; then