mirror of
https://github.com/YunoHost-Apps/biboumi_ynh.git
synced 2024-09-03 18:15:58 +02:00
Cleanup
This commit is contained in:
parent
dc9cb69cc6
commit
15e4398677
4 changed files with 78 additions and 67 deletions
|
@ -63,6 +63,28 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# CONFIGURE METRONOME
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring Metronome..."
|
||||
|
||||
# Add metronome component
|
||||
ynh_add_config --template="../conf/biboumi.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua"
|
||||
|
||||
chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua"
|
||||
|
||||
ynh_systemd_action --service_name=metronome --action="restart"
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
mkdir -p /var/lib/$app
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R _biboumi:_biboumi "/var/lib/$app"
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -80,35 +102,18 @@ ynh_add_config --template="../conf/biboumi.cfg" --destination="/etc/$app/$app.cf
|
|||
|
||||
chown -R _biboumi:_biboumi "/etc/$app/$app.cfg"
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE METRONOME
|
||||
#=================================================
|
||||
|
||||
# Add metronome component
|
||||
ynh_add_config --template="../conf/biboumi.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua"
|
||||
|
||||
chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua"
|
||||
|
||||
#=================================================
|
||||
# CREATE DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
mkdir -p /var/lib/$app
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R _biboumi:_biboumi "/var/lib/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
|
||||
mkdir -p /var/log/$app
|
||||
chown -R _biboumi:_biboumi "/var/log/$app"
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate /var/log/$app/
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
|
@ -122,8 +127,8 @@ yunohost service add $app --description="XMPP gateway for the IRC network" --log
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --action=restart --service_name=metronome
|
||||
ynh_systemd_action --action=restart --service_name=$app
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="restart"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -29,14 +29,6 @@ then
|
|||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -45,6 +37,14 @@ ynh_script_progression --message="Removing logrotate configuration..."
|
|||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
|
@ -52,6 +52,7 @@ ynh_remove_logrotate
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing various files..."
|
||||
|
||||
# Remove data directory
|
||||
ynh_secure_remove --file="/var/lib/$app"
|
||||
|
||||
# Remove a directory securely
|
||||
|
@ -60,10 +61,7 @@ ynh_secure_remove --file="/etc/$app"
|
|||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE METRONOME COMPONENT
|
||||
#=================================================
|
||||
|
||||
# Remove Metronome component
|
||||
ynh_secure_remove --file="/etc/metronome/conf.d/$app.cfg.lua"
|
||||
ynh_systemd_action --action=restart --service_name=metronome
|
||||
|
||||
|
|
|
@ -59,6 +59,17 @@ chown -R _biboumi:_biboumi /var/lib/$app
|
|||
|
||||
ynh_restore_file --origin_path="/etc/metronome/conf.d/$app.cfg.lua"
|
||||
chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua"
|
||||
ynh_systemd_action --service_name=metronome --action="restart"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
mkdir -p /var/log/$app
|
||||
chown -R _biboumi:_biboumi "/var/log/$app"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
|
@ -72,17 +83,7 @@ yunohost service add $app --description="XMPP gateway for the IRC network" --log
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --action=restart --service_name=metronome
|
||||
ynh_systemd_action --action=restart --service_name=$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
mkdir -p /var/log/$app
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
chown -R _biboumi:_biboumi /var/log/$app
|
||||
ynh_systemd_action --service_name=$app --action="restart"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -48,7 +48,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# Prevent conflict with other apps on the same domain
|
||||
ynh_app_setting_set --app=$app --key=no_sso --value=1
|
||||
|
@ -72,6 +72,28 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# UPGRADE METRONOME COMPONENT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading Metronome component..."
|
||||
|
||||
# Upgrade metronome component
|
||||
ynh_add_config --template="../conf/biboumi.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua"
|
||||
|
||||
chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua"
|
||||
|
||||
ynh_systemd_action --service_name=metronome --action="restart"
|
||||
|
||||
#=================================================
|
||||
# CREATE DIRECTORIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
mkdir -p /var/lib/$app
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R _biboumi:_biboumi "/var/lib/$app"
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
|
@ -79,32 +101,18 @@ ynh_script_progression --message="Updating a configuration file..."
|
|||
|
||||
ynh_add_config --template="../conf/biboumi.cfg" --destination="/etc/$app/$app.cfg"
|
||||
|
||||
chown _biboumi /etc/$app
|
||||
|
||||
#=================================================
|
||||
# UPGRADE METRONOME COMPONENT
|
||||
#=================================================
|
||||
|
||||
# Upgrade metronome component
|
||||
ynh_add_config --template="../conf/biboumi.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua"
|
||||
|
||||
#=================================================
|
||||
# CREATE DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
mkdir -p /var/lib/$app
|
||||
|
||||
# Set permissions to app files
|
||||
chown _biboumi /var/lib/$app
|
||||
chown -R _biboumi:_biboumi "/etc/$app/$app.cfg"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||
|
||||
mkdir -p /var/log/$app
|
||||
chown -R _biboumi:_biboumi "/var/log/$app"
|
||||
|
||||
chown _biboumi /var/log/$app
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
|
@ -120,7 +128,6 @@ yunohost service add $app --description="XMPP gateway for the IRC network" --log
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --action=restart --service_name=metronome
|
||||
ynh_systemd_action --action=restart --service_name=$app
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue