Bake mise into default VM images
New VMs should have mise available without a per-VM bootstrap step, and the activation needs to work in the default root bash workflow. Install a pinned mise binary during both the Go-native image build path and the customize.sh rootfs rebuild path, then enable bash activation through /etc/profile.d for login shells and /etc/bash.bashrc for interactive shells. Add a regression around the generated provisioning script and validate with bash -n customize.sh, go test ./..., and make build. Rebuilding the default rootfs is still required before future default-image VMs pick up the change.
This commit is contained in:
parent
7b7f7e676c
commit
ff8482b841
3 changed files with 64 additions and 0 deletions
15
customize.sh
15
customize.sh
|
|
@ -103,6 +103,9 @@ BASE_ROOTFS=""
|
|||
OUT_ROOTFS=""
|
||||
SIZE_SPEC=""
|
||||
INSTALL_DOCKER=0
|
||||
MISE_VERSION="v2025.12.0"
|
||||
MISE_INSTALL_PATH="/usr/local/bin/mise"
|
||||
MISE_ACTIVATE_LINE='eval "$(/usr/local/bin/mise activate bash)"'
|
||||
MODULES_DIR="$(bundle_path default_modules_dir "$RUNTIME_DIR/wtf/root/lib/modules/6.8.0-94-generic")"
|
||||
PACKAGES_FILE="$(banger_packages_file)"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
|
|
@ -388,6 +391,18 @@ fi
|
|||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y install ${APT_PACKAGES_ESCAPED}
|
||||
curl -fsSL https://mise.run | MISE_INSTALL_PATH=\"$MISE_INSTALL_PATH\" MISE_VERSION=\"$MISE_VERSION\" sh
|
||||
mkdir -p /etc/profile.d
|
||||
cat > /etc/profile.d/mise.sh <<'MISEPROFILE'
|
||||
if [ -n \"\${BASH_VERSION:-}\" ] && [ -x \"$MISE_INSTALL_PATH\" ]; then
|
||||
eval \"\$($MISE_INSTALL_PATH activate bash)\"
|
||||
fi
|
||||
MISEPROFILE
|
||||
chmod 0644 /etc/profile.d/mise.sh
|
||||
touch /etc/bash.bashrc
|
||||
if ! grep -Fqx '$MISE_ACTIVATE_LINE' /etc/bash.bashrc; then
|
||||
printf '\n%s\n' '$MISE_ACTIVATE_LINE' >> /etc/bash.bashrc
|
||||
fi
|
||||
if [[ \"$INSTALL_DOCKER\" == \"1\" ]]; then
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -y remove containerd || true
|
||||
if ! DEBIAN_FRONTEND=noninteractive apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue