bootstrap failed outright on Oracle Linux: docker/install.sh piped
get.docker.com to sh, and that script allowlists distros by /etc/os-release
ID, so it aborted with "ERROR: Unsupported distribution 'ol'".
On a distro it does recognize, the convenience script only adds the repo and
installs the packages -- exactly what install_rhel() now does directly. Doing
it ourselves drops the allowlist, so every EL rebuild (Oracle, Rocky, Alma,
CentOS, RHEL) goes through one code path instead of needing to be enumerated.
Debian-family still uses get.docker.com. containerd.io needs --allowerasing to
replace the runc that Oracle Linux ships.
Also stop one failed module from killing the whole run: modules were bare
calls under `set -eu`, so docker/'s exit meant bin/, node/ and ansible/
silently never ran -- an unsupported distro string left the box with no CLIs,
no npx and no ansible. run_module warns and continues, then bootstrap exits
non-zero with a summary of what failed. Same guard 35befbe added for
individual tools in bin/install.sh, one level up.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
81 lines
3.3 KiB
Bash
Executable File
81 lines
3.3 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
# bootstrap.sh — entrypoint for configuring a fresh VM (RHEL-family or
|
|
# Debian-family) with this repo's dotfiles. Safe to re-run.
|
|
#
|
|
# curl -fsSL https://git.nic-oconnor.com/public/dotfiles/raw/branch/main/bootstrap.sh | sh
|
|
# (or, from a checked-out clone: ./bootstrap.sh)
|
|
set -eu
|
|
|
|
REPO_URL="${DOTFILES_REPO:-https://git.nic-oconnor.com/public/dotfiles.git}"
|
|
DOTFILES_DIR="${DOTFILES_DIR:-$HOME/.dotfiles}"
|
|
|
|
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
|
|
|
# When curl-piped into `sh`, there is no checkout on disk: $0 is not a real
|
|
# path, so the module scripts alongside this file are missing. Clone (or
|
|
# update) the repo, then re-exec bootstrap.sh from the checkout.
|
|
if [ ! -f "$SCRIPT_DIR/zsh/install.sh" ]; then
|
|
if ! command -v git >/dev/null 2>&1; then
|
|
echo "bootstrap: git is required to self-clone; install git first" >&2
|
|
exit 1
|
|
fi
|
|
if [ -d "$DOTFILES_DIR/.git" ]; then
|
|
echo "bootstrap: updating existing checkout at $DOTFILES_DIR"
|
|
git -C "$DOTFILES_DIR" pull --ff-only
|
|
else
|
|
echo "bootstrap: cloning $REPO_URL into $DOTFILES_DIR"
|
|
git clone "$REPO_URL" "$DOTFILES_DIR"
|
|
fi
|
|
exec "$DOTFILES_DIR/bootstrap.sh"
|
|
fi
|
|
|
|
# python3 is a hard dependency of this setup, not an optional extra:
|
|
# - lib/fetch.sh needs python3 (or unzip) to extract .zip release assets;
|
|
# without either, the 1Password CLI install fails.
|
|
# - mcp-config/sync.sh needs it to inject the gateway's discovered models;
|
|
# without it opencode comes up with an EMPTY model list.
|
|
# Minimal Debian/RHEL images ship neither python3 nor unzip, so install it
|
|
# before bin/ runs. Non-fatal: an unsupported OS should degrade, not abort.
|
|
if ! command -v python3 >/dev/null 2>&1 && ! command -v unzip >/dev/null 2>&1; then
|
|
# shellcheck source=lib/os-detect.sh
|
|
. "$SCRIPT_DIR/lib/os-detect.sh"
|
|
echo "bootstrap: installing python3 (needed for zip assets and model discovery)"
|
|
pkg_install python3 || echo "bootstrap: warning: could not install python3" >&2
|
|
fi
|
|
|
|
# run_module <path> — run one module; on failure, warn and keep going.
|
|
#
|
|
# WHY: these used to be bare calls, so under `set -eu` the FIRST failing module
|
|
# aborted bootstrap and every later module silently never ran — one unsupported
|
|
# distro in docker/ was enough to leave a box with no CLIs, no npx and no
|
|
# ansible. The modules are independent, so a failure in one is not a reason to
|
|
# skip the rest. (bin/install.sh does the same for individual tools; this is
|
|
# that guard one level up.)
|
|
FAILED=""
|
|
run_module() {
|
|
if ( set -e; "$SCRIPT_DIR/$1/install.sh" ); then return 0; fi
|
|
FAILED="$FAILED $1"
|
|
echo "bootstrap: WARNING: $1 module failed; continuing." >&2
|
|
}
|
|
|
|
run_module zsh
|
|
run_module git
|
|
# Runs before bin/ so the kind install gate can see the rootful daemon.
|
|
run_module docker
|
|
run_module bin
|
|
# Provides npx, which opencode needs to spawn the npm-based MCP servers in
|
|
# mcp-config/. Without it every MCP server silently fails to start.
|
|
run_module node
|
|
run_module ansible
|
|
# Runs last: needs rootless Docker already up (started at boot) so it can
|
|
# delegate cgroups to it. No-ops where that does not apply.
|
|
run_module docker-rootless-cgroup
|
|
|
|
if [ -n "$FAILED" ]; then
|
|
echo "" >&2
|
|
echo "bootstrap: WARNING: these modules did NOT complete:$FAILED" >&2
|
|
echo "bootstrap: everything else was applied. Fix the cause and re-run." >&2
|
|
exit 1
|
|
fi
|
|
echo "bootstrap: all modules applied." >&2
|