refactor: self-contained install functions in first-boot.sh#50
Merged
Conversation
Each install (gapps, root, arm_translation) is now responsible for its own reboot + wait + done-marker sequence, in that order. The marker is only written once adbd has come back, so a container killed mid-reboot won't leave a "marked done but not applied" state. - Drop the needs_reboot() helper; the reboot decision is now local to each install function instead of crossing function boundaries. - Collapse the duplicate first-boot / post-first-boot branches in main into one path — only AVD creation is conditional on /data/.first-boot-done. - install_gapps and install_arm_translation now end with 'adb reboot; adb wait-for-device; touch .<addon>-done', so they are safe to invoke standalone after the initial first boot when a flag is flipped on a previously initialized container. One extra AVD reboot occurs in the rare case where both GAPPS and ARM_TRANSLATION are enabled in the same pass (~25s), traded for the cleaner per-function encapsulation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-targets the refactor work from #48 onto
main. #48 was originally opened againstcopilot/add-arm64-supportas part of a stacked PR chain and got merged into that intermediate branch instead ofmain— so its content never landed.Same commit as #48 (cherry-picked unchanged), now properly targeting
main.Why
In the previous
first-boot.sh:install_gappsdidn't reboot itself — it relied on a sibling helperneeds_reboot()to decide whether a subsequent install would reboot for it.install_arm_translationcalledadb rebootand then immediatelytouch /data/.arm-translation-done.adb rebootreturns the moment the command is accepted by adbd, not when reboot completes — so the marker was set while the system was still rebooting. A container killed in that window leaves a "marked done but not actually applied" state on next start.Changes
adb wait-for-device→ marker in that order, so the marker only lands once adbd has come back.needs_reboot()removed — the reboot decision is now local to each install function rather than crossing function boundaries.avdmanager create avdis conditional on/data/.first-boot-done.ARM_TRANSLATION=1on a container that already booted: restart the container and the upper-branch install runs cleanly to completion.Cost
One extra AVD reboot (~25s) in the rare case where both GAPPS and ARM_TRANSLATION are enabled in the same pass, traded for cleaner per-function encapsulation.
Supersedes
main)