mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 11:36:32 +01:00
fix(resume): preserve stage0-image incremental continuation by remapping init entry after script regeneration
This commit is contained in:
parent
b18cba40b3
commit
adcd73b017
1 changed files with 20 additions and 2 deletions
22
rootfs.py
22
rootfs.py
|
|
@ -194,14 +194,32 @@ legacy_network_block = (
|
|||
)
|
||||
regen_block = (
|
||||
regen_marker + "\\n"
|
||||
+ 'resume_entry=""\\n'
|
||||
+ 'resume_root=""\\n'
|
||||
+ 'resume_pkg=""\\n'
|
||||
+ 'if [ -f "$0" ]; then\\n'
|
||||
+ 'resume_entry="$(sed -n \'s/.*bash \\\\(\\\\/steps[^ ]*\\\\/[0-9][0-9]*\\\\.sh\\\\).*/\\\\1/p\' "$0" | head -n1)"\\n'
|
||||
+ 'fi\\n'
|
||||
+ 'if [ -n "${resume_entry}" ]; then\\n'
|
||||
+ 'resume_root="$(dirname "${resume_entry}")"\\n'
|
||||
+ 'if [ -f "${resume_entry}" ]; then\\n'
|
||||
+ 'resume_pkg="$(sed -n \'s/^build \\\\([^ ]*\\\\) .*/\\\\1/p\' "${resume_entry}" | head -n1)"\\n'
|
||||
+ 'fi\\n'
|
||||
+ 'fi\\n'
|
||||
+ 'if [ -x /script-generator ] && [ -f /steps/manifest ]; then\\n'
|
||||
+ '/script-generator /steps/manifest\\n'
|
||||
+ 'fi\\n'
|
||||
+ 'if [ -x /script-generator ] && [ -f /steps-guix/manifest ]; then\\n'
|
||||
+ '/script-generator /steps-guix/manifest /steps\\n'
|
||||
+ 'fi\\n'
|
||||
+ 'if [ -f /steps-guix/0.sh ] && grep -Eq "/steps-guix/[1-9][0-9]*\\\\.sh" "$0"; then\\n'
|
||||
+ 'if ! bash /steps-guix/0.sh; then\\n'
|
||||
+ 'if [ -n "${resume_pkg}" ] && [ -d "${resume_root}" ]; then\\n'
|
||||
+ 'mapped_entry="$(grep -F -l "build ${resume_pkg} " "${resume_root}"/[0-9]*.sh 2>/dev/null | head -n1 || true)"\\n'
|
||||
+ 'if [ -n "${mapped_entry}" ]; then\\n'
|
||||
+ 'resume_entry="${mapped_entry}"\\n'
|
||||
+ 'fi\\n'
|
||||
+ 'fi\\n'
|
||||
+ 'if [ -n "${resume_entry}" ] && [ -f "${resume_entry}" ] && [ "${resume_entry}" != "$0" ]; then\\n'
|
||||
+ 'if ! bash "${resume_entry}"; then\\n'
|
||||
+ 'status=$?\\n'
|
||||
+ 'echo "bootstrap script failed with status ${status}; dropping to rescue shell" >&2\\n'
|
||||
+ 'PATH=/bin:/usr/bin:/sbin:/usr/sbin:${PREFIX}/bin:${PATH}\\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue