scripts/hooks/dstr.sh

20 lines
679 B
Bash

#!/bin/bash
# URL to the raw script file
SCRIPT_URL="https://git.kjan.de/jank/scripts/raw/branch/main/hooks/pre-recieve.sh"
# Try curl first, then fall back to wget if curl is not available
if command -v curl &>/dev/null; then
# Pass standard input to the downloaded script and preserve exit code
EXITCODE=0
# Read all input into a variable so we can pass it to the downloaded script
INPUT=$(cat)
echo "$INPUT" | (curl -s "$SCRIPT_URL" | bash) || EXITCODE=$?
exit $EXITCODE
else
# Fall back to wget if curl is not available
EXITCODE=0
INPUT=$(cat)
echo "$INPUT" | (wget -q -O - "$SCRIPT_URL" | bash) || EXITCODE=$?
exit $EXITCODE
fi