diff --git a/scripts/change_url b/scripts/change_url index 491a08c..92feab0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -39,6 +39,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # 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" @@ -109,28 +110,8 @@ fi #================================================= ynh_script_progression --message="Updating Jenkins setup..." -ynh_backup_if_checksum_is_different --file="/etc/default/jenkins" - -if [ $change_path -eq 1 ] -then - # Add the path, in case of sub-path installation, into jenkins' boot options - - # Change to root - if [ "$new_path" == "/" ] - then - sed -i "s@--prefix=$old_path@@g" /etc/default/jenkins - # Change to a sub path - else - if ! grep --quiet "prefix=$old_path" /etc/default/jenkins - then - sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$new_path@g" /etc/default/jenkins - else - sed -i "s@--prefix=$old_path@--prefix=$new_path@g" /etc/default/jenkins - fi - fi -fi - -ynh_store_file_checksum --file="/etc/default/jenkins" +ynh_replace_string --match_string="Environment=\"JENKINS_PREFIX=$old_path\"" --replace_string="Environment=\"JENKINS_PREFIX=$new_path\"" --target_file="/lib/systemd/system/jenkins.service" +systemctl daemon-reload --quiet #================================================= # GENERIC FINALISATION