aboutsummaryrefslogtreecommitdiffstats
path: root/mayor/update/processUpdateScripts.sh.mod.txt
diff options
context:
space:
mode:
Diffstat (limited to 'mayor/update/processUpdateScripts.sh.mod.txt')
-rw-r--r--mayor/update/processUpdateScripts.sh.mod.txt188
1 files changed, 188 insertions, 0 deletions
diff --git a/mayor/update/processUpdateScripts.sh.mod.txt b/mayor/update/processUpdateScripts.sh.mod.txt
new file mode 100644
index 00000000..71c6b730
--- /dev/null
+++ b/mayor/update/processUpdateScripts.sh.mod.txt
@@ -0,0 +1,188 @@
+--- processUpdateScripts.sh 2016-03-04 13:44:39.000000000 +0100
++++ processUpdateScripts.sh.txt 2018-03-03 19:41:10.453438603 +0100
+@@ -6,22 +6,31 @@
+ echo -e "[mysqld]
+ character-set-server = utf8
+ collation-server = utf8_hungarian_ci
+-skip-character-set-client-handshake
+ [client]
++default-character-set=utf8
+ host=$MYSQL_HOST
+ user=$MYSQL_USER
+ password=$MYSQL_PW
+ " > $BASEDIR/config/my.cnf
++
++PRECHARSET="SET character_set_client = utf8;
++SET character_set_database = utf8;
++SET character_set_server = utf8;
++SET character_set_results = utf8;
++SET collation_connection = utf8_hungarian_ci;
++SET collation_database = utf8_general_ci;
++SET collation_server = utf8_general_ci; " ## fontos, hogy a ";" ott legyen a végén!!
++
+ MYSQL_CONFIG="--defaults-extra-file=$BASEDIR/config/my.cnf"
+ MYSQL_PARAMETERS=""
+-TEST=`$MYSQL -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PW -e exit 2>&1 >/dev/null`
++TEST=$($MYSQL -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PW -e exit 2>&1 >/dev/null)
+ if [ $? == "0" ]; then
+ echo "SQL-connect test #2 OK"
+ MYSQL_PARAMETERS="-h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PW"
+ else
+ echo "Hibás SQL csatlakozás(2)"
+ fi
+-TEST=`$MYSQL $MYSQL_CONFIG -e exit 2>&1 >/dev/null`
++TEST=$($MYSQL $MYSQL_CONFIG -e exit 2>&1 >/dev/null)
+ if [ $? == "0" ]; then
+ echo "SQL-connect test #1 OK"
+ MYSQL_PARAMETERS=$MYSQL_CONFIG
+@@ -31,8 +40,12 @@
+ echo "Karakterkódolás ellenőrzése"
+ echo "SHOW VARIABLES LIKE 'character%';" | $MYSQL $MYSQL_PARAMETERS
+ # patch by Acsai Gabor <acsi@c3.hu> - FreeBSD
+-TEST=`echo "SHOW VARIABLES LIKE 'character_set_client'" | $MYSQL $MYSQL_PARAMETERS | grep utf8 | wc -l | tr -d " "`
+-if [ "x${TEST}" == "x1" ]; then
++# Kiegészítve: Miklós Gergő <gergo@bmrg.hu> - Baár-Madas
++# gondolatmenet:
++# A "default-character-set" beállítása után a "character_set_client" változóból 1db kell legyen, és értéke pontosan "utf8" kell legyen!
++### TEST=`echo "SHOW VARIABLES LIKE 'character_set_client'" | $MYSQL $MYSQL_PARAMETERS | grep utf8 | wc -l | tr -d " "`
++TEST=$(echo "SHOW VARIABLES LIKE '%character_set_client%'" | $MYSQL $MYSQL_PARAMETERS | tail -n+2 | cut -f 2)
++if [ "$TEST" == "utf8" ]; then
+ echo "SQL-UTF8 test OK"
+ else
+ echo -e "\n\nERROR: Hibás - nem utf8 - MySQL kliens karakterkódolás!\n"
+@@ -42,7 +55,7 @@
+ # --
+
+ run_script() {
+- FILEELEJE=`echo $FILE | cut -f 1 -d '-'`
++ FILEELEJE=$(echo $FILE | cut -f 1 -d '-')
+ FILEREV=${FILEELEJE: -6}
+ LOGSQL=""
+ if [ "$FILEREV" != "" ]; then
+@@ -51,14 +64,14 @@
+ fi
+ fi
+ if [ ! "${FILEREV}" \< "${REVSTR}" ]; then
+- FILEEXT=`echo $FILE | cut -f 2 -d '.'`
++ FILEEXT=$(echo $FILE | cut -f 2 -d '.')
+ if [ "$FILEEXT" == "sh" ]; then
+ echo " - Szkript futtatása ($FILE)..."
+ . $FILE
+ if [ $? != 0 ]; then exit 13; fi
+ elif [ "$FILEEXT" == "sql" ]; then
+ echo " - SQL utasítások végrehajtása ($FILE)..."
+- FILEDB=`echo $FILE | cut -f 1 -d '.' | cut -f 3 -d '-'`
++ FILEDB=$(echo $FILE | cut -f 1 -d '.' | cut -f 3 -d '-')
+ case "$FILEDB" in
+ naplo)
+ DBS=$DB_NAPLO
+@@ -78,7 +91,7 @@
+
+ if [ "$FILEREV" != "" ]; then
+ if [ "$FILEREV" -gt 3399 ]; then
+- TEST=`echo "SELECT count(*) as db FROM information_schema.TABLES WHERE TABLE_SCHEMA='${DB}' and TABLE_NAME='mayorUpdateLog'" | $MYSQL $MYSQL_PARAMETERS $DB | grep -v "db"`
++ TEST=$((echo $PRECHARSET && echo "SELECT count(*) as db FROM information_schema.TABLES WHERE TABLE_SCHEMA='${DB}' and TABLE_NAME='mayorUpdateLog'") | $MYSQL $MYSQL_PARAMETERS $DB | grep -v "db")
+ if [ "$TEST" == "0" ]; then
+ echo " Hiányzik a mayorUpdateLog tábla... tovább..."
+ continue
+@@ -88,21 +101,21 @@
+
+ case "$FILEDB" in
+ naplo)
+- INTEZMENYDB=`echo $DB | sed -e 's/\(naplo_\)\(.*\)\(_.*\)/intezmeny_\2/'`
+- INTEZMENYROVIDNEV=`echo $DB | cut -f 2 -d '_'`
+- TANEV=`echo $DB | cut -f 3 -d '_'`
+- (cat $FILE && echo "${LOGSQL}") | sed -e "s/%INTEZMENYDB%/$INTEZMENYDB/g" | sed -e "s/%INTEZMENY%/$INTEZMENYROVIDNEV/g" | \
++ INTEZMENYDB=$(echo $DB | sed -e 's/\(naplo_\)\(.*\)\(_.*\)/intezmeny_\2/')
++ INTEZMENYROVIDNEV=$(echo $DB | cut -f 2 -d '_')
++ TANEV=$(echo $DB | cut -f 3 -d '_')
++ (echo $PRECHARSET && cat $FILE && echo "${LOGSQL}") | sed -e "s/%INTEZMENYDB%/$INTEZMENYDB/g" | sed -e "s/%INTEZMENY%/$INTEZMENYROVIDNEV/g" | \
+ sed -e "s/%TANEV%/$TANEV/g" | $MYSQL $MYSQL_PARAMETERS $DB
+ ;;
+ auth)
+- (cat $FILE && echo "${LOGSQL}") | sed -e "s/%MYSQL_ENCODE_STR%/$MYSQL_ENCODE_STR/g" | $MYSQL $MYSQL_PARAMETERS $DB
++ (echo $PRECHARSET && cat $FILE && echo "${LOGSQL}") | sed -e "s/%MYSQL_ENCODE_STR%/$MYSQL_ENCODE_STR/g" | $MYSQL $MYSQL_PARAMETERS $DB
+ ;;
+ intezmeny)
+- INTEZMENYROVIDNEV=`echo $DB | cut -f 2 -d '_'`
+- (cat $FILE && echo "${LOGSQL}") | sed -e "s/%INTEZMENY%/$INTEZMENYROVIDNEV/g" | $MYSQL $MYSQL_PARAMETERS $DB
++ INTEZMENYROVIDNEV=$(echo $DB | cut -f 2 -d '_')
++ (echo $PRECHARSET && cat $FILE && echo "${LOGSQL}") | sed -e "s/%INTEZMENY%/$INTEZMENYROVIDNEV/g" | $MYSQL $MYSQL_PARAMETERS $DB
+ ;;
+ *)
+- (cat $FILE && echo "${LOGSQL}") | $MYSQL $MYSQL_PARAMETERS $DB
++ (echo $PRECHARSET && cat $FILE && echo "${LOGSQL}") | $MYSQL $MYSQL_PARAMETERS $DB
+ ;;
+ esac
+ if [ $? != 0 ]; then
+@@ -116,8 +129,8 @@
+
+ echo " Az új változat verziószáma: $UJ_REV"
+
+-REVSTR=`printf "%06d" $REV`
+-MYSQL_ENCODE_STR=`grep _MYSQL_ENCODE_STR $BASEDIR/config/main-config.php | sed -e "s/define('_MYSQL_ENCODE_STR','\(.*\)');/\\1/"`
++REVSTR=$(printf "%06d" $REV)
++MYSQL_ENCODE_STR=$(grep _MYSQL_ENCODE_STR $BASEDIR/config/main-config.php | sed -e "s/define('_MYSQL_ENCODE_STR','\(.*\)');/\\1/")
+
+ # mysql host beállítása
+ if [ "$MYSQL_HOST" == "" ]; then
+@@ -129,9 +142,9 @@
+ echo -e "\n * Adatbázisok lekérdezése..."
+ if [ -f $MYSQL ]
+ then
+- DB_MAYOR=`$MYSQL $MYSQL_PARAMETERS -e"SHOW DATABASES LIKE 'mayor\_%'" | grep -e '^mayor\_[^_]*$'`
+- DB_NAPLO=`$MYSQL $MYSQL_PARAMETERS -e"SHOW DATABASES LIKE 'naplo\_%\_%'" | grep -e '^naplo\_[^\_]*\_20[0-9][0-9]$'`
+- DB_INTEZMENY=`$MYSQL $MYSQL_PARAMETERS -e"SELECT CONCAT('intezmeny_',rovidNev) FROM mayor_naplo.intezmeny" | grep -e '^intezmeny\_[^\_]*$'`
++ DB_MAYOR=$($MYSQL $MYSQL_PARAMETERS -e"$PRECHARSET SHOW DATABASES LIKE 'mayor\_%'" | grep -e '^mayor\_[^_]*$') ## ide elvileg nem kellene precharset, mert itt minden ASCCI/2
++ DB_NAPLO=$($MYSQL $MYSQL_PARAMETERS -e"$PRECHARSET SHOW DATABASES LIKE 'naplo\_%\_%'" | grep -e '^naplo\_[^\_]*\_20[0-9][0-9]$')
++ DB_INTEZMENY=$($MYSQL $MYSQL_PARAMETERS -e"$PRECHARSET SELECT CONCAT('intezmeny_',rovidNev) FROM mayor_naplo.intezmeny" | grep -e '^intezmeny\_[^\_]*$')
+ # DB_INTEZMENY=`$MYSQL $MYSQL_PARAMETERS -e"SHOW DATABASES LIKE 'intezmeny\_%'" | grep -e '^intezmeny\_[^\_]*$'`
+ if [ $? != 0 ]; then exit 12; fi
+ DB_AUTH=""
+@@ -153,7 +166,7 @@
+ echo "kész."
+
+ echo -n " - Aktív munkamenetek törlése... "
+- $MYSQL $MYSQL_PARAMETERS -e"DELETE FROM mayor_login.session"
++ $MYSQL $MYSQL_PARAMETERS -e"DELETE FROM mayor_login.session" ##itt se kell, jó az ASCII
+ echo "kész."
+ fi
+ else
+@@ -161,7 +174,7 @@
+ fi
+
+ echo -e "\n * Az előzetes frissítő állományok feldolgozása (pre*, rev*):\n"
+-for FILE in `ls $UPDATEDIR/rev* $UPDATEDIR/pre* | sort`; do
++for FILE in $(ls $UPDATEDIR/rev* $UPDATEDIR/pre* | sort); do
+ run_script
+ done
+
+@@ -175,8 +188,8 @@
+ else
+ # Ha rpm csomag futtatja, akkor már ki van csomagolva minden és nincs md5sum
+ if [ -f $TMPDIR/md5sum ]; then
+- MOD=`echo $MODULE | sed "s#/#-#"`
+- FILE=`grep "$MOD-rev" $TMPDIR/md5sum | cut -d ' ' -f 3`
++ MOD=$(echo $MODULE | sed "s#/#-#")
++ FILE=$(grep "$MOD-rev" $TMPDIR/md5sum | cut -d ' ' -f 3)
+ if [ -f $TMPDIR/$FILE ]; then
+ tar xfz $TMPDIR/$FILE -C $BASEDIR
+ if [ $? != 0 ]; then exit 13; fi
+@@ -189,7 +202,7 @@
+ fi
+
+ echo -e "\n * Az utólagos frissítő állományok feldolgozása (post*):\n"
+-for FILE in `ls $UPDATEDIR/post* | sort`; do
++for FILE in $(ls $UPDATEDIR/post* | sort); do
+ run_script
+ done
+
+@@ -219,7 +232,7 @@
+ for POLICY in $POLICIES; do
+ eval "LIST=\$${POLICY}Link"
+ for f in $LIST; do
+- DIR=`echo $f | cut -d / -f 1-2`
++ DIR=$(echo $f | cut -d / -f 1-2)
+ if [ ! -d $BASEDIR/www/policy/$POLICY/$DIR ]; then
+ echo " Könyvtár: $BASEDIR/www/policy/$POLICY/$DIR"
+ mkdir -p $BASEDIR/www/policy/$POLICY/$DIR