Update bwrap bootstrap code to match the simplify refactor
This commit is contained in:
parent
1481ad0d20
commit
f66f9efa2c
17
rootfs.py
17
rootfs.py
|
@ -15,7 +15,6 @@ you can run bootstap inside chroot.
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import shutil
|
|
||||||
|
|
||||||
from lib.utils import run, run_as_root
|
from lib.utils import run, run_as_root
|
||||||
from lib.tmpdir import Tmpdir
|
from lib.tmpdir import Tmpdir
|
||||||
|
@ -32,7 +31,7 @@ def create_configuration_file(args):
|
||||||
config.write(f"CHROOT={args.chroot or args.bwrap}\n")
|
config.write(f"CHROOT={args.chroot or args.bwrap}\n")
|
||||||
config.write(f"UPDATE_CHECKSUMS={args.update_checksums}\n")
|
config.write(f"UPDATE_CHECKSUMS={args.update_checksums}\n")
|
||||||
config.write(f"JOBS={args.cores}\n")
|
config.write(f"JOBS={args.cores}\n")
|
||||||
config.write(f"INTERNAL_CI={args.internal_ci}\n")
|
config.write(f"INTERNAL_CI={args.internal_ci or False}\n")
|
||||||
config.write(f"BARE_METAL={args.bare_metal}\n")
|
config.write(f"BARE_METAL={args.bare_metal}\n")
|
||||||
if (args.bare_metal or args.qemu) and not args.kernel:
|
if (args.bare_metal or args.qemu) and not args.kernel:
|
||||||
if args.repo or args.external_sources:
|
if args.repo or args.external_sources:
|
||||||
|
@ -195,7 +194,7 @@ print(shutil.which('chroot'))
|
||||||
run('bwrap', '--unshare-user',
|
run('bwrap', '--unshare-user',
|
||||||
'--uid', '0',
|
'--uid', '0',
|
||||||
'--gid', '0',
|
'--gid', '0',
|
||||||
'--unshare-net',
|
'--unshare-net' if args.external_sources else None,
|
||||||
'--clearenv',
|
'--clearenv',
|
||||||
'--setenv', 'PATH', '/usr/bin',
|
'--setenv', 'PATH', '/usr/bin',
|
||||||
'--bind', generator.tmp_dir, '/',
|
'--bind', generator.tmp_dir, '/',
|
||||||
|
@ -206,19 +205,21 @@ print(shutil.which('chroot'))
|
||||||
'--dev-bind', '/dev/urandom', '/dev/urandom',
|
'--dev-bind', '/dev/urandom', '/dev/urandom',
|
||||||
'--dev-bind', '/dev/ptmx', '/dev/ptmx',
|
'--dev-bind', '/dev/ptmx', '/dev/ptmx',
|
||||||
'--dev-bind', '/dev/tty', '/dev/tty',
|
'--dev-bind', '/dev/tty', '/dev/tty',
|
||||||
|
'--tmpfs', '/dev/shm',
|
||||||
|
'--proc', '/proc',
|
||||||
|
'--bind', '/sys', '/sys',
|
||||||
|
'--tmpfs', '/tmp',
|
||||||
init)
|
init)
|
||||||
|
|
||||||
if not args.internal_ci or args.internal_ci == "pass2" or args.internal_ci == "pass3":
|
if args.internal_ci in ("pass2", "pass3"):
|
||||||
os.makedirs(os.path.join(generator.tmp_dir, 'stage2', 'steps'), exist_ok=True)
|
generator.reuse(tmpdir)
|
||||||
shutil.copy2(os.path.join('steps', 'bootstrap.cfg'),
|
|
||||||
os.path.join(generator.tmp_dir, 'stage2', 'steps', 'bootstrap.cfg'))
|
|
||||||
run('bwrap', '--unshare-user',
|
run('bwrap', '--unshare-user',
|
||||||
'--uid', '0',
|
'--uid', '0',
|
||||||
'--gid', '0',
|
'--gid', '0',
|
||||||
'--unshare-net' if args.external_sources else None,
|
'--unshare-net' if args.external_sources else None,
|
||||||
'--clearenv',
|
'--clearenv',
|
||||||
'--setenv', 'PATH', '/usr/bin',
|
'--setenv', 'PATH', '/usr/bin',
|
||||||
'--bind', os.path.join(generator.tmp_dir, "stage2"), '/',
|
'--bind', generator.tmp_dir, '/',
|
||||||
'--dir', '/dev',
|
'--dir', '/dev',
|
||||||
'--dev-bind', '/dev/null', '/dev/null',
|
'--dev-bind', '/dev/null', '/dev/null',
|
||||||
'--dev-bind', '/dev/zero', '/dev/zero',
|
'--dev-bind', '/dev/zero', '/dev/zero',
|
||||||
|
|
Loading…
Reference in New Issue