#!/bin/bash # cat < mayor-login.sql DB=$(grep db $MAYORDIR/config/parent-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") USER=$(grep user $MAYORDIR/config/parent-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") PW=$(grep pw $MAYORDIR/config/parent-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") cat $MAYORDIR/install/base/mysql/mayor-auth.sql | sed -e "s/%MYSQL_AUTH_DB%/$DB/g" -e "s/%MYSQL_AUTH_USER%/$USER/g" \ -e "s/%MYSQL_AUTH_PW%/$PW/g" > mayor-parent.sql DB=$(grep db $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") USER=$(grep 'mysql user' $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") PW=$(grep pw $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") cat $MAYORDIR/install/base/mysql/mayor-auth.sql | sed -e "s/%MYSQL_AUTH_DB%/$DB/g" -e "s/%MYSQL_AUTH_USER%/$USER/g" \ -e "s/%MYSQL_AUTH_PW%/$PW/g" > mayor-private.sql DB=$(grep db $MAYORDIR/config/module-naplo/config.php | grep naplo_base | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") USER=$(egrep 'userWrite.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") USERREAD=$(egrep 'userRead.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") PW=$(egrep 'pwWrite.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") PWREAD=$(egrep 'pwRead.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") cat $MAYORDIR/install/module-naplo/mysql/base.sql | sed -e "s/%MYSQL_NAPLO_DB%/$DB/g" -e "s/%MYSQL_NAPLO_USER%/$USER/g" \ -e "s/%MYSQL_NAPLO_PW%/$PW/g" -e "s/%MYSQL_NAPLO_USER_READ%/$USERREAD/g" \ -e "s/%MYSQL_NAPLO_PW_READ%/$PWREAD/g" > base.sql DB=$(grep db $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") cat $MAYORDIR/install/base/mysql/private-users.sql | sed -e "s/%MYSQL_PRIVATE_DB%/$DB/g" > private-users.sql cat $MAYORDIR/install/module-naplo/mysql/naplo-users.sql | sed -e "s/%MYSQL_PRIVATE_DB%/$DB/g" > naplo-users.sql echo " A létrejött sql fileok:" FILES=$(ls *.sql) for f in $FILES do echo " * ${f}"; done; read -n 1 -p "Telepíthetem? (i/N)" -s DO if [ "$DO" != "i" ]; then echo " ok, kiléptem..."; exit 1; fi echo -e "\n" read -p " A mysql root jelszó (a begépelt szöveg nem látszik!): " -s MYSQLROOTPW if [ ! -e $MAYORDIR/config/main.conf ]; then cat $MAYORDIR/config/main.conf.example | sed s/%SQLPW%/$MYSQLROOTPW/ > $MAYORDIR/config/main.conf chmod 600 $MAYORDIR/config/main.conf fi if [ "$MYSQLROOTPW" = "" ]; then MYSQLROOTPWSTR=""; else MYSQLROOTPWSTR="-p$MYSQLROOTPW --user=root" fi cat /tmp/mysql/mayor-login.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 cat /tmp/mysql/mayor-parent.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 cat /tmp/mysql/mayor-private.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 cat /tmp/mysql/base.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 cat /tmp/mysql/private-users.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 cat /tmp/mysql/naplo-users.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 echo -e "\n" echo "A telepítés végeztével beléphetsz a webes felületen! ========================================================= user: mayoradmin ========================================================= jelszó: jelszo ========================================================= "