summaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
authorIrina Gómez <irinagomez@us.es>2020-05-19 14:36:41 +0200
committerIrina Gómez <irinagomez@us.es>2020-05-19 14:36:41 +0200
commita0868b7012b2a8aba33b34b0cf08741ea2b97725 (patch)
treecbfeb5f8657463407a12f7832ec20b47feea27f9 /installer
parent64af0699ffe2d91a559946610303d800ddae6afb (diff)
#954 opengnsys_import.sh: Fix error when options --exclude-logs or --exclude-users are used
Diffstat (limited to 'installer')
-rwxr-xr-xinstaller/opengnsys_import.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/installer/opengnsys_import.sh b/installer/opengnsys_import.sh
index 9b5a2b00..7dcaad3f 100755
--- a/installer/opengnsys_import.sh
+++ b/installer/opengnsys_import.sh
@@ -296,7 +296,7 @@ if [ "$CHECK" ]; then
fi
# Parámetros especiales de restauración.
-[ "$NOLOGS" ] && TARPARMS="--exclude=$PREFIX/log/"
+[ "$NOLOGS" ] && TARPARAMS="--exclude=$PREFIX/log"
# Descomprimimos backup
tar -xvzf $BACKUPFILE --directory /tmp $TARPARAMS &>/dev/null
@@ -354,11 +354,13 @@ fi
# definimos valores adecuados por defecto.
# Excluding repository table import, if needed.
[ "$NOREPOS" ] && sed -i -e '/Table structure.* `repositorios`/,/Table structure/d' $MYSQLFILE
-[ "$NOUSERS" ] && sed -i -e '/Table structure.*`usuarios`/,/CHARSET/d' \
- -e '/usuarios/s/IGNORE//g' \
- -e '/usuarios/s/^INSERT /\nALTER TABLE usuarios ADD UNIQUE (usuario);\n\nINSERT IGNORE /g' \
+[ "$NOUSERS" ] && sed -i -e '/INSERT INTO `usuarios`/s/^/\/*/' \
+ -e '/INSERT INTO `usuarios`/s/$/*\//' \
$MYSQLFILE
sed -i -e '/Table structure.* `entornos`/,/Table structure/d' \
+ -e '/Table structure.*`usuarios`/,/CHARSET/d' \
+ -e '/usuarios/s/IGNORE//g' \
+ -e '/usuarios/s/^INSERT /\nALTER TABLE usuarios ADD UNIQUE (usuario);\n\nINSERT IGNORE /g' \
-e "s/\(DEFINER=\`\)[^\`]*\(\`.* TRIGGER\)/\1$USUARIO\2/" \
-e "s/\(\` [a-z]*int([0-9]*) NOT NULL\),/\1 DEFAULT 0,/" \
-e "s/\(\` [a-z]*char([0-9]*) NOT NULL\),/\1 DEFAULT '',/" \