From 1a348ef176c5254f05b0949e7a9bfd80699198db Mon Sep 17 00:00:00 2001 From: CodeShakingSheep <19874562+CodeShakingSheep@users.noreply.github.com> Date: Thu, 28 Dec 2023 23:07:11 +0100 Subject: [PATCH] Update restore --- scripts/restore | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 8dff3e5..f79172b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -78,12 +78,17 @@ ynh_script_progression --message="Installing Jenkins..." # Download jenkins deb file and install it. ynh_setup_source --dest_dir="../conf" -dpkg --install --force-confnew ../conf/jenkins.deb +dpkg --install --force-confnew ../conf/jenkins.deb || true +dpkg_install_failed=$(dpkg-query -f '${status} ${package}\n' -W | awk '$4 ~ /^jenkins.*/ && $3 != "installed" {print $4}' | wc -l) + +if [[ $dpkg_install_failed -ge 1 ]]; then + ynh_print_warn --message="The service jenkins cannot be started for now." +fi #================================================= # SETUP APPLICATION #================================================= -ynh_script_progression --message="Setuping application..." +ynh_script_progression --message="Setuping application on port $port..." ynh_replace_string --match_string="Environment=\"JENKINS_PORT=8080\"" --replace_string="Environment=\"JENKINS_PORT=$port\"\nEnvironment=\"JENKINS_PREFIX=$path_url\"" --target_file="/lib/systemd/system/jenkins.service" @@ -91,6 +96,10 @@ systemctl daemon-reload --quiet ynh_systemd_action --service_name=$app --action="restart" --line_match="Started" --log_path="systemd" +if [[ $dpkg_install_failed -ge 1 ]]; then + dpkg --configure -a +fi + #================================================= # RESTORE THE APP MAIN DIR #=================================================