From 5eacdcef90c82a6ce6c1ad5b4f9a69a9ae9e142f Mon Sep 17 00:00:00 2001 From: Rodolphe Robles Date: Sat, 4 Apr 2020 14:29:20 +0200 Subject: [PATCH] delete folder hooks and update the scripts install and upgrade --- hooks/post_app_change_url | 27 --------------------------- hooks/post_app_install | 27 --------------------------- hooks/post_app_upgrade | 36 ------------------------------------ scripts/install | 11 +++++++++++ scripts/upgrade | 12 +++++++++++- 5 files changed, 22 insertions(+), 91 deletions(-) delete mode 100644 hooks/post_app_change_url delete mode 100644 hooks/post_app_install delete mode 100644 hooks/post_app_upgrade diff --git a/hooks/post_app_change_url b/hooks/post_app_change_url deleted file mode 100644 index 86403b9..0000000 --- a/hooks/post_app_change_url +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -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 $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 = true;" --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" diff --git a/hooks/post_app_install b/hooks/post_app_install deleted file mode 100644 index 86403b9..0000000 --- a/hooks/post_app_install +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -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 $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 = true;" --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" diff --git a/hooks/post_app_upgrade b/hooks/post_app_upgrade deleted file mode 100644 index 9cd6a5c..0000000 --- a/hooks/post_app_upgrade +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -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 config.local.php -#================================================= - -sudo cp -a $final_path/config.dist.php $final_path/config.local.php - -#================================================= -# backup the bdd -#================================================= -sudo cp -a /tmp/association.sqlite $final_path/association.sqlite -sudo cp -avr /tmp/squelettes $final_path/www/squelettes - - -# 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 = true;" --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" - - diff --git a/scripts/install b/scripts/install index f3c2ba4..d66ae60 100644 --- a/scripts/install +++ b/scripts/install @@ -79,6 +79,17 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +#================================================= +# 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 = true;" --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" + #================================================= # Files owned by user app #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 87f4daf..73d1392 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -50,10 +50,11 @@ elif [ "$is_public" = "No" ]; then fi #================================================= -# Backup squlite +# Backup squlite, config.local.php and squelettes directory #================================================= sudo cp -avr $final_path/association.sqlite /tmp/association.sqlite sudo cp -avr $final_path/www/squelettes /tmp/squelettes +sudo cp -a $final_path/config.local.php #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -111,6 +112,15 @@ then ynh_setup_source --dest_dir="$final_path" fi +#================================================= +# backup bdd, squelettes directory and config.local.php +#================================================= + +sudo cp -a /tmp/config.local.php $final_path/config.local.php + +sudo cp -a /tmp/association.sqlite $final_path/association.sqlite +sudo cp -avr /tmp/squelettes $final_path/www/squelettes + #================================================= # NGINX CONFIGURATION #=================================================