]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-64-UDEV-STORAGE: Check for tgt and tgtd services
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 13 May 2024 13:08:07 +0000 (15:08 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 14 May 2024 10:43:28 +0000 (12:43 +0200)
On Debian/Ubuntu, the unit is named tgt.service instead of tgtd.service,
so let's make sure we take that into account.

On CentOS, tgtd.service is not available, so let's skip the test if we
can't find the service.

test/units/TEST-64-UDEV-STORAGE.sh

index 728d57cb3f5e01d755263ec34ba7d83f7934275c..aed322fe85f8978e7103397dccc85c0cc7f42793 100755 (executable)
@@ -850,9 +850,17 @@ testcase_iscsi_lvm() {
 
     ls -l "${devices[@]}"
 
-    # Start the target daemon
-    systemctl start tgtd
-    systemctl status tgtd
+    # Start the target daemon (debian names it tgt.service so make sure we handle that)
+    if systemctl list-unit-files tgt.service; then
+        systemctl start tgt
+        systemctl status tgt
+    elif systemctl list-unit-files tgtd.service; then
+        systemctl start tgtd
+        systemctl status tgtd
+    else
+        echo "This test requires tgtd but it is not installed, skipping ..." | tee --append /skipped
+        exit 77
+    fi
 
     echo "iSCSI LUNs backed by devices"
     # See RFC3721 and RFC7143