Skip to content

Commit 3a37ad7

Browse files
juhgiyoclaude
andauthored
Fix install.sh error when cwd equals INSTALL_DIR (#10)
## Summary - Fix `mv: 'binary' and 'target/binary' are the same file` error during first-time install - When strawhub runs `install.sh`, it sets cwd to the package directory (same as `INSTALL_DIR`). The `mv` fails because source and destination are the same file. - Skip the `mv` when both paths resolve to the same absolute path ## Test plan - [ ] Fresh install via `strawhub install` no longer shows the error 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b88a085 commit 3a37ad7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

strawpot_codex/install.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ chmod +x "${BINARY_NAME}"
4343
mkdir -p "$INSTALL_DIR"
4444

4545
if [ -w "$INSTALL_DIR" ]; then
46-
mv "${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}"
46+
# Skip mv when already downloaded into the install directory (e.g. strawhub sets cwd = INSTALL_DIR)
47+
SRC="$(cd "$(dirname "${BINARY_NAME}")" && pwd)/$(basename "${BINARY_NAME}")"
48+
DST="$(cd "$INSTALL_DIR" && pwd)/${BINARY_NAME}"
49+
if [ "$SRC" != "$DST" ]; then
50+
mv "${BINARY_NAME}" "${INSTALL_DIR}/${BINARY_NAME}"
51+
fi
4752
else
4853
echo "Error: cannot write to ${INSTALL_DIR}" >&2
4954
exit 1

0 commit comments

Comments
 (0)