Changeset 5237


Ignore:
Timestamp:
Jun 20, 2017, 6:01:55 PM (18 months ago)
Author:
jrpelegrina
Message:

Fix pmb and moodle db user when backup is restored

Location:
lliurex-sgdb/trunk/fuentes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lliurex-sgdb/trunk/fuentes/debian/changelog

    r3818 r5237  
     1lliurex-sgbd (0.74-lliurex3) xenial; urgency=medium
     2
     3  * Fixed pmb and moodle db user pasword when a backup is restored
     4
     5 -- Juan Ramon Pelegrina <juapesai@hotmail.com>  Tue, 20 Jun 2017 17:45:32 +0200
     6
    17lliurex-sgbd (0.74-lliurex2) xenial; urgency=medium
    28
  • lliurex-sgdb/trunk/fuentes/install/usr/sbin/lliurex-sgbd

    r3811 r5237  
    6363}
    6464
     65read_include_file(){
     66
     67        if [ -e "/etc/"$DB_NAME"/"$INCLUDE_DB_FILE ]; then
     68               
     69                DB_USER_PASS=$(cat "/etc/"$DB_NAME"/"$INCLUDE_DB_FILE |perl -nE "say for /dbpass=\'(.*)\';/")
     70               
     71        fi
     72}
     73
    6574inject_sql_file(){
    6675        cat $1 | mysql -u root -p$MYSQL_ROOT_PASS $DB_NAME
     
    114123        if mysql_version_upper; then
    115124            #sqlQuery="UPDATE mysql.user SET authentication_string=PASSWORD('$passwd'),plugin='mysql_native_password',password_expired='N' WHERE User='root'; "
    116             sqlQuery="UPDATE mysql.user SET authentication_string=PASSWORD('$DB_USER_PASS'),plugin='mysql_native_password',password_expired='N' WHERE User='$DB_USER'; "
    117         else
     125            #sqlQuery="UPDATE mysql.user SET authentication_string=PASSWORD('$DB_USER_PASS'),plugin='mysql_native_password',password_expired='N' WHERE User='$DB_USER'; "
     126            sqlQuery="UPDATE mysql.user SET authentication_string=PASSWORD('$DB_USER_PASS'),plugin='mysql_native_password' WHERE User='$DB_USER'; "
     127
     128       
     129        else
    118130#            sqlQuery="UPDATE mysql.user SET Password=PASSWORD('$passwd') WHERE User='root'; "
    119131            sqlQuery="UPDATE mysql.user SET Password=PASSWORD('$DB_USER_PASS') WHERE User='$DB_USER'; "
     
    213225                DB_NAME=$PACKAGE_NAME
    214226        fi
     227        read_include_file
    215228        #old method: TEST=$(mysqlshow -u root -p$MYSQL_ROOT_PASS | grep " "$DB_NAME" " | wc -l)
    216229        #new method
     
    319332                if [ $TEST -ne 0 ] ; then
    320333                        # Existe la base de datos. Hacer copia base de datos"
     334                        update_passwd
    321335                        database_backup
    322336                fi
Note: See TracChangeset for help on using the changeset viewer.