generator: Fix .service/.mount service installation 85/298485/2
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 7 Sep 2023 12:15:43 +0000 (14:15 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 7 Sep 2023 14:12:53 +0000 (16:12 +0200)
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
src/systemd_generator/isu-generator

index a2c0c53..84353ad 100644 (file)
@@ -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
index 5c16f6e..e8607e7 100755 (executable)
@@ -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