From f17a3c490f279dbb0931b16112a4992d7ce666d9 Mon Sep 17 00:00:00 2001 From: Rodolphe Robles Date: Sat, 4 Apr 2020 04:04:42 +0200 Subject: [PATCH] add hooks to copy file config.dist.php in config.local.php with good options --- hooks/post_app_change_url | 11 ++++++----- hooks/post_app_install | 12 ++++++------ hooks/post_app_upgrade | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/hooks/post_app_change_url b/hooks/post_app_change_url index 4c406a8..9a02bc5 100644 --- a/hooks/post_app_change_url +++ b/hooks/post_app_change_url @@ -6,15 +6,16 @@ # IMPORT GENERIC HELPERS #================================================= -source _common.sh +source ../scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # Change options in config.local.php #================================================= -ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = /var/www/garradin;" --target_file="$final_path/config.dist.php" -ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = false;" --target_file="$final_path/config.dist.php" -ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '/garradin/';" --target_file="$final_path/config.dist.php" +sudo cp -a /var/www/garradin/config.dist.php var/www/garradin/local.dist.php -sudo cp -a $final_path/config.dist.php $final_path/local.dist.php \ No newline at end of file +ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = /var/www/garradin;" --target_file="$final_path/local.dist.php" +ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = false;" --target_file="$final_path/local.dist.php" +ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '/garradin/';" --target_file="$final_path/local.dist.php" +ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = 'uqn8jvlmVZLn988lOZiHd1z97hD36V40AnE0LLqLY1801LG3caO';" --target_file="$final_path/config.dist.php" diff --git a/hooks/post_app_install b/hooks/post_app_install index 5fcbe84..240fa98 100644 --- a/hooks/post_app_install +++ b/hooks/post_app_install @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -source _common.sh +source ../scripts/_common.sh source /usr/share/yunohost/helpers #================================================= @@ -14,9 +14,9 @@ source /usr/share/yunohost/helpers # and copy in local.dist.php #================================================= -ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = /var/www/garradin;" --target_file="$final_path/config.dist.php" -ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = false;" --target_file="$final_path/config.dist.php" -ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '/garradin/';" --target_file="$final_path/config.dist.php" -ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = 'uqn8jvlmVZLn988lOZiHd1z97hD36V40AnE0LLqLY1801LG3caO';" --target_file="$final_path/config.dist.php" +sudo cp -a /var/www/garradin/config.dist.php var/www/garradin/local.dist.php -sudo cp -a $final_path/config.dist.php $final_path/local.dist.php \ No newline at end of file +ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = /var/www/garradin;" --target_file="$final_path/local.dist.php" +ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = false;" --target_file="$final_path/local.dist.php" +ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '/garradin/';" --target_file="$final_path/local.dist.php" +ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = 'uqn8jvlmVZLn988lOZiHd1z97hD36V40AnE0LLqLY1801LG3caO';" --target_file="$final_path/config.dist.php" diff --git a/hooks/post_app_upgrade b/hooks/post_app_upgrade index 3235aa7..39958e0 100644 --- a/hooks/post_app_upgrade +++ b/hooks/post_app_upgrade @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -source _common.sh +source ../scripts/_common.sh source /usr/share/yunohost/helpers #=================================================