Install opencode in Void rootfs
Bring the experimental Void image closer to the default dev image path by installing pinned mise inside the rootfs build, using it to install opencode, and activating mise automatically for root bash sessions. Keep the change scoped to the Void builder rather than packages.void so the image still stays language-agnostic at the package-manifest level, then clean mise download/cache artifacts before sealing the rootfs and work-seed. Extend verify-void so the smoke path now proves mise and opencode are actually present in a fresh void-exp VM. Verified with bash -n make-rootfs-void.sh verify.sh, GOCACHE=/tmp/banger-gocache go test ./..., and make build.
This commit is contained in:
parent
3096de0a7f
commit
7667249b47
4 changed files with 56 additions and 4 deletions
|
|
@ -260,6 +260,11 @@ case "$-" in
|
|||
*) return ;;
|
||||
esac
|
||||
|
||||
if [ -z "${BANGER_MISE_ACTIVATED:-}" ] && [ -x '/usr/local/bin/mise' ]; then
|
||||
export BANGER_MISE_ACTIVATED=1
|
||||
eval "$(/usr/local/bin/mise activate bash)"
|
||||
fi
|
||||
|
||||
PS1='\u@\h:\w\$ '
|
||||
EOF
|
||||
cat <<'EOF' | sudo tee "$bash_profile" >/dev/null
|
||||
|
|
@ -280,6 +285,38 @@ EOF
|
|||
sudo chmod 0644 "$bashrc" "$bash_profile" "$profile_prompt"
|
||||
}
|
||||
|
||||
install_mise_and_opencode() {
|
||||
local profile_mise="$ROOT_MOUNT/etc/profile.d/mise.sh"
|
||||
|
||||
sudo mkdir -p "$ROOT_MOUNT/etc/profile.d"
|
||||
if [[ -r /etc/resolv.conf ]]; then
|
||||
sudo install -m 0644 /etc/resolv.conf "$ROOT_MOUNT/etc/resolv.conf"
|
||||
fi
|
||||
|
||||
sudo env \
|
||||
HOME=/root \
|
||||
PATH=/usr/local/bin:/usr/bin:/bin \
|
||||
chroot "$ROOT_MOUNT" /bin/bash -se <<EOF
|
||||
set -euo pipefail
|
||||
curl -fsSL https://mise.run | MISE_INSTALL_PATH="$MISE_INSTALL_PATH" MISE_VERSION="$MISE_VERSION" sh
|
||||
"$MISE_INSTALL_PATH" use -g "$OPENCODE_TOOL"
|
||||
"$MISE_INSTALL_PATH" reshim
|
||||
if [[ ! -e /root/.local/share/mise/shims/opencode ]]; then
|
||||
echo "opencode shim not found after mise install" >&2
|
||||
exit 1
|
||||
fi
|
||||
ln -snf /root/.local/share/mise/shims/opencode /usr/local/bin/opencode
|
||||
EOF
|
||||
|
||||
cat <<'EOF' | sudo tee "$profile_mise" >/dev/null
|
||||
if [ -n "${BASH_VERSION:-}" ] && [ -z "${BANGER_MISE_ACTIVATED:-}" ] && [ -x '/usr/local/bin/mise' ]; then
|
||||
export BANGER_MISE_ACTIVATED=1
|
||||
eval "$(/usr/local/bin/mise activate bash)"
|
||||
fi
|
||||
EOF
|
||||
sudo chmod 0644 "$profile_mise"
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
if [[ -n "${ROOT_MOUNT:-}" ]] && command -v mountpoint >/dev/null 2>&1 && mountpoint -q "$ROOT_MOUNT"; then
|
||||
sudo umount "$ROOT_MOUNT" || true
|
||||
|
|
@ -313,6 +350,9 @@ OUT_ROOTFS="$RUNTIME_DIR/rootfs-void.ext4"
|
|||
SIZE_SPEC="2G"
|
||||
MIRROR="https://repo-default.voidlinux.org"
|
||||
ARCH="x86_64"
|
||||
MISE_VERSION="v2025.12.0"
|
||||
MISE_INSTALL_PATH="/usr/local/bin/mise"
|
||||
OPENCODE_TOOL="github:anomalyco/opencode"
|
||||
MODULES_DIR="$(bundle_path default_modules_dir "$RUNTIME_DIR/wtf/root/lib/modules/6.8.0-94-generic")"
|
||||
VSOCK_AGENT="$(bundle_path vsock_agent_path "$RUNTIME_DIR/banger-vsock-agent")"
|
||||
if [[ "$VSOCK_AGENT" == "$RUNTIME_DIR/banger-vsock-agent" && ! -x "$VSOCK_AGENT" ]]; then
|
||||
|
|
@ -474,6 +514,8 @@ configure_docker_bootstrap
|
|||
enable_docker_service
|
||||
normalize_root_shell
|
||||
configure_root_bash_prompt
|
||||
log "installing mise and opencode"
|
||||
install_mise_and_opencode
|
||||
sudo mkdir -p "$ROOT_MOUNT/root/.ssh"
|
||||
sudo touch "$ROOT_MOUNT/etc/fstab" "$ROOT_MOUNT/etc/hostname"
|
||||
sudo chroot "$ROOT_MOUNT" /usr/bin/ssh-keygen -A
|
||||
|
|
@ -487,8 +529,13 @@ sudo rm -rf \
|
|||
sudo rm -f \
|
||||
"$ROOT_MOUNT/root/get-docker" \
|
||||
"$ROOT_MOUNT/root/get-docker.sh" \
|
||||
"$ROOT_MOUNT/root/.cache/opencode" \
|
||||
"$ROOT_MOUNT/tmp/get-docker" \
|
||||
"$ROOT_MOUNT/tmp/get-docker.sh"
|
||||
sudo rm -rf \
|
||||
"$ROOT_MOUNT/root/.cache/mise" \
|
||||
"$ROOT_MOUNT/root/.local/share/mise/downloads" \
|
||||
"$ROOT_MOUNT/root/.local/share/mise/tmp"
|
||||
|
||||
sudo umount "$ROOT_MOUNT"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue