]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test/TEST-15: remove all created unit files
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 21 Mar 2020 15:30:27 +0000 (16:30 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 28 Mar 2020 10:46:47 +0000 (11:46 +0100)
We would miss anything created under a template instance.

test/units/testsuite-15.sh

index c1d640a31c6a2983aa0388da13b5e447bf123a83..b09b6a12837858e04f5f30b847cf97908eac3b4b 100755 (executable)
@@ -7,6 +7,12 @@ _clear_service () {
     rm -f  /{etc,run,usr/lib}/systemd/system/$1.service
     rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.d
     rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.{wants,requires}
+    if [[ $1 == *@ ]]; then
+        systemctl stop $1*.service 2>/dev/null || :
+        rm -f  /{etc,run,usr/lib}/systemd/system/$1*.service
+        rm -fr /{etc,run,usr/lib}/systemd/system/$1*.service.d
+        rm -fr /{etc,run,usr/lib}/systemd/system/$1*.service.{wants,requires}
+    fi
 }
 
 clear_services () {