Files
omarchy/install/user/mise-work.sh
T
David Heinemeier HanssonandClaude Fable 5 5db4a40195 Loosen the offline Node pin so mise up tracks new releases
Offline installs unpack the bundled tarball and pin Node to its exact
version, since latest can't be resolved without network. But nothing ever
loosened that pin, so Node stayed frozen at the ISO's version and mup
skipped it forever, while online installs tracked latest.

Rewrite the pin to latest right after registering the bundled version:
mise resolves latest to the installed version while offline (verified
with no network and an empty cache), and the first mise up with network
picks up new releases just like an online install.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017LseZ1jcLaFBnndRnW4yb5
2026-09-13 12:11:00 +02:00

49 lines
1.9 KiB
Bash

# Setup default work directory (and tries)
mkdir -p "$HOME/Work"
mkdir -p "$HOME/Work/tries"
cat >"$HOME/Work/.mise.toml" <<'EOF'
[env]
_.path = "{{ cwd }}/bin"
EOF
mise trust ~/Work/.mise.toml
# Offline installs unpack the Node tarball bundled by the ISO: from
# /opt/packages in the ISO chroot, or from the copy staged in provisioning state when
# omarchy-provision-owner finalizes the user at first boot.
case ${OMARCHY_SETUP_CONTEXT:-runtime} in
iso-chroot) NODE_PACKAGE_DIR=/opt/packages ;;
provision-owner) NODE_PACKAGE_DIR=/var/lib/omarchy/provisioning/packages ;;
*) NODE_PACKAGE_DIR="" ;;
esac
if [[ -n $NODE_PACKAGE_DIR ]]; then
NODE_TARBALL=$(find "$NODE_PACKAGE_DIR" -name "node-v*-linux-x64.tar.gz" -type f 2>/dev/null | head -n1)
if [[ -z $NODE_TARBALL ]]; then
if [[ ${OMARCHY_SETUP_CONTEXT:-} == "provision-owner" ]]; then
# A factory snapshot predating the bundled tarball may not have it staged.
# Leave Node to the network rather than failing the whole first boot.
echo "Warning: no bundled Node.js tarball in $NODE_PACKAGE_DIR; trying the network" >&2
mise use -g node@latest || echo "Warning: Node.js install deferred (no network)" >&2
else
echo "Error: bundled Node.js tarball missing from $NODE_PACKAGE_DIR" >&2
exit 1
fi
else
NODE_VERSION=$(basename "$NODE_TARBALL" | sed 's/node-v\(.*\)-linux-x64.tar.gz/\1/')
NODE_INSTALL_DIR="$HOME/.local/share/mise/installs/node/$NODE_VERSION"
mkdir -p "$NODE_INSTALL_DIR"
tar -xzf "$NODE_TARBALL" --strip-components=1 -C "$NODE_INSTALL_DIR"
mise use -g node@"$NODE_VERSION"
# That pinned the exact bundled version, which would exempt Node from
# mise up forever. Loosen it to latest, like an online install gets:
# mise resolves latest to the installed version while offline.
mise config set tools.node latest --file "$HOME/.config/mise/config.toml"
fi
else
mise use -g node@latest
fi