debian-forge/runners/org.osbuild.rhel81
Miguel Martín 9cece6b4a0 Consolidate runners functions
Consolidate runners functions into a sigle file
to avoid code duplication.
2023-11-20 18:02:12 +01:00

44 lines
1.4 KiB
Text
Executable file

#!/usr/libexec/platform-python
import os
import subprocess
import sys
from osbuild import api
from osbuild.util import runners
def os_release():
"""/usr/lib/os-release doesn't exist. The `redhat-release` package
generates `/etc/os-release directly. To work around this, do the same here.
https://bugzilla.redhat.com/show_bug.cgi?id=1766754
"""
# remove the symlink that systemd-nspawn creates
os.remove("/etc/os-release")
with open("/etc/os-release", "w", encoding="utf8") as f:
f.write('NAME="Red Hat Enterprise Linux"\n')
f.write('VERSION="8.1 (Ootpa)"\n')
f.write('ID="rhel"\n')
f.write('ID_LIKE="fedora"\n')
f.write('VERSION_ID="8.1"\n')
f.write('PLATFORM_ID="platform:el8"\n')
f.write('PRETTY_NAME="Red Hat Enterprise Linux 8.1 (Ootpa)"\n')
f.write('ANSI_COLOR="0;31"\n')
f.write('CPE_NAME="cpe:/o:redhat:enterprise_linux:8.1:GA"\n')
f.write('HOME_URL="https://www.redhat.com/"\n')
f.write('BUG_REPORT_URL="https://bugzilla.redhat.com/"\n')
if __name__ == "__main__":
with api.exception_handler():
runners.ldconfig()
runners.sysusers()
runners.tmpfiles()
runners.nsswitch()
os_release()
runners.python_alternatives()
r = subprocess.run(sys.argv[1:], check=False)
sys.exit(r.returncode)