diff options
author | M.Gergo | 2018-07-06 11:13:06 +0200 |
---|---|---|
committer | M.Gergo | 2018-07-06 11:13:06 +0200 |
commit | 50310b0e4513ee3fcce67351ae61e8fff851130e (patch) | |
tree | fd2e4a73f94a61cd5040f863579149ed97c701a3 /mayor-mod/update/processUpdateScripts.sh.mod.txt | |
parent | 630f5353ed7a264b0fa17badd62f71a02265a4f7 (diff) | |
download | mayor-50310b0e4513ee3fcce67351ae61e8fff851130e.tar.gz mayor-50310b0e4513ee3fcce67351ae61e8fff851130e.zip |
Mappák átnevezve: mayor --> mayor-mod; mayor-installer --> mayor-installer-mod; mayor-installer-fcgi --> mayor-installer-fcgi-mod
Diffstat (limited to 'mayor-mod/update/processUpdateScripts.sh.mod.txt')
-rw-r--r-- | mayor-mod/update/processUpdateScripts.sh.mod.txt | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/mayor-mod/update/processUpdateScripts.sh.mod.txt b/mayor-mod/update/processUpdateScripts.sh.mod.txt new file mode 100644 index 00000000..3168b48d --- /dev/null +++ b/mayor-mod/update/processUpdateScripts.sh.mod.txt @@ -0,0 +1,183 @@ +--- processUpdateScripts.sh.orig 2016-03-04 13:44:39.000000000 +0100 ++++ processUpdateScripts.sh 2018-03-04 14:10:13.835309914 +0100 +@@ -6,22 +6,26 @@ + 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 NAMES 'utf8' COLLATE 'utf8_hungarian_ci'; " ## fontos, hogy a ";" ott legyen a végén!! ++#PRECHARSET="$PRECHARSET SET collation_connection = utf8_hungarian_ci; " ## ha a mysql server esetleg régebbi lenne. ++ + 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 +35,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 +50,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 +59,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 +86,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 +96,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 +124,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 +137,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 +161,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 +169,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 +183,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 +197,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 +227,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 |