#!/bin/bash #=============================================================================== # # FILE: 060_moodle # FORMAT: orderofexecution_scriptid # # USAGE: ./moodle # # DESCRIPTION: Postconfiguration of moodle # # OPTIONS: message - Returns the message for LliureX Server Express # tests - Make the tests if this message will be shown. # values: 1 -> No # 0 -> Yes # exec - Runs the main functionality of this script # prereqs - Test if the prerequisites are configured # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Fco Javier Lopez Perez lopez_frajav@gva.es # COMPANY: LliureX # VERSION: 1.0 # CREATED: 12/10/08 21:20:00 CEST # REVISION: --- #=============================================================================== # aux vars SCRIP_DIR=/usr/share/lliurex-srv-common/scripts ######################################## LIB_FILE="/usr/share/lliurex/lliurex-srv-common/server-express-common.sh" [ -r "$LIB_FILE" ] || exit 1 . $LIB_FILE # gettext hacks TEXTDOMAIN="llxcfg-moodle" export TEXTDOMAIN [ -z "$LANG" ] || LANGUAGE="${LANG}:${LANGUAGE}" # some vars # Change here title of the window MSG_TITLE="$(gettext "Prepare Moodle")" MSG_TEXT_POSTCONF1="$(gettext "Postconfigured")" MSG_TEXT_POSTCONF2="$(gettext "Not Postconfigured")" MSG_DATABASE_ERROR="$(gettext "Moodle database cannot be created")" MSG_MOODLE_QUESTION="$(gettext "Moodle seems to be postconfigured. Do you want to postconfigure moodle again?")" MSG_POSTCONF_ERROR="$(gettext "Error postconfiguring Moodle")" # Returns the message shown in lliurex-server-express message() { echo "$MSG_TITLE" return 0 } serv-stat(){ rc=0 tests || rc=$? if [ $rc -ne 0 ] ; then echo "$MSG_TEXT_POSTCONF2" else echo "${MSG_TEXT_POSTCONF1}" fi } # Show if is possibly/necessary to use this script ;) tests() { # Add here the tests. # Test error must be added rc=0 mysql_moodle check_tables || rc=$? return $rc } # Runs the main functionality of this script run_script() { llxcfg-init-moodle return 0 } # Test if the prerequisites are configured prereqs() { # Fill the array with the prerequisites (id) #declare -a DEPS #DEPS="codigo-centro" #check_prereq $DEPS || return 1 return 0 } # ===== Main ===== id=$(id -u) if [ $id -ne 0 ]; then error_msg "$(gettext "You must be root")" exit 1 fi # Test if the parameter count (1) is correct [ $# -ne 1 ] && die "$(gettext "Incorrect parameters count")" PARAM="$1" case $PARAM in message) message ;; tests) tests ;; exec) run_script ;; prereqs) prereqs ;; status) serv-stat ;; id) show_scr_id ;; *) die "$(gettext "ERROR: Wrong parameter $PARAM")" ;; esac