-
Notifications
You must be signed in to change notification settings - Fork 18
/
prepare_full_dev_environment.sh
executable file
·17 lines (14 loc) · 1.27 KB
/
prepare_full_dev_environment.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash -ex
IFDB_FULL_EXPORT=$1
rm -rf initdb
mkdir initdb
echo "create database if not exists ifdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER IF NOT EXISTS ifdb; use ifdb;" | cat - $IFDB_FULL_EXPORT/ifdb-*.sql > initdb/ifdb.sql
echo "create database if not exists ifdb_images0; use ifdb_images0;" | cat - $IFDB_FULL_EXPORT/ifdb_images0-*.sql > initdb/ifdb_images0.sql
echo "create database if not exists ifdb_images1; use ifdb_images1;" | cat - $IFDB_FULL_EXPORT/ifdb_images1-*.sql > initdb/ifdb_images1.sql
echo "create database if not exists ifdb_images2; use ifdb_images2;" | cat - $IFDB_FULL_EXPORT/ifdb_images2-*.sql > initdb/ifdb_images2.sql
echo "create database if not exists ifdb_images3; use ifdb_images3;" | cat - $IFDB_FULL_EXPORT/ifdb_images3-*.sql > initdb/ifdb_images3.sql
echo "create database if not exists ifdb_images4; use ifdb_images4;" | cat - $IFDB_FULL_EXPORT/ifdb_images4-*.sql > initdb/ifdb_images4.sql
cp sql/patch-full-schema.sql initdb/patch-full-schema.sql
sed 's/"127.0.0.1", "username", "password"/"db", "root", "secret"/' local-credentials.php.template > www/local-credentials.php
sed 's/return null/return localCredentials()/' www/local-credentials.php > www/local-credentials2.php
mv www/local-credentials2.php www/local-credentials.php