aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-installer/install.d/35createdatabases.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mayor-installer/install.d/35createdatabases.sh')
-rwxr-xr-xmayor-installer/install.d/35createdatabases.sh39
1 files changed, 21 insertions, 18 deletions
diff --git a/mayor-installer/install.d/35createdatabases.sh b/mayor-installer/install.d/35createdatabases.sh
index d44d28e4..718ca3c2 100755
--- a/mayor-installer/install.d/35createdatabases.sh
+++ b/mayor-installer/install.d/35createdatabases.sh
@@ -40,13 +40,13 @@ if [ ! -e $MAYORDIR/log/mayor-base.rev ]; then
echo " Hiányzó mayor-base.rev file";
if [ -e $MAYORDIR/log/revision ];
then
- IREV=`cat $MAYORDIR/log/revision`
+ IREV=$(cat $MAYORDIR/log/revision)
else
IREV="";
fi
else
cp $MAYORDIR/log/mayor-base.rev $MAYORDIR/log/revision
- IREV=`cat $MAYORDIR/log/revision`
+ IREV=$(cat $MAYORDIR/log/revision)
fi
echo " Az aktuális revision: ${IREV}"
@@ -60,36 +60,36 @@ fi
echo " SQL fileok létrehozása... "
mkdir -p $TMPDIR/mysql
cd $TMPDIR/mysql
-DB=`grep db $MAYORDIR/config/main-config.php | sed -e "s/$.*=\ *['|\"]//g" -e "s/['|\"];//g"`
-USER=`grep user $MAYORDIR/config/main-config.php | sed -e "s/$.*=\ *['|\"]//g" -e "s/['|\"];//g"`
-PW=`grep pw $MAYORDIR/config/main-config.php | sed -e "s/$.*=\ *['|\"]//g" -e "s/['|\"];//g"`
+DB=$(grep db $MAYORDIR/config/main-config.php | sed -e "s/$.*=\ *['|\"]//g" -e "s/['|\"];//g")
+USER=$(grep user $MAYORDIR/config/main-config.php | sed -e "s/$.*=\ *['|\"]//g" -e "s/['|\"];//g")
+PW=$(grep pw $MAYORDIR/config/main-config.php | sed -e "s/$.*=\ *['|\"]//g" -e "s/['|\"];//g")
cat $MAYORDIR/install/base/mysql/mayor-login.sql | sed -e "s/%MYSQL_LOGIN_DB%/$DB/g" -e "s/%MYSQL_LOGIN_USER%/$USER/g" \
-e "s/%MYSQL_LOGIN_PW%/$PW/g" > 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"`
+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"`
+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"`
+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"`
+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`
+FILES=$(ls *.sql)
for f in $FILES
do
echo " * ${f}";
@@ -100,8 +100,11 @@ 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
+# BDIR=$(echo $MAYORDIR | sed -e 's:\/:\\\/:g')
+# sed -e "s/BASEDIR=\"\/var\/mayor\"/BASEDIR=\"$BDIR\"/g" -i $MAYORDIR/config/main.conf
chmod 600 $MAYORDIR/config/main.conf
fi