mirror of
https://github.com/YunoHost-Apps/funkwhale_ynh.git
synced 2024-09-03 18:36:24 +02:00
Add ynh_clean_check_starting
This commit is contained in:
parent
3101a0480c
commit
a9bd21abce
6 changed files with 40 additions and 26 deletions
|
@ -5,7 +5,7 @@
|
|||
"description": {
|
||||
"en": "A modern, convivial and free music server"
|
||||
},
|
||||
"version": "0.18.3~ynh1",
|
||||
"version": "0.18.3~ynh2",
|
||||
"url": "https://funkwhale.audio",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
|
@ -13,7 +13,7 @@
|
|||
"email": "jean-baptiste@holcroft.fr"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.3.0"
|
||||
"yunohost": ">= 3.5"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -25,25 +25,25 @@
|
|||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain"
|
||||
"en": "Choose a domain for funkwhale"
|
||||
},
|
||||
"example": "domain.fr"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Should Funkwhale be publicly accessible?"
|
||||
},
|
||||
"default": "0"
|
||||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose an admin user for Funkwhale"
|
||||
"en": "Choose an admin user"
|
||||
},
|
||||
"example": "jibec"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public application?"
|
||||
},
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
|
|
@ -69,6 +69,9 @@ ynh_secure_remove "/etc/systemd/system/$app.target"
|
|||
#=================================================
|
||||
ynh_print_info "Removing the PostgreSQL database"
|
||||
|
||||
ynh_psql_execute_as_root "\connect $db_name
|
||||
SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db_name';"
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_name="$db_name" --db_user="$app"
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
@ -88,6 +91,17 @@ ynh_print_info "Recreating the dedicated system user..."
|
|||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create "$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R "$app": "$final_path"
|
||||
chmod -R 755 "$final_path/code/front/dist/"
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R "$app": "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
|
@ -95,6 +109,7 @@ ynh_system_user_create "$app"
|
|||
#=================================================
|
||||
ynh_print_info "Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
|
@ -106,17 +121,6 @@ ynh_psql_test_if_first_run
|
|||
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd"
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R "$app": "$final_path"
|
||||
chmod -R 755 "$final_path/code/front/dist/"
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chown -R "$app": "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -64,6 +64,7 @@ ynh_app_setting_set "$app" backup_core_only 1
|
|||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_clean_check_starting
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -138,7 +139,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
#=================================================
|
||||
ynh_print_info "Making sure dedicated system user exists..."
|
||||
|
||||
# Create a system user
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create "$app"
|
||||
|
||||
#=================================================
|
||||
|
@ -271,7 +272,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading SSOwat configuration..."
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
|
|
Loading…
Reference in a new issue