diff --git a/pkg/cidata/cidata.TEMPLATE.d/boot/00-alpine-user-group.sh b/pkg/cidata/cidata.TEMPLATE.d/boot.essential/00-alpine-user-group.sh similarity index 100% rename from pkg/cidata/cidata.TEMPLATE.d/boot/00-alpine-user-group.sh rename to pkg/cidata/cidata.TEMPLATE.d/boot.essential/00-alpine-user-group.sh diff --git a/pkg/cidata/cidata.TEMPLATE.d/boot/01-alpine-ash-as-bash.sh b/pkg/cidata/cidata.TEMPLATE.d/boot.essential/01-alpine-ash-as-bash.sh similarity index 100% rename from pkg/cidata/cidata.TEMPLATE.d/boot/01-alpine-ash-as-bash.sh rename to pkg/cidata/cidata.TEMPLATE.d/boot.essential/01-alpine-ash-as-bash.sh diff --git a/pkg/cidata/cidata.TEMPLATE.d/boot/10-alpine-prep.sh b/pkg/cidata/cidata.TEMPLATE.d/boot.essential/10-alpine-prep.sh similarity index 100% rename from pkg/cidata/cidata.TEMPLATE.d/boot/10-alpine-prep.sh rename to pkg/cidata/cidata.TEMPLATE.d/boot.essential/10-alpine-prep.sh diff --git a/pkg/cidata/cidata.TEMPLATE.d/boot.sh b/pkg/cidata/cidata.TEMPLATE.d/boot.sh index ab65c7192b7..404ad528efc 100644 --- a/pkg/cidata/cidata.TEMPLATE.d/boot.sh +++ b/pkg/cidata/cidata.TEMPLATE.d/boot.sh @@ -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" diff --git a/pkg/cidata/cidata.TEMPLATE.d/boot/DO_NOT_ADD_MORE_SCRIPTS.txt b/pkg/cidata/cidata.TEMPLATE.d/boot/DO_NOT_ADD_MORE_SCRIPTS.txt new file mode 100644 index 00000000000..7ec1d4e2b8b --- /dev/null +++ b/pkg/cidata/cidata.TEMPLATE.d/boot/DO_NOT_ADD_MORE_SCRIPTS.txt @@ -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. diff --git a/website/content/en/docs/dev/internals.md b/website/content/en/docs/dev/internals.md index 53701be3a31..ad94d42de59 100644 --- a/website/content/en/docs/dev/internals.md +++ b/website/content/en/docs/dev/internals.md @@ -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---.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)