From: Thierry Parmentelat Date: Fri, 22 Nov 2024 11:10:17 +0000 (+0100) Subject: always recompute drupal settings from the original - to avoid ending up with mysql X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=b965581ec653cca145e71283bedaae4a91dfbfdd;p=plewww.git always recompute drupal settings from the original - to avoid ending up with mysql --- diff --git a/plewww.spec b/plewww.spec index 39e421e..7d57633 100644 --- a/plewww.spec +++ b/plewww.spec @@ -80,16 +80,20 @@ install -D -m 644 httpd/*.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/ drupal_settings_dir=/var/www/html/sites/default if [ ! -d $drupal_settings_dir ] ; then echo "Could not find directory $drupal_settings_dir" - echo "This suggests that you do not have a planetlab-custom drupal installed" + echo "This suggests you do not have a planetlab-custom drupal installed" exit 1 fi pushd $drupal_settings_dir # tune $db_url if [ ! -f settings.php.drupal ] ; then cp settings.php settings.php.drupal - sed -e 's|^[ \t]*\$db_url.*|require_once("plc_config.php");$db_url="pgsql://" . PLC_DB_USER . ":" . PLC_DB_PASSWORD . "@" . PLC_DB_HOST . ":" . PLC_DB_PORT . "/drupal";|' \ - settings.php.drupal > settings.php fi +# always do this; it's idempotent +# hopefully it will help in various upgrade scenarios where +# drupal was re-installed, and settings.php was left in the original drupal state +# which results in the infamous "cannot connect to mysql database" +sed -e 's|^[ \t]*\$db_url.*|require_once("plc_config.php");$db_url="pgsql://" . PLC_DB_USER . ":" . PLC_DB_PASSWORD . "@" . PLC_DB_HOST . ":" . PLC_DB_PORT . "/drupal";|' \ + settings.php.drupal > settings.php popd # append our own database creation hacks to the drupal database schema pushd /var/www/html/database