mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-10 13:54:04 +02:00
Make scripts/setup-symlinks idempotent (#1590)
`ln -fs` dereferences an existing symlink to a directory and creates the
new link *inside* it, so running the script a second time left two stray
symlinks in the working tree instead of replacing the existing ones:
tests/tests -> ../../../tests/
custom_components/adaptive_lighting/adaptive_lighting
-> ../../../custom_components/adaptive_lighting
Neither path is gitignored, so `git add -A` commits them.
Add `-n` so an existing symlink is treated as a file and replaced.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
51ea83dba3
commit
3e78ac7e21
1 changed files with 7 additions and 2 deletions
|
|
@ -2,12 +2,17 @@
|
|||
set -ex
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# '-n' keeps a re-run idempotent: without it 'ln -fs' follows an existing
|
||||
# symlink and creates the new link *inside* the target directory, leaving a
|
||||
# stray 'tests/tests' and 'custom_components/adaptive_lighting/adaptive_lighting'
|
||||
# in the working tree.
|
||||
|
||||
# Link custom components
|
||||
cd core/homeassistant/components/
|
||||
ln -fs ../../../custom_components/adaptive_lighting adaptive_lighting
|
||||
ln -fsn ../../../custom_components/adaptive_lighting adaptive_lighting
|
||||
cd -
|
||||
|
||||
# Link tests
|
||||
cd core/tests/components/
|
||||
ln -fs ../../../tests/ adaptive_lighting
|
||||
ln -fsn ../../../tests/ adaptive_lighting
|
||||
cd -
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue