WSL port 6/7: let install.sh run from the clone, which is where the README puts it

Merged
JA
3mo ago
+37-7

Stacked on #11. Found by actually trying to use drill after the port, rather
than by running the suite.

The bug

The README says:

git clone https://github.com/jainal09/drill.git
cd drill && ./install.sh && exec $SHELL

Run from your home directory — which is where people run it — that puts the
clone at ~/drill. And ~/drill is the default DRILL_HOME. Source and
destination are the same directory, so the copy loop hits:

cp: '/home/you/drill/nvimrc.lua' and '/home/you/drill/nvimrc.lua' are the same file

and set -e ends the install right there. No shell rc block, no commands.

Why it presents as "drill is broken"

d then silently stays whatever your shell already had it as. Under oh-my-zsh
that is its directory-stack function, so:

❯ d scratch-pad
  ~
❯ nothing opened

No error, no clue. It reads as the editor failing to launch, when in fact
nothing was ever installed. drill.sh's own header warns about exactly this
collision — d/r/ri vs oh-my-zsh, a zsh builtin and Ruby — which is why the
rc block has to be sourced last, and why not being sourced at all is invisible.

The fix

Installing into the clone is not a mistake, it is the documented path; there is
simply nothing to copy. Say so and skip the loop. DRILL_HOME is resolved
through cd/pwd first, so the comparison is between two real paths rather
than between ~/drill and /home/you/drill.

Verification

layoutresult
clone at the default DRILL_HOME (README path)running from /home/you/drill itself -- the files are already in place, install completes
clone elsewhere, separate DRILL_HOMEstill copies all four files, unchanged

Then installed for real and confirmed the collision is resolved:

$ zsh -i -c 'whence -f d'
d () {
	_drill_edit scratch "$@"
}

Pre-existing on main — the copy loop is untouched from the original — and
platform-independent: it bites on macOS just as readily.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WveBqAyhoM49p9gWfwBDBx

Summary by CodeRabbit

  • Bug Fixes
    • Improved installation reliability when the installer is launched through links or alternate paths.
    • Added checks to ensure required installation files are available before changes are made.
    • Prevented unnecessary copying when the source and destination are already the same.
    • Existing destination files are now backed up before being replaced, helping preserve local changes and support safer upgrades.

Greptile Summary

The installer now resolves physical source and destination paths, validates required assets before branching, and skips redundant copies when invoked from the configured installation directory.

  • Preserves the configured DRILL_HOME path for shell initialization.
  • Validates all four distributed files on both copy and same-directory paths.
  • Retains backup-and-copy behavior for separate source and destination directories.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported same-directory validation gap is fixed because every required distributed file is checked before copying is skipped.

Important Files Changed

FilenameOverview
install.shAdds physical-path identity detection and moves required-file validation ahead of the same-directory fast path, resolving the previously reported incomplete-validation issue.

Reviews (23): Last reviewed commit: "Do not bake a symlink's current target i..." | Re-trigger Greptile