mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-09 15:02:30 +02:00
fix: resolve symlinks in install.sh for npm/bun bin usage
When installed via `npm install ecc-universal`, the `ecc-install` bin entry creates a symlink from the package manager's bin directory to install.sh. The old `$(dirname "$0")` resolved to the bin directory instead of the actual package directory, causing `cp` to fail with "cannot stat '.../rules/common/.'". Now follows the symlink chain with readlink before resolving SCRIPT_DIR. Fixes #199
This commit is contained in:
parent
492c99ac24
commit
d9d0d3c444
1 changed files with 9 additions and 1 deletions
10
install.sh
10
install.sh
|
|
@ -22,7 +22,15 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
# Resolve symlinks — needed when invoked as `ecc-install` via npm/bun bin symlink
|
||||
SCRIPT_PATH="$0"
|
||||
while [ -L "$SCRIPT_PATH" ]; do
|
||||
link_dir="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
||||
SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
|
||||
# Resolve relative symlinks
|
||||
[[ "$SCRIPT_PATH" != /* ]] && SCRIPT_PATH="$link_dir/$SCRIPT_PATH"
|
||||
done
|
||||
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
||||
RULES_DIR="$SCRIPT_DIR/rules"
|
||||
|
||||
# --- Parse --target flag ---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue