1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lutim_ynh.git synced 2024-09-03 19:36:24 +02:00
This commit is contained in:
eric_G 2024-06-09 16:55:46 +02:00 committed by GitHub
commit cb255cb660
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 99 deletions

View file

@ -9,13 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
path=$old_path
domain=$old_domain
ynh_maintenance_mode_ON
#=================================================
@ -25,7 +18,7 @@ ynh_maintenance_mode_ON
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/production.log"
#=================================================
# MODIFY URL IN NGINX CONF

View file

@ -54,7 +54,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Adding a configuration file..." --weight=2
workers="$(( $(nproc) * 2 ))"
ynh_add_config --template="../conf/lutim.conf.template" --destination="$install_dir/lutim.conf"
ynh_add_config --template="lutim.conf.template" --destination="$install_dir/lutim.conf"
chmod 400 "$install_dir/lutim.conf"
chown $app:$app "$install_dir/lutim.conf"
@ -63,7 +63,7 @@ chown $app:$app "$install_dir/lutim.conf"
# SETUP CRON
#=================================================
ynh_add_config --template="../conf/cron_lutim" --destination="/etc/cron.d/$app"
ynh_add_config --template="cron_lutim" --destination="/etc/cron.d/$app"
chmod +x $install_dir/script/lutim
#=================================================
@ -100,21 +100,9 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=2
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="$install_dir/log/production.log"
#=================================================

View file

@ -22,37 +22,15 @@ then
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=6
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"

View file

@ -33,11 +33,6 @@ ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/cron.d/$app"
# Making log a symbolic link to /var/log
@ -45,42 +40,15 @@ mkdir -p /var/log/$app/
touch /var/log/$app/production.log
chown $app -R /var/log/$app
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="$install_dir/log/production.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
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)
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
@ -72,14 +66,10 @@ fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
# 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"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -106,7 +96,7 @@ ynh_script_progression --message="Reconfiguring $app..."
if [ $overwrite_settings -eq 1 ]
then
workers="$(( $(nproc) * 2 ))"
ynh_add_config --template="../conf/lutim.conf.template" --destination="$install_dir/lutim.conf"
ynh_add_config --template="lutim.conf.template" --destination="$install_dir/lutim.conf"
chmod 400 "$install_dir/lutim.conf"
chown $app:$app "$install_dir/lutim.conf"
@ -128,20 +118,17 @@ fi
# SETUP CRON
#=================================================
ynh_add_config --template="../conf/cron_lutim" --destination="/etc/cron.d/$app"
ynh_add_config --template="cron_lutim" --destination="/etc/cron.d/$app"
#=================================================
# UPDATE LUTIM WITH CARTON
#=================================================
ynh_script_progression --message="Upgrading $app with Carton..." --weight=4
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading $app with Carton..." --weight=4
pushd "$install_dir"
ynh_secure_remove --file="$install_dir/local"
carton install --without=mysql --without=htpasswd --without=test
popd
fi
pushd "$install_dir"
ynh_secure_remove --file="$install_dir/local"
carton install --without=mysql --without=htpasswd --without=test
popd
#=================================================
# SETUP SYSTEMD