1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/grammalecte_ynh.git synced 2024-09-03 20:36:23 +02:00

Cleanup packagingv2, fix patch

This commit is contained in:
Salamandar 2024-02-05 13:26:38 +01:00
parent 8be9934b32
commit fb1b7aa2dd
8 changed files with 34 additions and 78 deletions

View file

@ -32,10 +32,10 @@ ram.runtime = "50M"
full_domain = true
[resources]
[resources.sources.main]
url = "https://grammalecte.net/zip/Grammalecte-fr-v2.1.1.zip"
sha256 = "f643eca603652469947d9bd85fb0ec08f8eb0f7b6ab925d2fb18bfc6fdd8d21c"
in_subdir = false
[resources.sources.main]
url = "https://grammalecte.net/zip/Grammalecte-fr-v2.1.1.zip"
sha256 = "f643eca603652469947d9bd85fb0ec08f8eb0f7b6ab925d2fb18bfc6fdd8d21c"
in_subdir = false
[resources.ports]

View file

@ -22,31 +22,21 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP LOGS
#=================================================
ynh_backup --src_path="/var/log/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -32,7 +32,7 @@ ynh_change_url_nginx_config
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT

View file

@ -17,10 +17,14 @@ ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
# Set permissions to app files
chmod u+x "$install_dir/grammalecte-server.py"
chown -R "$app:www-data" "$install_dir"
#=================================================
# NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
@ -31,18 +35,7 @@ ynh_add_systemd_config
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
yunohost service add $app --description="Spelling, grammar, and typography checking server for French and Occitan" --log="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R root:$app $install_dir
chmod u+x $install_dir/grammalecte-server.py
chmod -R g=u,g-w,o-rwx $install_dir
yunohost service add "$app" --description="Spelling, grammar, and typography checking server for French and Occitan" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
@ -50,7 +43,7 @@ chmod -R g=u,g-w,o-rwx $install_dir
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT

View file

@ -10,16 +10,13 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
yunohost service remove "$app"
fi
# Remove the dedicated systemd config

View file

@ -17,10 +17,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
# Restore permissions on app files
chown -R root:$app $install_dir
chmod u+x $install_dir/grammalecte-server.py
chmod -R g=u,g-w,o-rwx $install_dir
chown -R "$app:www-data" "$install_dir"
#=================================================
# RESTORE SYSTEMD
@ -30,20 +27,19 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
systemctl enable "$app.service" --quiet
yunohost service add "$app" --description="Spelling, grammar, and typography checking server for French and Occitan" --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore_file --origin_path="/var/log/$app"
yunohost service add $app --description="Spelling, grammar, and typography checking server for French and Occitan" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -9,12 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -24,52 +18,38 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
chmod u+x "$install_dir/grammalecte-server.py"
chown -R "$app:www-data" "$install_dir"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
ynh_secure_remove --file="$install_dir"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
fi
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
#=================================================
# NGINX CONFIGURATION
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add "$app" --description="Spelling, grammar, and typography checking server for French and Occitan" --log="/var/log/$app/$app.log"
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
yunohost service add $app --description="Spelling, grammar, and typography checking server for French and Occitan" --log="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
chown -R root:$app $install_dir
chmod u+x $install_dir/grammalecte-server.py
chmod -R g=u,g-w,o-rwx $install_dir
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT