Skip to content

Commit

Permalink
[WIP] alpine: support --plain mode
Browse files Browse the repository at this point in the history
Fix issue 3052

- Populate the user account via cloud-init
- Populate /bin/bash (specified as the login shell via user-data. Also depended by the host agent)
- Install sudo (depended by the host agent, during the "boot scripts must have finished" check)

WIP: needs minimization

Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Dec 25, 2024
1 parent 5fb9353 commit 6902100
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/cidata/cidata.TEMPLATE.d/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@ CODE=0
# has run because it might move the directories to /mnt/data on first boot. In that
# case changes made on restart would be lost.

# The boot.essential scripts are executed in plain mode too.
for f in "${LIMA_CIDATA_MNT}"/boot.essential/*.sh; do
INFO "Executing $f"
if ! "$f"; then
WARNING "Failed to execute $f"
CODE=1
fi
done

if [ "$LIMA_CIDATA_PLAIN" = "1" ]; then
INFO "Plain mode. Skipping to run boot scripts. Provisioning scripts will be still executed. Guest agent will not be running."
INFO "Plain mode. Skipping to run non-essential boot scripts. Provisioning scripts will be still executed. Guest agent will not be running."
else
for f in "${LIMA_CIDATA_MNT}"/boot/*; do
INFO "Executing $f"
Expand Down
3 changes: 3 additions & 0 deletions pkg/cidata/cidata.TEMPLATE.d/boot/DO_NOT_ADD_MORE_SCRIPTS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The "essential" scripts are limited to scripts that are essential even in the "plain" mode (`limactl create --plain`).

Do not add more scripts to this `boot.essential` directory, unless they are really essential.
1 change: 1 addition & 0 deletions website/content/en/docs/dev/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ See [Building Ansible inventories](https://docs.ansible.com/ansible/latest/inven
- `lima-guestagent`: Lima guest agent binary
- `nerdctl-full.tgz`: [`nerdctl-full-<VERSION>-<OS>-<ARCH>.tar.gz`](https://github.com/containerd/nerdctl/releases)
- `boot.sh`: Boot script
- `boot.essential/*`: Boot script modules (executed in "plain" mode too)
- `boot/*`: Boot script modules
- `util/*`: Utility command scripts, executed in the boot script modules
- `provision.system/*`: Custom provision scripts (system)
Expand Down

0 comments on commit 6902100

Please sign in to comment.