Merge pull request #24 from YunoHost-Apps/upgrade

Few improvements
This commit is contained in:
yalh76 2022-01-10 21:22:43 +01:00 committed by GitHub
commit b64968583a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 35 deletions

View file

@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
A search engine for [PeerTube](https://joinpeertube.org/) videos and channels, developed by Framasoft.
**Shipped version:** 0.0.1.2021.12.28~ynh1
**Shipped version:** 0.0.1.2021.12.28~ynh2
**Demo:** https://search.joinpeertube.org/

View file

@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
A search engine for [PeerTube](https://joinpeertube.org/) videos and channels, developed by Framasoft.
**Version incluse :** 0.0.1.2021.12.28~ynh1
**Version incluse :** 0.0.1.2021.12.28~ynh2
**Démo :** https://search.joinpeertube.org/

View file

@ -16,6 +16,8 @@
# upgrade=1 from_commit=103b86aa716d289cab00aee49e539cab252e21a3
# 0.0.1-2021-02-17~ynh1
# upgrade=1 from_commit=e9864a6c794ba3ec5e6359b298d299f513a157e7
# 0.0.1.2021.12.28~ynh1
upgrade=1 from_commit=3409d4986706a0b89c36447a2f435f4cd8dde155
backup_restore=1
multi_instance=1
port_already_use=0
@ -30,3 +32,5 @@ Notification=none
name=0.0.1-2020-12-24~ynh1
; commit=e9864a6c794ba3ec5e6359b298d299f513a157e7
name=0.0.1-2021-02-17~ynh1
; commit=3409d4986706a0b89c36447a2f435f4cd8dde155
name=0.0.1.2021.12.28~ynh1

View file

@ -6,7 +6,7 @@
"en": "Search engine for PeerTube videos and channels",
"fr": "Moteur de recherche de vidéos et chaînes PeerTube"
},
"version": "0.0.1.2021.12.28~ynh1",
"version": "0.0.1.2021.12.28~ynh2",
"url": "https://search.joinpeertube.org/",
"upstream": {
"license": "AGPL-3.0-only",

View file

@ -90,7 +90,7 @@ then
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config "port"
ynh_add_nginx_config
fi
# Change the domain for NGINX

View file

@ -77,7 +77,7 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE

View file

@ -42,12 +42,12 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing dependencies..."
ynh_script_progression --message="Removing logrotate configuration..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE APP MAIN DIR
@ -66,12 +66,12 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing logrotate configuration..."
ynh_script_progression --message="Removing dependencies..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# GENERIC FINALIZATION

View file

@ -36,7 +36,8 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
@ -53,7 +54,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# RESTORE THE APP MAIN DIR
@ -89,6 +90,13 @@ ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -103,13 +111,6 @@ ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Server listening on port"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -28,18 +28,6 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -63,13 +51,25 @@ ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped $app search index daemon"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE