diff options
author | ramon <ramongomez@us.es> | 2010-11-15 19:49:19 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2010-11-15 19:49:19 +0000 |
commit | c4321ae190194dd7dd7161dd9db190fa785c0c9e (patch) | |
tree | 436a19bc52498115aaa9285cd6cdfd3a0e4adb44 /installer | |
parent | 4a3cd1fc90eac990d8b151ab0452bf22fd2bc123 (diff) |
Instalador parchea el fichero de volcado SQL modificando el acceso por defecto del usuario súper-administrador.
git-svn-id: https://opengnsys.es/svn/trunk@1347 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'installer')
-rwxr-xr-x | installer/opengnsys_installer.sh | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index 02d74d56..5319baf6 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -352,9 +352,11 @@ function mysqlImportSqlFileToDb() exit 1 fi - local root_password="${1}" - local database=$2 - local sqlfile=$3 + local root_password="$1" + local database="$2" + local sqlfile="$3" + local tmpfile=$(mktemp) + local status if [ ! -f $sqlfile ]; then errorAndLog "${FUNCNAME}(): Unable to locate $sqlfile!!" @@ -362,9 +364,13 @@ function mysqlImportSqlFileToDb() fi echoAndLog "${FUNCNAME}(): importing sql file to ${database}..." - perl -pi -e "s/SERVERIP/$SERVERIP/g" $sqlfile - mysql -uroot -p"${root_password}" --default-character-set=utf8 "${database}" < $sqlfile - if [ $? -ne 0 ]; then + chmod 600 $tmpfile + sed -e "s/SERVERIP/$SERVERIP/g" -e "s/DBUSER/$OPENGNSYS_DB_USER/g" \ + -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" $sqlfile > $tmpfile + mysql -uroot -p"${root_password}" --default-character-set=utf8 "${database}" < $tmpfile + status=$? + rm -f $tmpfile + if [ $status -ne 0 ]; then errorAndLog "${FUNCNAME}(): error while importing $sqlfile in database $database" return 1 fi |