Skip to content

Commit

Permalink
fix installation
Browse files Browse the repository at this point in the history
  • Loading branch information
maxheld83 committed Jan 19, 2025
1 parent 8d663f4 commit a530dee
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ devops package
## Installation

```sh
cp post-checkout.sample .git/hooks/post-checkout
chmod +x .git/hooks/post-checkout
sh .git/hooks/post-checkout
cp -f muggle/post-checkout.sample .git/modules/muggle/hooks/post-checkout
chmod +x .git/modules/muggle/hooks/post-checkout
sh muggle/install.sh
```
26 changes: 25 additions & 1 deletion post-checkout.sample
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
#!bin/bash
../install.sh

#!/bin/bash

# Determine the directory of this hook
HOOK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Check if we are in a submodule setup
if [ -f "$HOOK_DIR/gitmodules" ]; then
# We're in a superproject's .git/modules directory, so navigate up to the submodule's root
SUBMODULE_ROOT="$(dirname "$HOOK_DIR")/../../../$(basename "$HOOK_DIR")"
else
# We're in a normal repo, so just go up one level to the repo root
SUBMODULE_ROOT="$(dirname "$HOOK_DIR")/.."
fi

# Path to install.sh relative to the repo/submodule root
INSTALL_SCRIPT="$SUBMODULE_ROOT/install.sh"

# Check if install.sh exists and is executable
if [ -x "$INSTALL_SCRIPT" ]; then
# Run the install script with the arguments passed to the hook
"$INSTALL_SCRIPT" "$@"
else
echo "Warning: install.sh not found or not executable at $INSTALL_SCRIPT" >&2
fi

0 comments on commit a530dee

Please sign in to comment.