summaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2016-01-13 09:57:14 +0000
committerramon <ramongomez@us.es>2016-01-13 09:57:14 +0000
commite00bb53bb5c3cf57cf67eca0993f3aa735e6d25d (patch)
treef4610223ed71c0a475ad7c5403a4d2f91a9c34d8 /installer
parente53bec2b46e66bcd150631a7f84620b08a5623f7 (diff)
#708: Mover la generación de la clave REST a la función de modificación de la BD del script de actualización.
git-svn-id: https://opengnsys.es/svn/branches/version1.1@4770 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'installer')
-rwxr-xr-xinstaller/opengnsys_update.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh
index e5938887..63a83f17 100755
--- a/installer/opengnsys_update.sh
+++ b/installer/opengnsys_update.sh
@@ -282,6 +282,7 @@ function importSqlFile()
local tmpfile=$(mktemp)
local mycnf=/tmp/.my.cnf.$$
local status
+ local APIKEY=$(php -r 'echo md5(uniqid(rand(), true));')
if [ ! -r $sqlfile ]; then
errorAndLog "${FUNCNAME}(): Unable to read $sqlfile!!"
@@ -291,7 +292,8 @@ function importSqlFile()
echoAndLog "${FUNCNAME}(): importing SQL file to ${database}..."
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
+ -e "s/DBPASSWORD/$OPENGNSYS_DB_PASSWD/g" \
+ -e "s/APIKEY/$APIKEY/g" $sqlfile > $tmpfile
# Componer fichero con credenciales de conexión.
touch $mycnf
chmod 600 $mycnf
@@ -804,7 +806,6 @@ function updateClient()
local OGVMLINUZ=$INSTALL_TARGET/tftpboot/ogclient/ogvmlinuz
local SAMBAPASS
local KERNELVERSION
- local APIKEY=$(php -r 'echo md5(uniqid(rand(), true));')
# Comprobar si debe actualizarse el cliente.
SOURCELENGTH=$(LANG=C wget --spider $SOURCEFILE 2>&1 | awk '/Length:/ {print $2}')
@@ -833,7 +834,7 @@ function updateClient()
# Actaulizar la base de datos adaptada al Kernel del cliente.
OPENGNSYS_DBUPDATEFILE="$WORKDIR/opengnsys/admin/Database/$OPENGNSYS_DATABASE-$INSTVERSION-postinst.sql"
if [ -f $OPENGNSYS_DBUPDATEFILE ]; then
- perl -pi -e "s/KERNELVERSION/$KERNELVERSION/g; s/APIKEY/$APIKEY/g" $OPENGNSYS_DBUPDATEFILE
+ perl -pi -e "s/KERNELVERSION/$KERNELVERSION/g" $OPENGNSYS_DBUPDATEFILE
importSqlFile $OPENGNSYS_DBUSER $OPENGNSYS_DBPASSWORD $OPENGNSYS_DATABASE $OPENGNSYS_DBUPDATEFILE
fi