Skip to content

Commit

Permalink
Scripts: more reliably grab PNPM_HOME from updated .bashrc
Browse files Browse the repository at this point in the history
  • Loading branch information
miklschmidt committed Dec 20, 2024
1 parent 3ab53da commit f2f5a8f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ ensure_pnpm_setup()
if [ -z "$PNPM_HOME" ]; then
report_status "Creating pnpm home directory..."
sudo -u "${RATOS_USERNAME}" pnpm setup
# shellcheck disable=SC1091
source "${REAL_HOME}/.bashrc"
# Extract PNPM_HOME directly from .bashrc
PNPM_HOME=$(sudo -u "${RATOS_USERNAME}" grep "export PNPM_HOME=" "${REAL_HOME}/.bashrc" | cut -d'"' -f2)
export PNPM_HOME
fi
if [ ! -d "$PNPM_HOME" ]; then
if [ -n "$PNPM_HOME" ] && [ ! -d "$PNPM_HOME" ]; then
report_status "PNPM home directory '${PNPM_HOME}' not found, creating..."
mkdir -p "$PNPM_HOME"
sudo chown -R "${RATOS_USERNAME}:${RATOS_USERNAME}" "$PNPM_HOME"
Expand Down

0 comments on commit f2f5a8f

Please sign in to comment.