46 lines
1.5 KiB
Text
Executable file
46 lines
1.5 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()
|
|
with runners.create_machine_id_if_needed():
|
|
runners.tmpfiles()
|
|
runners.nsswitch()
|
|
os_release()
|
|
runners.python_alternatives()
|
|
r = subprocess.run(sys.argv[1:], check=False)
|
|
runners.remove_tmpfiles()
|
|
|
|
sys.exit(r.returncode)
|