Ignore:
Timestamp:
Jun 5, 2018, 1:07:05 PM (17 months ago)
Author:
jrpelegrina
Message:

Deleted files for the zenity version of the zomando

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zero-lliurex-installers/trunk/fuentes/zero-lliurex-moodle.zmds/zero-lliurex-moodle.zmd

    r4999 r7353  
    11#!/bin/bash
    22
    3 zero-center add-pulsating-color zero-lliurex-moodle
    4 
    5 export TEXTDOMAIN="zero-lliurex-moodle"
    6 MSG_INSTALLING_PROGRESS=$(gettext "Configurator Service for Moodle in LliureX")
    7 MSG_ADVERTISEMENT=$(gettext "Do you want install and configure Moodle for LliureX?")
    8 MSG_ZENITY_MOODLE_1=$(gettext "Testing Mysql....")
    9 MSG_MOODLE_MYSQL_PROBLEM=$(gettext "Mysql is not working properly")
    10 MSG_ZENITY_MOODLE_2=$(gettext "Creating a token....")
    11 MSG_MOODLE_AVISO=$(gettext "Activating new token")
    12 MSG_ZENITY_MOODLE_3=$(gettext "Linking Apache with Moodle....")
    13 MSG_ZENITY_MOODLE_4=$(gettext "Configuring DNS mask for Moodle in LliureX....")
    14 MSG_ZENITY_MOODLE_5=$(gettext "Linking LDAP with Moodle....")
    15 MSG_ZENITY_MOODLE_6=$(gettext "Restarting services to apply new configurations....")
    16 MSG_ZENITY_MOODLE_7=$(gettext "Configuring installed languages in Moodle....")
    17 MSG_MOODLE_INSTALLED=$(gettext "Moodle has been installed in your system. You can check it with firefox in this URL http://moodle")
    18 MSG_MOODLE_INSTALL_PROBLEM=$(gettext "Moodle has NOT been installed in your system. Please check the logs.")
    19 
    20 HELP_PROGRESS_BAR="/tmp/help_moodle_install.txt"
    21 
    22 if zenity --question --title="$MSG_INSTALLING_PROGRESS" --width=500 --height=100 --text="$MSG_ADVERTISEMENT"; then
    23         touch $HELP_PROGRESS_BAR
    24 else
    25         zero-center remove-pulsating-color zero-lliurex-moodle
    26         exit 1
    27 fi
    28 
    29 #zero-installer  install lliurex-preseed-moodle
    30 
    31 if [ ! -d "/etc/dbconfig-common" ]; then
    32      mkdir -p /etc/dbconfig-common   
    33 fi
    34 
    35 #init DB
    36 #/usr/sbin/lliurex-preseed --update || true
    37 
    38 zero-installer -l /usr/share/zero-lliurex-installers/zero-lliurex-moodle-packages
    39 
    40 if [ $? -ne 0 ]
    41 then
    42         echo "$MSG_MOODLE_INSTALL_PROBLEM"
    43         zenity --info --text="$MSG_MOODLE_INSTALL_PROBLEM" &
    44         rm $HELP_PROGRESS_BAR
    45         zero-center set-non-configured zero-lliurex-moodle
    46         zero-center remove-pulsating-color zero-lliurex-moodle
    47         exit 1
    48 fi
    49 ##if [ ! -d "/var/lib/moodle" ]; then
    50 ##      mkdir -p /var/lib/moodle
    51 ##      chown www-data:www-data /var/lib/moodle || true
    52 ##fi
    53 
    54 # Testing it MySQL is alive and the root passwd is available
    55 # "sudo" is mandatory here, I don't understand the correct reason...
    56 # if you are reading this comment, and know the answer...please contact with us
    57 #
    58 ##sudo mysql_root_passwd -i
    59 
    60 ##if [ $? -ne 0 ] ; then
    61 ##      echo "Mysql is not working properly"
    62 ##      exit 1
    63 ##fi
    64 
    65 
    66 # Since the 0.61 version, which is required by lliurex-pmb the lliurex-sgbd utility uses
    67 # a simple mechanism to create a token in /tmp/db_is_present , a more useful mechanism that "NO"
    68 # at STDOUT. 
    69 ##lliurex-sgbd --db_is_present lliurex-moodle
    70 ##if [ -f /tmp/db_is_present ]; then
    71 ##      lliurex-sgbd --install lliurex-moodle
    72 ##else
    73 ##      zenity --info --text="$MSG_AVISO"
    74 ##      lliurex-sgbd --upgrade lliurex-moodle
    75 ##fi
    76 
    77 
    78 ##if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
    79 
    80 ##      . /usr/share/apache2/apache2-maintscript-helper
    81 ##      apache2_invoke ensite moodle
    82 
    83 ##fi
    84 
    85 # create file moodle in /var/lib/dnsmasq/config
    86 ##if [ ! -d /var/lib/dnsmasq/config ]; then
    87 ##      mkdir -p /var/lib/dnsmasq/config
    88 ##fi
    89 
    90 ##INTERNA=$(n4d-vars getvalues INTERNAL_DOMAIN | cut -d"'" -f2)
    91 ##if [ -z $INTERNA ]; then
    92 ##      echo "Error al obtener INTERNAL_DOMAIN"
    93 ##      echo "Se deja sin configurar dnsmasq para moodle"
    94 ##else
    95 ##      if [ ! -d /var/lib/dnsmasq/config ]; then
    96 ##              mkdir -p /var/lib/dnsmasq/config
    97 ##      fi
    98 ##      hostname=$(hostname)
    99 ##      echo "cname=moodle."$INTERNA",$hostname."$INTERNA > /var/lib/dnsmasq/config/moodle
    100        
    101 ##fi
    102 
    103 #create ldap users in moodle
    104 ##if [ -n $INTERNA ]; then
    105 ##      /usr/bin/python /usr/share/lliurex-moodle/update_moodle_sql.py
    106 ##fi
    107 
    108 ##a2ensite moodle || true
    109 
    110 ##service apache2 restart || true
    111 
    112 ##service dnsmasq restart || true
    113 
    114 
    115 #######MAIN PROGRAM##########
    116 
    117 ( tail -f $HELP_PROGRESS_BAR
    118 ) |
    119 zenity --progress \
    120   --title="ZERO-MOODLE" \
    121   --text="$MSG_INSTALLING_PROGRESS" \
    122   --percentage=0 \
    123   --auto-close \
    124    --width=500 \
    125   --auto-kill &
    126  
    127 
    128  
    129 if [ ! -d "/var/lib/moodle" ]; then
    130         mkdir -p /var/lib/moodle
    131         chown www-data:www-data /var/lib/moodle || true
    132 fi
    133 sleep 2
    134 echo "10" >> $HELP_PROGRESS_BAR
    135 echo "# $MSG_ZENITY_MOODLE_1"   >> $HELP_PROGRESS_BAR
    136 # Testing it MySQL is alive and the root passwd is available
    137 # "sudo" is mandatory here, I don't understand the correct reason...
    138 # if you are reading this comment, and know the answer...please contact with us
    139 #
    140 sudo mysql_root_passwd -i
    141 
    142 if [ $? -ne 0 ] ; then
    143         echo "$MSG_MYSQL_PROBLEM"
    144         zenity --info --text="$MSG_MOODLE_MYSQL_PROBLEM" &
    145         rm $HELP_PROGRESS_BAR
    146         zero-center set-non-configured zero-lliurex-moodle   
    147         zero-center remove-pulsating-color zero-lliurex-moodle
    148         exit 1
    149 fi
    150 echo "20" >> $HELP_PROGRESS_BAR
    151 echo "# $MSG_ZENITY_MOODLE_2"  >> $HELP_PROGRESS_BAR
    152 # Since the 0.61 version, which is required by lliurex-pmb the lliurex-sgbd utility uses
    153 # a simple mechanism to create a token in /tmp/db_is_present , a more useful mechanism that "NO"
    154 # at STDOUT. 
    155 lliurex-sgbd --db_is_present lliurex-moodle
    156 if [ ! -f /tmp/db_is_present ]; then
    157         lliurex-sgbd --install lliurex-moodle
    158 else
    159         #zenity --info --text="$MSG_MOODLE_AVISO" &
    160         lliurex-sgbd --upgrade lliurex-moodle
    161 fi
    162 
    163 echo "25" >> $HELP_PROGRESS_BAR
    164 echo "# $MSG_ZENITY_MOODLE_7"  >> $HELP_PROGRESS_BAR
    165 #Copy lang files in var/lib/moodle
    166 if [ -d "/var/lib/moodle" ]; then
    167         if [ -d "/usr/share/lliurex-moodle/lang" ]; then
    168                 cp -r /usr/share/lliurex-moodle/lang /var/lib/moodle/
    169                 chown -R www-data:www-data /var/lib/moodle/lang || true
    170         fi
    171 fi             
    172 
    173 #Configuring Apache
    174 echo "30" >> $HELP_PROGRESS_BAR
    175 echo "# $MSG_ZENITY_MOODLE_3" >> $HELP_PROGRESS_BAR
    176 #if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
    177 #       . /usr/share/apache2/apache2-maintscript-helper
    178 #       apache2_invoke ensite moodle
    179 #fi
    180 #maintainer script substitution to userland script
    181 a2ensite moodle
    182 
    183 echo "50" >> $HELP_PROGRESS_BAR
    184 echo "# $MSG_ZENITY_MOODLE_4" >> $HELP_PROGRESS_BAR
    185 # create file moodle in /var/lib/dnsmasq/config
    186 # if [ ! -d /var/lib/dnsmasq/config ]; then
    187 #       mkdir -p /var/lib/dnsmasq/config
    188 # fi
    189 # INTERNA=$(n4d-vars getvalues INTERNAL_DOMAIN | cut -d"'" -f2)
    190 # if [ -z $INTERNA ]; then
    191 #       echo "Error getting INTERNAL_DOMAIN"
    192 #       echo "It's left to set dnsmasq for moodle"
    193 # else
    194         # if [ ! -d /var/lib/dnsmasq/config ]; then
    195         #       mkdir -p /var/lib/dnsmasq/config
    196         # fi
    197         # hostname=$(hostname)
    198         #echo "cname=moodle."$INTERNA",$hostname."$INTERNA > /var/lib/dnsmasq/config/moodle
    199 MAGIC_KEY=$(cat /etc/n4d/key)
    200 n4d-client -h localhost -k $MAGIC_KEY -m set_internal_dns_entry -c Dnsmasq -a moodle
    201        
    202 #fi
    203 echo "70"  >> $HELP_PROGRESS_BAR
    204 echo "# $MSG_ZENITY_MOODLE_5"  >> $HELP_PROGRESS_BAR
    205 #create ldap users in moodle
    206 if [ -n $INTERNA ]; then
    207         /usr/bin/python /usr/share/lliurex-moodle/update_moodle_sql.py
    208         /usr/bin/python /usr/share/lliurex-moodle/sync_ldap_users.py
    209 fi
    210 echo "85"  >> $HELP_PROGRESS_BAR
    211 echo "# $MSG_ZENITY_MOODLE_6"  >> $HELP_PROGRESS_BAR
    212 
    213 a2ensite moodle || true
    214 
    215 service apache2 restart || true
    216 
    217 service dnsmasq restart || true
    218 
    219 #change permissions in /var/lib/moodle
    220 
    221 if [ -d "/var/lib/moodle" ]; then
    222                 chown -R www-data:www-data /var/lib/moodle || true
    223 
    224 fi     
    225 
    226 echo "100"  >> $HELP_PROGRESS_BAR
    227 
    228 
    229 zenity --info --title="ZERO-MOODLE" --text="$MSG_MOODLE_INSTALLED" &
    230 
    231 #su $USER firefox http://moodle/ || true
    232 rm $HELP_PROGRESS_BAR
    233 #Kill tail -f process
    234 kill -9 $(ps axf | grep tail | grep $HELP_PROGRESS_BAR | awk '{print $1}')
    235 zero-center set-configured zero-lliurex-moodle   
    236 zero-center remove-pulsating-color zero-lliurex-moodle
    237 
    238 exit 0
     3epi-gtk /usr/share/zero-lliurex-moodle/lliurex-moodle.epi
Note: See TracChangeset for help on using the changeset viewer.