diff --git a/hooks/post_app_change_url b/hooks/post_app_change_url index 9a02bc5..96cbda0 100644 --- a/hooks/post_app_change_url +++ b/hooks/post_app_change_url @@ -6,16 +6,23 @@ # IMPORT GENERIC HELPERS #================================================= -source ../scripts/_common.sh source /usr/share/yunohost/helpers #================================================= -# Change options in config.local.php +#Retrieve arguments #================================================= -sudo cp -a /var/www/garradin/config.dist.php var/www/garradin/local.dist.php +app=$YNH_APP_INSTANCE_NAME +final_path=/var/www/$app -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" +#================================================= +# Change options in file config.dist.php +# and copy in local.dist.php +#================================================= + +sudo cp -a $final_path/config.dist.php $final_path/config.local.php + +ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = /var/www/garradin;" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = false;" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '/garradin/';" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = 'uqn8jvlmVZLn988lOZiHd1z97hD36V40AnE0LLqLY1801LG3caO';" --target_file="$final_path/config.local.php" diff --git a/hooks/post_app_install b/hooks/post_app_install index 240fa98..96cbda0 100644 --- a/hooks/post_app_install +++ b/hooks/post_app_install @@ -6,17 +6,23 @@ # IMPORT GENERIC HELPERS #================================================= -source ../scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +#Retrieve arguments +#================================================= + +app=$YNH_APP_INSTANCE_NAME +final_path=/var/www/$app + #================================================= # Change options in file config.dist.php # and copy in local.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/config.local.php -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" +ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = /var/www/garradin;" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = false;" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '/garradin/';" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = 'uqn8jvlmVZLn988lOZiHd1z97hD36V40AnE0LLqLY1801LG3caO';" --target_file="$final_path/config.local.php" diff --git a/hooks/post_app_upgrade b/hooks/post_app_upgrade index 39958e0..3385e87 100644 --- a/hooks/post_app_upgrade +++ b/hooks/post_app_upgrade @@ -6,15 +6,24 @@ # IMPORT GENERIC HELPERS #================================================= -source ../scripts/_common.sh source /usr/share/yunohost/helpers #================================================= -# Change options in config.local.php +#Retrieve arguments #================================================= -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" +app=$YNH_APP_INSTANCE_NAME +final_path=/var/www/$app + +#================================================= +# Change options in file config.dist.php +# and copy in config.local.php +#================================================= + +sudo cp -a /var/www/garradin/config.dist.php var/www/garradin/local.dist.php + +ynh_replace_string --match_string="const ROOT = __DIR__;" --replace_string="const ROOT = /var/www/garradin;" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="const PREFER_HTTPS = false;" --replace_string="const PREFER_HTTPS = false;" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '/garradin/';" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = 'uqn8jvlmVZLn988lOZiHd1z97hD36V40AnE0LLqLY1801LG3caO';" --target_file="$final_path/config.local.php" -sudo cp -a $final_path/config.dist.php $final_path/local.dist.php