1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ffsync_ynh.git synced 2024-09-03 18:26:38 +02:00

Fix linter

This commit is contained in:
ericgaspar 2023-01-22 10:54:32 +01:00
parent 271bef9ca1
commit e4702b0b63
5 changed files with 29 additions and 30 deletions

View file

@ -21,7 +21,7 @@
"email": "jean-baptiste@holcroft.fr" "email": "jean-baptiste@holcroft.fr"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 4.1.2" "yunohost": ">= 11.0.9"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -31,8 +31,7 @@
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"example": "domain.org"
}, },
{ {
"name": "path", "name": "path",

View file

@ -32,29 +32,28 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP THE systemd FILES
ynh_print_info --message="Backing up systemd..."
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -49,12 +49,11 @@ ynh_app_setting_set --app $app --key web_port --value $port
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#=================================================
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=7 ynh_script_progression --message="Installing dependencies..." --weight=7
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
@ -72,7 +71,6 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
ynh_script_progression --message="Installing sources files..." --weight=10 ynh_script_progression --message="Installing sources files..." --weight=10
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
install_sources install_sources
@ -83,7 +81,8 @@ install_sources
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx" ynh_script_progression --message="Configuring NGINX"
if [ "$path_url" == "/" ] if [ "$path_url" == "/" ]
then then
# $finalnginxconf comes from ynh_add_nginx_config # $finalnginxconf comes from ynh_add_nginx_config
@ -98,15 +97,16 @@ ynh_add_nginx_config 'is_subpath'
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." ynh_script_progression --message="Configuring system user..."
# Create a 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
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
ynh_script_progression --message="Configuring application..."
# create config file syncserver.ini # create config file syncserver.ini
ynh_script_progression --message="Configuring application..."
ynh_add_config --template="syncserver.ini" --destination="$final_path/syncserver.ini" ynh_add_config --template="syncserver.ini" --destination="$final_path/syncserver.ini"
# Configure init script # Configure init script
@ -135,14 +135,15 @@ set_permissions
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions" ynh_script_progression --message="Configuring permissions"
# accessible by everyone (authentification is done by firefox accounts)
# accessible by everyone (authentification is done by firefox accounts)
ynh_permission_update --permission=main --add=visitors --protected=true --show_tile=true ynh_permission_update --permission=main --add=visitors --protected=true --show_tile=true
#================================================= #=================================================
# RELOAD Services # RELOAD Services
#================================================= #=================================================
ynh_script_progression --message="Restart services..." ynh_script_progression --message="Restart services..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
ynh_script_progression --message="Starting $app services..." --weight=3 ynh_script_progression --message="Starting $app services..." --weight=3

View file

@ -30,21 +30,23 @@ db_user=$db_name
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
ynh_script_progression --message="Restoring files..." --weight=5
# Restore all config and data # Restore all config and data
ynh_script_progression --message="Restoring files..." --weight=5
ynh_restore ynh_restore
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." ynh_script_progression --message="Recreating the dedicated system user..."
ynh_system_user_create --username="$app" ynh_system_user_create --username="$app"
usermod --append --groups www-data "$app" usermod --append --groups www-data "$app"
@ -77,8 +79,8 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Reloading services..." --weight=3 ynh_script_progression --message="Reloading services..." --weight=3
systemctl daemon-reload systemctl daemon-reload
systemctl enable --quiet $app.service systemctl enable --quiet $app.service
yunohost service add "$app" yunohost service add "$app"
@ -88,8 +90,8 @@ yunohost service add "$app"
#================================================= #=================================================
# RELOAD NGINX AND UWSGI # RELOAD NGINX AND UWSGI
#================================================= #=================================================
ynh_script_progression --message="Starting pgadmin services..." --weight=3 ynh_script_progression --message="Starting pgadmin services..." --weight=3
ynh_systemd_action --service_name "$app.service" \ ynh_systemd_action --service_name "$app.service" \
--line_match "Booting worker with pid" --log_path "systemd" --line_match "Booting worker with pid" --log_path "systemd"
ynh_systemd_action --service_name=nginx --action=reload -t 20 ynh_systemd_action --service_name=nginx --action=reload -t 20

View file

@ -28,7 +28,6 @@ db_user=$app
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_print_info --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
@ -113,21 +112,19 @@ fi
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#=================================================
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=6
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_script_progression --message="Upgrading source files..." --weight=6
if [ -e $final_path/syncserver.ini ]; then if [ -e $final_path/syncserver.ini ]; then
config_backup="$(cat $final_path/syncserver.ini)" config_backup="$(cat $final_path/syncserver.ini)"
install_sources install_sources
@ -139,7 +136,8 @@ fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx" ynh_script_progression --message="Configuring NGINX"
if [ "$path_url" == "/" ] if [ "$path_url" == "/" ]
then then
# $finalnginxconf comes from ynh_add_nginx_config # $finalnginxconf comes from ynh_add_nginx_config
@ -159,9 +157,9 @@ ynh_system_user_create --username="$app"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
# SETUP UWSGI
ynh_script_progression --message="Configuring application..." ynh_script_progression --message="Configuring application..."
# SETUP UWSGI
# create config file syncserver.ini # create config file syncserver.ini
ynh_script_progression --message="Configuring application..." ynh_script_progression --message="Configuring application..."
ynh_add_config --template="syncserver.ini" --destination="$final_path/syncserver.ini" ynh_add_config --template="syncserver.ini" --destination="$final_path/syncserver.ini"
@ -187,8 +185,8 @@ set_permissions
#================================================= #=================================================
# Migrate legacy permissions to new system # Migrate legacy permissions to new system
#================================================= #=================================================
ynh_script_progression --message="Set permissions..." ynh_script_progression --message="Set permissions..."
if ynh_legacy_permissions_exists if ynh_legacy_permissions_exists
then then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all