From f51c9ed2abe5c68211bb3736be5f70b1fe2c9ec0 Mon Sep 17 00:00:00 2001 From: M.Gergo Date: Fri, 8 Mar 2019 21:20:34 +0100 Subject: további rendrakás --- mayor-orig/bin/restore.sh | 257 ---------------------------------------------- 1 file changed, 257 deletions(-) delete mode 100644 mayor-orig/bin/restore.sh (limited to 'mayor-orig/bin/restore.sh') diff --git a/mayor-orig/bin/restore.sh b/mayor-orig/bin/restore.sh deleted file mode 100644 index 8283effa..00000000 --- a/mayor-orig/bin/restore.sh +++ /dev/null @@ -1,257 +0,0 @@ -#!/bin/bash - -OPT_SPEC="hkprf:d:t::" -LONG_OPT_SPEC="help,keep-old-passwords,restore-parent,restore-private,tmp-dir:,file:,backup-file:,dir:,base-dir::" -PARSED_OPTIONS=$(getopt -n "$0" -a -o $OPT_SPEC --long $LONG_OPT_SPEC -- "$@") -OPTIONS_RET=$? -eval set -- "$PARSED_OPTIONS" - -help_usage() { -cat </dev/null; then - echo "ok." - else - echo "hiba." - exit 3 - fi -fi - -if [ ! -d "${RTMPDIR}/restore" ]; then - if ! mkdir "${RTMPDIR}/restore" 2>/dev/null; then - echo "Hiba: Az ideiglenes könyvtár nem írható (${RTMPDIR})!" - exit 4 - fi -fi -chmod 700 "${RTMPDIR}/restore" -cd "${RTMPDIR}/restore" -tar xvfz $RBACKUPFILE -DT=$(ls) -echo "A mentés dátuma: ${DT}" -cd ${DT} - -RREVISIONFILE="${RTMPDIR}/restore/${DT}/log/revision" -declare -i BAK_REV -if [ ! -e "${RREVISIONFILE}" ]; then - echo "Hiba: A mentési állomány nem tartalmaz verzió információt!" - echo -e " A mentési állományon belül, a ${DT}/log/revision állományba írja be a revision számot (pl: 2512)!\n" - cleartmp - exit 5 -fi -BAK_REV=`cat $RREVISIONFILE` -echo "A mentett rendszer revision száma: ${BAK_REV}" - -if [ ${BAK_REV} -gt ${INST_REV} ]; then - echo "Hiba: A mentett rendszer újabb, mint a telepített!" - echo -e " A telepített rendszer revision száma nagyobb vagy egyenlő kell legyen a mentett rendszer revision számánál!\n Telepítsen frissíebb rendszert!\n" - cleartmp - exit 6 -fi - -# A telepített rendszer beállításainsak betöltése -if [ -f "${RBASEDIR}/config/main.conf" ]; then - . "${RBASEDIR}/config/main.conf" -else - echo "Hiba: A telepített rendszer nincs beállítva!" - echo -e " Hiányzik a konfigurációs állomány: ${RBASEDIR}/config/main.conf\n" - cleartmp - exit 7 -fi - -# Az adatbázisok betöltése -NAPLOUSER=`egrep 'userWrite.*=' $BASEDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g"` -NAPLOUSERREAD=`egrep 'userRead.*=' $BASEDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g"` -DBS=`$MYSQL -h$MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PW -e"SHOW DATABASES"` -if [ "$RESTORE_PARENT" == "1" ]; then - FILES="mayor_naplo.sql mayor_parent.sql intezmeny_*.sql naplo_*.sql" -else - FILES="mayor_naplo.sql intezmeny_*.sql naplo_*.sql" -fi -if [ "$RESTORE_PRIVATE" == "1" ]; then - FILES="$FILES mayor_private.sql" -fi -for SQLFILE in $FILES; do - if [ -e "${SQLFILE}" ]; then - DB=${SQLFILE%.sql} - echo -n "${DB} ... " - if [[ ! ${DBS} =~ .*$DB.* ]]; then - echo -n "... " - (cat < ${iNCDIR}/config.php.backup" - mv "${iNCDIR}/config.php" "${iNCDIR}/config.php.backup" - fi -fi - -cat "${bNCDIR}/config.php" | sed \ - -e "s/db\(.*\)$bDB\(.*\)/db\1$iDB\2/g" \ - -e "s/userWrite\(.*\)$bUSER\(.*\)/userWrite\1$iUSER\2/g" \ - -e "s/userRead\(.*\)$bUSERREAD\(.*\)/userRead\1$iUSERREAD\2/g" \ - -e "s/$bPW/$iPW/g" -e "s/$bPWREAD/$iPWREAD/g" > "${iNCDIR}/config.php" - -for FILE in config-*.php; do - echo -n "$FILE ... " - # mentés - if [ -e "${iNCDIR}/$FILE" ]; then - if [ ! -e "${iNCDIR}/$FILE.backup" ]; then - echo -n "... " - mv "${iNCDIR}/$FILE" "${iNCDIR}/$FILE.backup" - fi - fi - cp $FILE "${iNCDIR}/$FILE" - echo ok -done - -cd ${BASEDIR}/bin -if [ -z $UPDATELOG ]; then - . update.sh -e -r$BAK_REV -b${BASEDIR} -else - . update.sh -e -r$BAK_REV -b${BASEDIR} 2>&1 | tee -a $UPDATELOG -fi - -# Az ideiglenes könyvtár törlése -cleartmp - -- cgit v1.2.3