]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - test/sys-script.py
core: use id unit when retrieving unit file state (#8038)
[thirdparty/systemd.git] / test / sys-script.py
index a9c0046667c8e354a62fc28fb351a4a7375731ec..468c1dc9724910c7919bba72aea51c9be2be5ea2 100755 (executable)
@@ -1,4 +1,5 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
+# SPDX-License-Identifier: LGPL-2.1+
 #
 # sys-script.py
 #
@@ -20,6 +21,7 @@
 #
 
 import os, sys
+import shutil
 
 def d(path, mode):
     os.mkdir(path, mode)
@@ -32,7 +34,6 @@ def f(path, mode, contents):
         f.write(contents)
     os.chmod(path, mode)
 
-
 if len(sys.argv) < 2:
     exit("Usage: {} <target dir>".format(sys.argv[0]))
 
@@ -41,6 +42,8 @@ if not os.path.isdir(sys.argv[1]):
 
 os.chdir(sys.argv[1])
 
+if os.path.exists('sys'):
+    shutil.rmtree('sys')
 d('sys', 0o755)
 d('sys/kernel', 0o775)
 f('sys/kernel/kexec_crash_loaded', 0o664, b'0\n')