stages/rpm: convert the mount code to python
Convert the code that sets up the bind mounts to /dev, /sys/ and /proc from a bash script to python by using the new mount helper that were moved from the `objectstore`.
This commit is contained in:
parent
8f95154a8c
commit
776bab46ae
1 changed files with 5 additions and 9 deletions
|
|
@ -41,6 +41,7 @@ import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
|
from osbuild.util.mnt import mount
|
||||||
from osbuild import api
|
from osbuild import api
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -276,18 +277,13 @@ def main(tree, inputs, options):
|
||||||
filename
|
filename
|
||||||
], cwd=pkgpath, stdout=subprocess.DEVNULL, check=True)
|
], cwd=pkgpath, stdout=subprocess.DEVNULL, check=True)
|
||||||
|
|
||||||
script = f"""
|
for source in ("/dev", "/sys", "/proc"):
|
||||||
set -e
|
target = os.path.join(tree, source.lstrip("/"))
|
||||||
mkdir -p {tree}/dev {tree}/sys {tree}/proc
|
os.makedirs(target, exist_ok=True)
|
||||||
mount -o bind /dev {tree}/dev
|
mount(source, target, ro=False)
|
||||||
mount -o bind /sys {tree}/sys
|
|
||||||
mount -o bind /proc {tree}/proc
|
|
||||||
"""
|
|
||||||
|
|
||||||
machine_id_created = create_machine_id_if_needed(tree)
|
machine_id_created = create_machine_id_if_needed(tree)
|
||||||
|
|
||||||
subprocess.run(["/bin/sh", "-c", script], check=True)
|
|
||||||
|
|
||||||
extra_args = []
|
extra_args = []
|
||||||
|
|
||||||
if options.get("exclude", {}).get("docs"):
|
if options.get("exclude", {}).get("docs"):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue