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": {
|
"description": {
|
||||||
"en": "A modern, convivial and free music server"
|
"en": "A modern, convivial and free music server"
|
||||||
},
|
},
|
||||||
"version": "0.18.3~ynh1",
|
"version": "0.18.3~ynh2",
|
||||||
"url": "https://funkwhale.audio",
|
"url": "https://funkwhale.audio",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
"email": "jean-baptiste@holcroft.fr"
|
"email": "jean-baptiste@holcroft.fr"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.3.0"
|
"yunohost": ">= 3.5"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -25,25 +25,25 @@
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose a domain"
|
"en": "Choose a domain for funkwhale"
|
||||||
},
|
},
|
||||||
"example": "domain.fr"
|
"example": "example.com"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "is_public",
|
|
||||||
"type": "boolean",
|
|
||||||
"ask": {
|
|
||||||
"en": "Should Funkwhale be publicly accessible?"
|
|
||||||
},
|
|
||||||
"default": "0"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose an admin user for Funkwhale"
|
"en": "Choose an admin user"
|
||||||
},
|
},
|
||||||
"example": "jibec"
|
"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
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,9 @@ ynh_secure_remove "/etc/systemd/system/$app.target"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Removing the PostgreSQL database"
|
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
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_psql_remove_db --db_name="$db_name" --db_user="$app"
|
ynh_psql_remove_db --db_name="$db_name" --db_user="$app"
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -88,6 +91,17 @@ ynh_print_info "Recreating the dedicated system user..."
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create "$app"
|
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
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -95,6 +109,7 @@ ynh_system_user_create "$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Reinstalling dependencies..."
|
ynh_print_info "Reinstalling dependencies..."
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_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_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"
|
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
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -64,6 +64,7 @@ ynh_app_setting_set "$app" backup_core_only 1
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# restore it if the upgrade fails
|
# restore it if the upgrade fails
|
||||||
|
ynh_clean_check_starting
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# 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..."
|
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"
|
ynh_system_user_create "$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -271,7 +272,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading SSOwat configuration..."
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue