Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,17 @@ fi
WORKER_PATH=""
DATA_DIR="$INSTALL_DIR/ferrumpy-${VERSION}.data/scripts"
if [ -d "$DATA_DIR" ] && [ -f "$DATA_DIR/ferrumpy-repl-worker" ]; then
ln -s -r "$INSTALL_DIR/ferrumpy-${VERSION}.data" "$INSTALL_DIR/ferrumpy-current.data"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make symlink creation idempotent

Because the script uses set -e, this ln -s -r will abort the installer if ferrumpy-current.data already exists (e.g., re-running the installer after a previous version), which is exactly the update scenario described in the commit message. This makes upgrades fail instead of updating the symlink. Consider removing the existing link first or using ln -sf (and handling the case where a real directory already exists) so repeated installs succeed.

Useful? React with 👍 / 👎.

DATA_DIR="$INSTALL_DIR/ferrumpy-current.data/scripts"
WORKER_PATH="$DATA_DIR/ferrumpy-repl-worker"
fi

# Fallback: search for any .data directory
if [ -z "$WORKER_PATH" ]; then
DATA_DIR=$(find "$INSTALL_DIR" -maxdepth 1 -type d -name "*.data" | head -1)
if [ -n "$DATA_DIR" ] && [ -f "$DATA_DIR/scripts/ferrumpy-repl-worker" ]; then
ln -s -r "$DATA_DIR" "$INSTALL_DIR/ferrumpy-current.data"
DATA_DIR="$INSTALL_DIR/ferrumpy-current.data"
WORKER_PATH="$DATA_DIR/scripts/ferrumpy-repl-worker"
fi
fi
Expand Down