mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 11:36:32 +01:00
fix(stage0-resume): wrap jump-resume init with dhcpcd bring-up before continuing scripts
This commit is contained in:
parent
35a570bc4e
commit
84400964ed
1 changed files with 27 additions and 0 deletions
27
rootfs.py
27
rootfs.py
|
|
@ -74,6 +74,7 @@ def update_stage0_image(image_path,
|
|||
mounted = True
|
||||
script = '''
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
|
|
@ -108,6 +109,32 @@ lines.append("PAYLOAD_REQUIRED=False\\n")
|
|||
with open(config_path, "w", encoding="utf-8") as cfg:
|
||||
cfg.writelines(lines)
|
||||
|
||||
# Resumed jump init scripts look like "bash /steps*/N.sh" and miss network bring-up.
|
||||
# Wrap only that form to keep normal /init behavior unchanged.
|
||||
init_path = os.path.join(mountpoint, "init")
|
||||
if os.path.isfile(init_path):
|
||||
with open(init_path, "r", encoding="utf-8") as init_file:
|
||||
init_text = init_file.read()
|
||||
|
||||
if "dhcpcd --waitip=4" not in init_text:
|
||||
resume_match = re.search(
|
||||
r"^\\s*bash\\s+(/(?:steps|steps-guix)/[0-9]+\\.sh)\\s*$",
|
||||
init_text,
|
||||
re.MULTILINE,
|
||||
)
|
||||
if resume_match:
|
||||
resume_script = resume_match.group(1)
|
||||
wrapped_init = f"""#!/usr/bin/bash
|
||||
set -e
|
||||
if command -v dhcpcd >/dev/null 2>&1; then
|
||||
dhcpcd --waitip=4 || true
|
||||
fi
|
||||
exec bash {resume_script}
|
||||
"""
|
||||
with open(init_path, "w", encoding="utf-8") as init_file:
|
||||
init_file.write(wrapped_init)
|
||||
os.chmod(init_path, 0o755)
|
||||
|
||||
if build_guix_also:
|
||||
dest_steps_guix = os.path.join(mountpoint, "steps-guix")
|
||||
has_resume_scripts = False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue