74 lines
2.7 KiB
Bash
74 lines
2.7 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression "Stopping $app's systemd service..."
|
|
|
|
ynh_systemctl --service="$app" --action="stop" --log_path=systemd --wait_until="was stopped successfully"
|
|
|
|
#=================================================
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
#=================================================
|
|
ynh_script_progression "Ensuring downward compatibility..."
|
|
|
|
if [ ! -d "$install_dir/dotnet" ]; then
|
|
# We expect legacy install in /opt
|
|
ynh_safe_rm "/opt/dotnet"
|
|
ynh_safe_rm "/usr/bin/dotnet"
|
|
fi
|
|
|
|
if ynh_app_upgrading_from_version_before_or_equal_to 14.3.0~ynh1; then
|
|
mkdir -p "/var/log/$app"
|
|
mv "$data_dir/logs" "/var/log/$app/dns"
|
|
chown -R "$app:$app" "/var/log/$app"
|
|
ln -sf "/var/log/$app/dns" "$data_dir/logs"
|
|
ln -sf $(ls -t /var/log/$app/dns/*.log | head -n 1) /var/log/$app/$app.log
|
|
ynh_config_add --template="dnsmasq.conf" --destination="/etc/dnsmasq.d/$app.conf"
|
|
ynh_systemctl --service="dnsmasq" --action="restart"
|
|
ynh_hide_warnings yunohost firewall allow Both 53
|
|
fi
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression "Upgrading source files..."
|
|
|
|
ynh_setup_source --source_id="prebuilt" --dest_dir="$install_dir/sources" --full_replace
|
|
ynh_setup_source --source_id="dotnet" --dest_dir="$install_dir/dotnet" --full_replace
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
|
|
|
ynh_config_add_nginx
|
|
|
|
ynh_config_add_systemd
|
|
yunohost service add "$app" --description="Technitium DNS Server" --log="/var/log/$app/$app.log" --needs_exposed_ports=53
|
|
|
|
#=================================================
|
|
# ADD A CRON JOB
|
|
#=================================================
|
|
ynh_config_add --template="logsymlink.cron" --destination="/etc/cron.d/$app"
|
|
chmod 644 "/etc/cron.d/$app"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression "Starting $app's systemd service..."
|
|
|
|
ynh_systemctl --service="$app" --action="start" --log_path=systemd --wait_until="was started successfully"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Upgrade of $app completed"
|