From 88478438e18015995e883d470810032fdf52fd05 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Thu, 7 Sep 2023 14:15:43 +0200 Subject: [PATCH] generator: Fix .service/.mount service installation This commit fixes cases where service provided .mount but not .service unit. Previously .mount unit would not be installed due to isu_prepare() terminating early. Additionally, this commit silents the warning when .mount unit is not provided as it's rarely used feature. Change-Id: I40da3ec35deed3023ad15664379f2c07237665b8 --- packaging/isu.spec | 2 +- src/systemd_generator/isu-generator | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packaging/isu.spec b/packaging/isu.spec index a2c0c53..84353ad 100644 --- a/packaging/isu.spec +++ b/packaging/isu.spec @@ -1,6 +1,6 @@ Summary: Individual Service Upgrade support Name: isu -Version: 8.0.7 +Version: 8.0.8 Release: 1 Source0: %{name}-%{version}.tar.gz License: MIT diff --git a/src/systemd_generator/isu-generator b/src/systemd_generator/isu-generator index 5c16f6e..e8607e7 100755 --- a/src/systemd_generator/isu-generator +++ b/src/systemd_generator/isu-generator @@ -158,12 +158,7 @@ isu_prepare() return 1 fi - if ! compgen -G "${isu_pkg_dir}/${ISU_SERVICES_DIR}/*.service"; then - echo "There are no $INSTANCE services in $isu_pkg_dir" - return 0 - fi - - for srv_path in "${isu_pkg_dir}/${ISU_SERVICES_DIR}"/*.service; do + for srv_path in $(compgen -G "${isu_pkg_dir}/${ISU_SERVICES_DIR}"/*.service); do if ! test -r "$srv_path"; then echo "Service file $srv_path not readable. Skipping" @@ -173,8 +168,9 @@ isu_prepare() install_units "$srv_path" "$isu_pkg_name" done - for unit_path in "${isu_pkg_dir}/${ISU_SERVICES_DIR}"/*.mount; do - if ! test -r "$unit_path"; then + for unit_path in $(compgen -G "${isu_pkg_dir}/${ISU_SERVICES_DIR}"/*.mount); do + + if ! test -r "$unit_path"; then echo "Unit file $unit_path not readable. Skipping" continue fi -- 2.7.4