Skip to content

Commit

Permalink
Scripts: always read PNPM_HOME in ensure_pnpm_setup
Browse files Browse the repository at this point in the history
  • Loading branch information
miklschmidt committed Dec 20, 2024
1 parent 08200f7 commit aa29431
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,23 @@ ensure_pnpm_setup()
if [ -z "$PNPM_HOME" ]; then
report_status "Creating pnpm home directory..."
sudo -u "${RATOS_USERNAME}" pnpm setup
# 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
# Extract PNPM_HOME directly from .bashrc
PNPM_HOME=$(sudo -u "${RATOS_USERNAME}" grep "export PNPM_HOME=" "${REAL_HOME}/.bashrc" | cut -d'"' -f2)
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"
fi
}

install_global_pnpm_packages()
{
# Install global packages
if ! which zx &> /dev/null; then
report_status "Installing global pnpm package requirements..."
# Pass PNPM_HOME to the subshell
sudo -u "${RATOS_USERNAME}" env "PNPM_HOME=${PNPM_HOME}" "PATH=${PNPM_HOME}:$PATH" pnpm install -g zx
fi
}


ensure_service_permission()
{
if ! grep -q "ratos-configurator" "${RATOS_PRINTER_DATA_DIR}/moonraker.asvc"; then
Expand Down
1 change: 0 additions & 1 deletion src/scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ ensure_sudo_command_whitelisting
ensure_pnpm_installation
pnpm_install
ensure_pnpm_setup
install_global_pnpm_packages
install_cli
install_udev_rule
patch_log_rotation
Expand Down

0 comments on commit aa29431

Please sign in to comment.