refactor: self-contained install functions in first-boot.sh#48
Merged
Shmayro merged 1 commit intoMay 29, 2026
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 was referenced May 29, 2026
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.
Follow-up to #41. Cleans up the addon orchestration in
first-boot.shso each install function is fully self-contained and the post-first-boot flow is correct by construction.Why
In the current code:
install_gappsdoesn't reboot itself — it relies on a sibling helperneeds_reboot()that checks "is anything else about to reboot for me?".install_arm_translationcallsadb rebootand then immediatelytouch /data/.arm-translation-done.adb rebootreturns the moment the command is accepted by adbd, not when reboot completes — so the marker is set while the system is 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.
Stacked on
This branch is based on
copilot/add-arm64-support(#41). PR base is set to that branch so the diff shows only the refactor; once #41 merges, the base will switch tomainautomatically.