From d13075a5e15050a86c03cc5010f1b22474723c32 Mon Sep 17 00:00:00 2001 From: MickLesk Date: Sat, 18 Jul 2026 12:05:20 +0200 Subject: [PATCH] Fix Manyfold Ruby setup home initialization Create the `manyfold` service user before calling `setup_ruby` so `/home/manyfold` exists when rbenv profile snippets are written. Also harden `setup_ruby` by creating `$HOME` if missing, preventing profile-write failures for installers that pass a home directory before creating the user. --- install/manyfold-install.sh | 5 ++++- misc/tools.func | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/install/manyfold-install.sh b/install/manyfold-install.sh index dfc43b49e..c6b76c758 100644 --- a/install/manyfold-install.sh +++ b/install/manyfold-install.sh @@ -31,13 +31,16 @@ NODE_VERSION="24" NODE_MODULE="corepack,yarn" setup_nodejs fetch_and_deploy_gh_release "manyfold" "manyfold3d/manyfold" "tarball" "latest" "/opt/manyfold/app" +# Create the service user (and its home) before setup_ruby, which writes rbenv +# profile snippets into HOME=/home/manyfold. +useradd -m -s /usr/bin/bash manyfold + RUBY_INSTALL_VERSION=$(cat /opt/manyfold/app/.ruby-version) RUBY_VERSION=${RUBY_INSTALL_VERSION} RUBY_INSTALL_RAILS="true" HOME=/home/manyfold setup_ruby msg_info "Configuring Manyfold" YARN_VERSION=$(grep '"packageManager":' /opt/manyfold/app/package.json | sed -E 's/.*"(yarn@[0-9\.]+)".*/\1/') RELEASE=$(get_latest_github_release "manyfold3d/manyfold") -useradd -m -s /usr/bin/bash manyfold cat </opt/manyfold/.env export APP_VERSION=${RELEASE} export GUID=1002 diff --git a/misc/tools.func b/misc/tools.func index 93188727a..cc5e66162 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -8637,6 +8637,11 @@ setup_ruby() { local BASHRC_FILE="$HOME/.bashrc" local TMP_DIR=$(mktemp -d) + # Ensure HOME exists: callers may pass a not-yet-created home (e.g. a service + # user that is created later in the install), so the profile writes below do + # not fail on a missing directory. + mkdir -p "$HOME" + if ! grep -q 'rbenv init' "$PROFILE_FILE" 2>/dev/null; then cat <<'EOF' >>"$PROFILE_FILE" export PATH="$HOME/.rbenv/bin:$PATH"