Files
omarchy/install/user/mise-work.sh
T
Emir Beganovic 057681b33c Unpack the bundled Node tarball for the machine's architecture
An aarch64 ISO bundles node-v*-linux-arm64.tar.gz, and mise-work.sh
looked for node-v*-linux-x64.tar.gz on every machine. An offline install
on aarch64 stopped at its last step: "Error: bundled Node.js tarball
missing from /opt/packages".

The name now follows uname -m. x86_64 looks for the same file as before.
This is the change the n1x branch already carries, from Spencer Bull's
6d022e36.
2026-10-09 01:07:03 +02:00

47 lines
2.0 KiB
Bash

# Setup default work directory (and tries)
mkdir -p "$HOME/Work"
mkdir -p "$HOME/Work/tries"
# 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
# The ISO bundles the tarball for its own architecture.
case $(uname -m) in
aarch64) NODE_PLATFORM=linux-arm64 ;;
*) NODE_PLATFORM=linux-x64 ;;
esac
NODE_TARBALL=$(find "$NODE_PACKAGE_DIR" -name "node-v*-$NODE_PLATFORM.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\(.*\)-$NODE_PLATFORM.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