2019-08-05 01:29:15 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD MODIFICATIONS
|
|
|
|
#=================================================
|
|
|
|
# STOP SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2020-12-01 22:04:05 +01:00
|
|
|
ynh_script_progression --message="Stopping a systemd service..."
|
2019-08-05 01:29:15 +02:00
|
|
|
|
2023-10-24 11:25:44 +02:00
|
|
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
2019-08-05 01:29:15 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY URL IN NGINX CONF
|
|
|
|
#=================================================
|
2020-12-01 22:04:05 +01:00
|
|
|
ynh_script_progression --message="Updating NGINX web server configuration..."
|
2019-08-05 01:29:15 +02:00
|
|
|
|
2023-06-22 09:09:24 +02:00
|
|
|
ynh_change_url_nginx_config
|
|
|
|
|
2019-08-05 01:29:15 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC MODIFICATIONS
|
|
|
|
#=================================================
|
2020-03-21 14:04:37 +01:00
|
|
|
# MODIFY A CONFIG FILE
|
2019-08-05 01:29:15 +02:00
|
|
|
#=================================================
|
2020-12-01 22:04:05 +01:00
|
|
|
ynh_script_progression --message="Modifying a config file..."
|
2020-03-21 14:04:37 +01:00
|
|
|
|
2023-10-22 18:52:48 +02:00
|
|
|
ynh_add_config --template="vaultwarden.env" --destination="$install_dir/live/.env"
|
2020-03-21 14:04:37 +01:00
|
|
|
|
2023-10-22 18:52:48 +02:00
|
|
|
chmod 400 "$install_dir/live/.env"
|
|
|
|
chown $app:$app "$install_dir/live/.env"
|
2020-03-21 14:04:37 +01:00
|
|
|
|
2023-10-22 18:52:48 +02:00
|
|
|
#ynh_backup_if_checksum_is_different --file="$install_dir/live/.env"
|
|
|
|
|
|
|
|
#ynh_replace_string --match_string="DOMAIN=https://$old_domain$old_path" --replace_string="DOMAIN=https://$new_domain$new_path" --target_file="$install_dir/live/.env"
|
2020-03-21 14:04:37 +01:00
|
|
|
|
|
|
|
# Recalculate and store the checksum of the file for the next upgrade.
|
2023-10-22 18:52:48 +02:00
|
|
|
#ynh_store_file_checksum --file="$install_dir/live/.env"
|
2019-08-05 01:29:15 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALISATION
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2020-12-01 22:04:05 +01:00
|
|
|
ynh_script_progression --message="Starting a systemd service..."
|
2019-08-05 01:29:15 +02:00
|
|
|
|
2020-12-01 22:04:05 +01:00
|
|
|
# Start a systemd service
|
2020-01-21 23:03:55 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" --length=100
|
2019-08-05 01:29:15 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-12-01 22:04:05 +01:00
|
|
|
ynh_script_progression --message="Change of URL completed for $app"
|