mirror of
https://github.com/YunoHost-Apps/element_ynh.git
synced 2024-09-03 18:36:08 +02:00
Full package upgrade
This commit is contained in:
parent
41d782a45f
commit
1cd28f0699
9 changed files with 72 additions and 52 deletions
|
@ -3,7 +3,7 @@
|
||||||
"id": "riot",
|
"id": "riot",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.14"
|
"yunohost": ">= 3.5.2.2"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"en": "A web client for matrix",
|
"en": "A web client for matrix",
|
||||||
|
|
|
@ -13,11 +13,11 @@ final_path="/var/www/$app"
|
||||||
|
|
||||||
config_riot() {
|
config_riot() {
|
||||||
cp ../conf/config.json $final_path/config.json
|
cp ../conf/config.json $final_path/config.json
|
||||||
ynh_replace_string __DEFAULT_SERVER__ $default_home_server $final_path/config.json
|
ynh_replace_string --match_string __DEFAULT_SERVER__ --replace_string $default_home_server --target_file $final_path/config.json
|
||||||
}
|
}
|
||||||
|
|
||||||
install_source() {
|
install_source() {
|
||||||
ynh_setup_source $final_path/
|
ynh_setup_source --dest_dir $final_path/
|
||||||
|
|
||||||
# if the default homeserver is external we dont add the sso support
|
# if the default homeserver is external we dont add the sso support
|
||||||
if [[ $(yunohost domain list | grep "$default_home_server") ]]
|
if [[ $(yunohost domain list | grep "$default_home_server") ]]
|
||||||
|
|
|
@ -19,14 +19,17 @@ source ../settings/scripts/_common.sh
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
|
|
||||||
|
ynh_script_progression --message="Backing configuration..."
|
||||||
|
|
||||||
# Copy Nginx config
|
# Copy Nginx config
|
||||||
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
ynh_backup --src_path "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
||||||
|
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_backup --src_path "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
# Backup riot files
|
# Backup riot files
|
||||||
ynh_backup "/var/www/$app"
|
ynh_script_progression --message="Backing up the main app directory..."
|
||||||
|
ynh_backup --src_path "/var/www/$app"
|
||||||
|
|
|
@ -15,23 +15,28 @@ source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Retrive arguments
|
# Retrive arguments
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
path_url=$(ynh_normalize_url_path ${YNH_APP_NEW_PATH:-'/'})
|
path_url=$(ynh_normalize_url_path --path_url ${YNH_APP_NEW_PATH:-'/'})
|
||||||
domain=$YNH_APP_NEW_DOMAIN
|
domain=$YNH_APP_NEW_DOMAIN
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Updating configuration..."
|
||||||
|
|
||||||
# Update nginx config
|
# Update nginx config
|
||||||
if [ "$old_domain" != "$domain" ]
|
if [ "$old_domain" != "$domain" ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum "/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
ynh_delete_file_checksum --file "/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
||||||
|
|
||||||
mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf"
|
mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
# Store file checksum for the new config file location
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
# Delete a file checksum from the app settings
|
|
||||||
#
|
|
||||||
# $app should be defined when calling this helper
|
|
||||||
#
|
|
||||||
# usage: ynh_remove_file_checksum file
|
|
||||||
# | arg: file - The file for which the checksum will be deleted
|
|
||||||
ynh_delete_file_checksum () {
|
|
||||||
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
|
||||||
ynh_app_setting_delete $app $checksum_setting_name
|
|
||||||
}
|
|
|
@ -14,35 +14,40 @@ ynh_abort_if_errors
|
||||||
source ./experimental_helper.sh
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
ynh_script_progression --message="Validating installation parameters..."
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH)
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
default_home_server=$YNH_APP_ARG_DEFAULT_HOME_SERVER
|
default_home_server=$YNH_APP_ARG_DEFAULT_HOME_SERVER
|
||||||
|
|
||||||
# Check domain/path availability
|
# Register (book) web path
|
||||||
ynh_webpath_available $domain $path_url || ynh_die "$domain$path_url is not available, please use an other domain or path."
|
ynh_webpath_register --app $app --domain $domain --path_url $path_url
|
||||||
ynh_webpath_register $app $domain $path_url
|
|
||||||
|
|
||||||
# Check Final Path availability
|
# Check Final Path availability
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message "This path already contains a folder"
|
||||||
|
|
||||||
# Enregistre les infos dans la config YunoHost
|
# Enregistre les infos dans la config YunoHost
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_script_progression --message="Storing installation settings..."
|
||||||
ynh_app_setting_set $app default_home_server $default_home_server
|
ynh_app_setting_set --app $app --key is_public --value $is_public
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set --app $app --key default_home_server --value $default_home_server
|
||||||
|
ynh_app_setting_set --app $app --key final_path --value $final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
ynh_system_user_create --username $app
|
||||||
|
|
||||||
# Get source and install in source dir
|
# Get source and install in source dir
|
||||||
|
ynh_script_progression --message="Installing sources files..." --weight=10
|
||||||
install_source
|
install_source
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
|
ynh_script_progression --message="Configuring application..."
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
|
||||||
# Update Riot config
|
# Update Riot config
|
||||||
|
@ -56,13 +61,15 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set final permission
|
# Set final permission
|
||||||
|
ynh_script_progression --message="Protecting directory"
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
|
ynh_script_progression --message="Configuring permissions"
|
||||||
if [ "$is_public" = "0" ];
|
if [ "$is_public" = "0" ];
|
||||||
then # Retire l'accès public
|
then # Retire l'accès public
|
||||||
ynh_app_setting_delete $app skipped_uris
|
ynh_app_setting_delete --app $app --key skipped_uris
|
||||||
else
|
else
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set --app $app --key unprotected_uris --value "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Recharge la configuration Nginx
|
# Recharge la configuration Nginx
|
||||||
|
|
|
@ -16,16 +16,20 @@ source ./_common.sh
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
|
|
||||||
|
# Remove all files
|
||||||
|
ynh_script_progression --message="Removing app main directory..." --weight=4
|
||||||
|
ynh_secure_remove --file="/var/www/$app"
|
||||||
|
|
||||||
|
# Suppression de la configuration nginx
|
||||||
|
ynh_script_progression --message="Removing configuration..."
|
||||||
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
# Remove all files
|
|
||||||
ynh_secure_remove "/var/www/$app"
|
|
||||||
|
|
||||||
# Suppression de la configuration nginx
|
|
||||||
ynh_remove_nginx_config
|
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete $app
|
ynh_script_progression --message="Removing apps user..."
|
||||||
|
ynh_system_user_delete --username $app
|
||||||
|
|
|
@ -15,20 +15,23 @@ source ../settings/scripts/experimental_helper.sh
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
ynh_script_progression --message="Loading settings..."
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
|
path_url=$(ynh_app_setting_get --app $app --key path)
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
ynh_webpath_available $domain $path_url || ynh_die "$domain/$path_url is not available, please use an other domain or path."
|
ynh_webpath_available --domain $domain --path_url $path_url || ynh_die --message "$domain/$path_url is not available, please use an other domain or path."
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app
|
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||||
|
ynh_system_user_create --username $app
|
||||||
|
|
||||||
# Restore all config and data
|
# Restore all config and data
|
||||||
|
ynh_script_progression --message="Restoring files..." --weight=10
|
||||||
ynh_restore
|
ynh_restore
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -36,8 +39,10 @@ ynh_restore
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set final permission
|
# Set final permission
|
||||||
|
ynh_script_progression --message="Protecting directory..."
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
# Reload nginx
|
# Reload nginx
|
||||||
|
ynh_script_progression --message="Reloading services..."
|
||||||
systemctl reload nginx.service
|
systemctl reload nginx.service
|
||||||
systemctl reload php5-fpm
|
systemctl reload php5-fpm
|
|
@ -15,27 +15,32 @@ source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get $app path))
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
is_public=$(ynh_app_setting_get $app is_public)
|
path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path))
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
is_public=$(ynh_app_setting_get --app $app --key is_public)
|
||||||
default_home_server=$(ynh_app_setting_get $app default_home_server)
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
||||||
|
default_home_server=$(ynh_app_setting_get --app $app --key default_home_server)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MIGRATION FROM OLD VERSION
|
# MIGRATION FROM OLD VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
grep "riot" "/etc/passwd" || ynh_system_user_create $app
|
ynh_script_progression --message="Migrating application..." --weight=1
|
||||||
|
grep "riot" "/etc/passwd" || ynh_system_user_create --username $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Get source and install in source dir
|
# Get source and install in source dir
|
||||||
ynh_secure_remove $final_path/bundles
|
ynh_script_progression --message="Upgrading source files..." --weight=6
|
||||||
|
ynh_secure_remove --file=$final_path/bundles
|
||||||
install_source
|
install_source
|
||||||
|
|
||||||
|
ynh_script_progression --message="Configuring application..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
|
||||||
|
@ -50,6 +55,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set final permission
|
# Set final permission
|
||||||
|
ynh_script_progression --message="Protecting directory..."
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
# Recharge la configuration Nginx
|
# Recharge la configuration Nginx
|
||||||
|
|
Loading…
Add table
Reference in a new issue