mirror of
https://github.com/YunoHost-Apps/lutim_ynh.git
synced 2024-09-03 19:36:24 +02:00
Merge dcb708a559
into 319b7620e0
This commit is contained in:
commit
cb255cb660
5 changed files with 13 additions and 99 deletions
|
@ -9,13 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ACTIVATE MAINTENANCE MODE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
path=$old_path
|
|
||||||
domain=$old_domain
|
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -25,7 +18,7 @@ ynh_maintenance_mode_ON
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..."
|
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
|
# MODIFY URL IN NGINX CONF
|
||||||
|
|
|
@ -54,7 +54,7 @@ ynh_add_nginx_config
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=2
|
ynh_script_progression --message="Adding a configuration file..." --weight=2
|
||||||
|
|
||||||
workers="$(( $(nproc) * 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"
|
chmod 400 "$install_dir/lutim.conf"
|
||||||
chown $app:$app "$install_dir/lutim.conf"
|
chown $app:$app "$install_dir/lutim.conf"
|
||||||
|
@ -63,7 +63,7 @@ chown $app:$app "$install_dir/lutim.conf"
|
||||||
# SETUP CRON
|
# 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
|
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
|
# Create a dedicated systemd config
|
||||||
ynh_add_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)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
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"
|
yunohost service add $app --log="$install_dir/log/production.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -22,37 +22,15 @@ then
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STOP AND REMOVE SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=6
|
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing logrotate configuration..."
|
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC REMOVE
|
|
||||||
#=================================================
|
|
||||||
# REMOVE VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing various files..."
|
|
||||||
|
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
|
|
@ -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"
|
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"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
# Making log a symbolic link to /var/log
|
# Making log a symbolic link to /var/log
|
||||||
|
@ -45,42 +40,15 @@ mkdir -p /var/log/$app/
|
||||||
touch /var/log/$app/production.log
|
touch /var/log/$app/production.log
|
||||||
chown $app -R /var/log/$app
|
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"
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
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"
|
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"
|
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"
|
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
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,12 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -72,14 +66,10 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
then
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
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
|
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
@ -106,7 +96,7 @@ ynh_script_progression --message="Reconfiguring $app..."
|
||||||
if [ $overwrite_settings -eq 1 ]
|
if [ $overwrite_settings -eq 1 ]
|
||||||
then
|
then
|
||||||
workers="$(( $(nproc) * 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"
|
chmod 400 "$install_dir/lutim.conf"
|
||||||
chown $app:$app "$install_dir/lutim.conf"
|
chown $app:$app "$install_dir/lutim.conf"
|
||||||
|
@ -128,20 +118,17 @@ fi
|
||||||
# SETUP CRON
|
# 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
|
# UPDATE LUTIM WITH CARTON
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading $app with Carton..." --weight=4
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
pushd "$install_dir"
|
||||||
then
|
ynh_secure_remove --file="$install_dir/local"
|
||||||
ynh_script_progression --message="Upgrading $app with Carton..." --weight=4
|
carton install --without=mysql --without=htpasswd --without=test
|
||||||
pushd "$install_dir"
|
popd
|
||||||
ynh_secure_remove --file="$install_dir/local"
|
|
||||||
carton install --without=mysql --without=htpasswd --without=test
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
|
Loading…
Add table
Reference in a new issue