From f951a4931ef50d05b00b2dd79407ab31634613b3 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Tue, 12 Oct 2021 20:53:45 +0000 Subject: [PATCH] runners: add rhel7 runner Create a runner for RHEL7. The one thing to note is that RHEL 7 makes use of ld.so.confd snippets and one important for us is to include `/usr/lib64/iscsi` needed by qemu-img. Otherwise this is a fairly simple and straight forward runner. --- runners/org.osbuild.rhel7 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 runners/org.osbuild.rhel7 diff --git a/runners/org.osbuild.rhel7 b/runners/org.osbuild.rhel7 new file mode 100755 index 00000000..9399a6c2 --- /dev/null +++ b/runners/org.osbuild.rhel7 @@ -0,0 +1,35 @@ +#!/usr/bin/python3 + +import os +import subprocess +import sys + +import osbuild.api + + +def ldconfig(): + # ld.so.conf must exist, or `ldconfig` throws a warning + with open("/etc/ld.so.conf", "w", ) as f: + # qemu-img needs `libiscsi`, which is located in /usr/lib64/iscsi + f.write("/usr/lib64/iscsi\n") + f.flush() + subprocess.run(["ldconfig"], check=True) + + +def nsswitch(): + # the default behavior is fine, but using nss-resolve does not + # necessarily work in a non-booted container, so make sure that + # is not configured. + try: + os.remove("/etc/nsswitch.conf") + except FileNotFoundError: + pass + + +if __name__ == "__main__": + with osbuild.api.exception_handler(): + ldconfig() + nsswitch() + + r = subprocess.run(sys.argv[1:], check=False) + sys.exit(r.returncode)