mirror of
https://github.com/YunoHost-Apps/airsonic_ynh.git
synced 2024-09-03 18:06:14 +02:00
Fix
This commit is contained in:
parent
0512e59a0e
commit
b5583fa5f3
3 changed files with 30 additions and 11 deletions
|
@ -28,7 +28,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||
#service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
@ -60,7 +60,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
ynh_backup --src_path="$service_config"
|
||||
ynh_backup --src_path="/etc/default/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP DATA
|
||||
|
|
|
@ -28,9 +28,26 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||
# service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
@ -95,14 +112,16 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=3
|
|||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$service_config"
|
||||
# ynh_backup_if_checksum_is_different --file="$service_config"
|
||||
|
||||
# Copy config. template to right location
|
||||
cp ../conf/systemd-sysconfig $service_config
|
||||
# cp ../conf/systemd-sysconfig $service_config
|
||||
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="$service_config"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string=$port --target_file="$service_config"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$service_config"
|
||||
# ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="$service_config"
|
||||
# ynh_replace_string --match_string="__PORT__" --replace_string=$port --target_file="$service_config"
|
||||
# ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target_file="$service_config"
|
||||
|
||||
ynh_add_config --template="../conf/systemd-sysconfig" --destination="/etc/default/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
@ -111,7 +130,7 @@ ynh_replace_string --match_string="__PATH__" --replace_string=$path_url --target
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=12
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in"
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path="$final_path/airsonic.log" --line_match="Started Application in"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -30,7 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||
#service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -108,7 +108,7 @@ chown $app: $final_path/transcode
|
|||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
ynh_restore_file --origin_path="$service_config"
|
||||
ynh_restore_file --origin_path="/etc/default/$app"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue