debian-forge/osbuild-run
Lars Karlitski 00f4e6ed8b osbuild-run: generate /etc/pki/tls/certs/ca-bundle.crt
There's no need to bind mount the full /etc/pki from the host. This file
can be generated from /usr.
2019-07-19 13:31:49 +02:00

29 lines
934 B
Python
Executable file

#!/usr/bin/python3
import os
import subprocess
import sys
# ld.so.conf must exist, or `ldconfig` throws a warning
subprocess.run(["touch", "/etc/ld.so.conf"], check=True)
subprocess.run(["ldconfig"], check=True)
try:
subprocess.run(["systemd-sysusers"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True)
except subprocess.CalledProcessError as error:
sys.stderr.write(error.stdout)
sys.exit(1)
# generate /etc/pki/tls/certs/ca-bundle.crt
os.makedirs("/etc/pki/ca-trust/extracted/pem")
os.makedirs("/etc/pki/tls/certs")
os.symlink("/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem", "/etc/pki/tls/certs/ca-bundle.crt")
subprocess.run(["update-ca-trust"])
# Allow systemd-tmpfiles to return non-0. Some packages want to create
# directories owned by users that are not set up with systemd-sysusers.
subprocess.run(["systemd-tmpfiles", "--create"])
r = subprocess.run(sys.argv[1:])
sys.exit(r.returncode)