1 |
469b9d6d
|
Julien Enselme
|
#!/bin/sh
|
2 |
|
|
|
3 |
8f9b0d95
|
Julien Enselme
|
. /users/guest/assos/bin/scripts-config.sh
|
4 |
469b9d6d
|
Julien Enselme
|
. /users/guest/assos/bin/scripts-utils.sh
|
5 |
|
|
|
6 |
|
|
# This script generate settings.php and settings.local.php from settings.php
|
7 |
|
|
|
8 |
|
|
for settings in $(find $d7_dir_sites -mindepth 2 -maxdepth 2 -name settings.php) ; do
|
9 |
|
|
# Get infos from settings.php
|
10 |
8f9b0d95
|
Julien Enselme
|
db_name=$(grep "^ *'database' => '\(.*\)'" $settings | sed "s/^ *'database' => '\(.*\)'.*/\1/")
|
11 |
469b9d6d
|
Julien Enselme
|
db_user=$(grep "^ *'username' => '\(.*\)'" $settings | sed "s/^ *'username' => '\(.*\)'.*/\1/")
|
12 |
8f9b0d95
|
Julien Enselme
|
db_password=$(grep "^ *'password' => '\(.*\)'" $settings | sed "s/^ *'password' => '\(.*\)'.*/\1/")
|
13 |
|
|
base_url=$(grep "^ *\$base_url = '\(.*\)'" $settings | sed "s/^ *\$base_url = '\(.*\)'.*/\1/")
|
14 |
469b9d6d
|
Julien Enselme
|
|
15 |
|
|
settings_dir=`give_dir $settings`
|
16 |
|
|
|
17 |
|
|
chmod 700 $settings
|
18 |
|
|
|
19 |
|
|
rm $settings
|
20 |
|
|
|
21 |
65ce03da
|
Julien Enselme
|
# We go into the settings.php directory.
|
22 |
469b9d6d
|
Julien Enselme
|
cd $settings_dir
|
23 |
8f9b0d95
|
Julien Enselme
|
pwd
|
24 |
469b9d6d
|
Julien Enselme
|
|
25 |
|
|
cp $d7_settings settings.php
|
26 |
|
|
chmod 400 settings.php
|
27 |
|
|
|
28 |
8f9b0d95
|
Julien Enselme
|
sed "s/\%\%DBUSER\%\%/$db_user/ ; s/\%\%DBNAME\%\%/$db_name/ ; s/\%\%DBPASS\%\%/$db_password/ ; s#\%\%BASE_URL\%\%#$base_url#" < ~/tmp/d7-settings-local-template.php > settings.local.php
|
29 |
469b9d6d
|
Julien Enselme
|
|
30 |
|
|
chmod 400 settings.local.php
|
31 |
|
|
done |