diff --git a/conf/systemd.service b/conf/systemd.service index a53deac..bd24e65 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,8 +6,8 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__INSTALL_DIR__/ -ExecStart=/usr/bin/dotnet __INSTALL_DIR__/DnsServerApp.dll __DATA_DIR__ +WorkingDirectory=__INSTALL_DIR__/sources/ +ExecStart=__INSTALL_DIR__/dotnet/dotnet __INSTALL_DIR__/sources/DnsServerApp.dll __DATA_DIR__ Restart=always # Restart service after 10 seconds if the dotnet service crashes: RestartSec=10 diff --git a/scripts/backup b/scripts/backup index ebc296c..854fbd2 100755 --- a/scripts/backup +++ b/scripts/backup @@ -13,12 +13,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_print_info --message="Declaring files to be backed up..." -#================================================= -# BACKUP DOTNET -#================================================= - -ynh_backup --src_path="/opt/dotnet" - #================================================= # BACKUP THE APP MAIN DIR #================================================= diff --git a/scripts/change_url b/scripts/change_url index e05cb74..86844b3 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping $app's systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # MODIFY URL IN NGINX CONF @@ -24,7 +24,7 @@ ynh_change_url_nginx_config #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" diff --git a/scripts/install b/scripts/install index f843eb7..0365115 100755 --- a/scripts/install +++ b/scripts/install @@ -7,25 +7,14 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# INSTALL DOTNET -#================================================= -ynh_script_progression --message="Installing dotnet..." --weight=1 - -ynh_setup_source --source_id=dotnet --dest_dir="/opt/dotnet" - -chmod -R o-rwx "/opt/dotnet" -chown -R "$app:www-data" "/opt/dotnet" - -ln -sf /opt/dotnet/dotnet /usr/bin - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir/sources" +ynh_setup_source --source_id="dotnet" --dest_dir="$install_dir/dotnet" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" diff --git a/scripts/remove b/scripts/remove index 0300c9c..9c8fd25 100755 --- a/scripts/remove +++ b/scripts/remove @@ -29,14 +29,6 @@ ynh_remove_nginx_config # Remove the log files ynh_secure_remove --file="/var/log/$app" -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing Dotnet..." --weight=1 - -ynh_secure_remove --file="/usr/bin/dotnet" -ynh_secure_remove --file="/opt/dotnet" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 3107f00..d23c4e5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -8,14 +8,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# RESTORE DOTNET -#================================================= -ynh_script_progression --message="Restoring dotnet..." - -ynh_restore_file --origin_path="/opt/dotnet" -ln -sf /opt/dotnet/dotnet /usr/bin - #================================================= # RESTORE THE APP MAIN DIR #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d3f5c22..315b835 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,26 +10,20 @@ source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression --message="Stopping $app's systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -# ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -#================================================= -# INSTALL DOTNET -#================================================= -ynh_script_progression --message="Updating dotnet..." --weight=1 - -ynh_setup_source --source_id=dotnet --dest_dir="/opt/dotnet" --full_replace=1 - -chmod -R o-rwx "/opt/dotnet" -chown -R "$app:www-data" "/opt/dotnet" - -ln -sf /opt/dotnet/dotnet /usr/bin +if [ ! -d "$install_dir/dotnet" ]; then + # We expect legacy install in /opt + ynh_secure_remove --file="/opt/dotnet" + ynh_secure_remove --file="/usr/bin/dotnet" +fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -37,7 +31,8 @@ ln -sf /opt/dotnet/dotnet /usr/bin ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir/source" --full_replace=1 +ynh_setup_source --source_id="dotnet" --dest_dir="$install_dir/dotnet" --full_replace=1 chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir"