fix: bootstrap.sh erkennt existierendes hooks-Verzeichnis
Statt blind `ln -sfn` zu rufen, wird jetzt geprüft ob ~/.claude/hooks bereits als korrekter Symlink, echtes Verzeichnis oder gar nicht existiert. Bei extra Dateien im Verzeichnis werden Einzel-Symlinks erstellt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+31
-2
@@ -27,9 +27,38 @@ ln -sf "$REPO/dotfiles/gitea-mcp-wrapper.sh" ~/.claude/gitea-mcp-wrapper.sh
|
|||||||
chmod +x "$REPO/dotfiles/gitea-mcp-wrapper.sh"
|
chmod +x "$REPO/dotfiles/gitea-mcp-wrapper.sh"
|
||||||
echo " Dotfiles verlinkt"
|
echo " Dotfiles verlinkt"
|
||||||
|
|
||||||
ln -sfn "$REPO/hooks" ~/.claude/hooks
|
|
||||||
chmod +x "$REPO/hooks/"*.sh
|
chmod +x "$REPO/hooks/"*.sh
|
||||||
echo " Hooks verlinkt und ausfuehrbar"
|
hooks_target="$HOME/.claude/hooks"
|
||||||
|
if [[ -L "$hooks_target" ]]; then
|
||||||
|
current="$(readlink -f "$hooks_target")"
|
||||||
|
if [[ "$current" == "$REPO/hooks" ]]; then
|
||||||
|
echo " Hooks bereits korrekt verlinkt"
|
||||||
|
else
|
||||||
|
ln -sfn "$REPO/hooks" "$hooks_target"
|
||||||
|
echo " Hooks-Symlink korrigiert (war: $current)"
|
||||||
|
fi
|
||||||
|
elif [[ -d "$hooks_target" ]]; then
|
||||||
|
extra_files=()
|
||||||
|
for f in "$hooks_target"/*; do
|
||||||
|
[[ -e "$f" ]] || continue
|
||||||
|
name="$(basename "$f")"
|
||||||
|
[[ -e "$REPO/hooks/$name" ]] || extra_files+=("$name")
|
||||||
|
done
|
||||||
|
if [[ ${#extra_files[@]} -eq 0 ]]; then
|
||||||
|
rm -rf "$hooks_target"
|
||||||
|
ln -sfn "$REPO/hooks" "$hooks_target"
|
||||||
|
echo " Hooks-Verzeichnis durch Symlink ersetzt"
|
||||||
|
else
|
||||||
|
echo " WARNUNG ~/.claude/hooks/ enthaelt zusaetzliche Dateien: ${extra_files[*]}"
|
||||||
|
echo " Erstelle Einzel-Symlinks statt Directory-Symlink"
|
||||||
|
for f in "$REPO/hooks/"*.sh; do
|
||||||
|
ln -sf "$f" "$hooks_target/$(basename "$f")"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
ln -sfn "$REPO/hooks" "$hooks_target"
|
||||||
|
echo " Hooks verlinkt"
|
||||||
|
fi
|
||||||
|
|
||||||
# --- Voraussetzungen pruefen ---
|
# --- Voraussetzungen pruefen ---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user