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.
This commit is contained in:
MickLesk
2026-07-18 12:05:20 +02:00
parent 6cb0fbbc39
commit d13075a5e1
2 changed files with 9 additions and 1 deletions
+4 -1
View File
@@ -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 <<EOF >/opt/manyfold/.env
export APP_VERSION=${RELEASE}
export GUID=1002
+5
View File
@@ -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"