feat: add Windows gitbash installation support and improve binary download process

This commit is contained in:
jon brookes 2025-08-21 17:15:24 +01:00
parent faa7927376
commit 48781147cc
2 changed files with 56 additions and 4 deletions

View file

@ -20,6 +20,7 @@ fi
case "$OS" in
Linux) OS="linux" ;;
Darwin) OS="darwin" ;;
MSYS_NT-10.0-26100) OS="windows" ;; # gitbash
*) echo "Unsupported OS: $OS"; exit 1 ;;
esac
@ -29,9 +30,23 @@ BINARY_URL="https://codeberg.org/headshed/infctl-cli/releases/download/$VERSION/
# Download the binary
echo "Downloading infctl binary for $OS-$ARCH..."
sudo curl -s -L "$BINARY_URL" -o /usr/local/bin/infctl
# Make it executable
sudo chmod +x /usr/local/bin/infctl
if [ "$OS" == "windows" ]; then
# Create ~/bin if it doesn't exist
mkdir -p "$HOME/bin"
curl -s -L "$BINARY_URL.exe" -o "$HOME/bin/infctl.exe"
if [ $? -ne 0 ]; then
echo "Failed to download infctl for Windows"
exit 1
fi
# Ensure ~/bin is in PATH for future sessions
if ! grep -q 'export PATH="$HOME/bin:$PATH"' "$HOME/.bash_profile" 2>/dev/null; then
echo 'export PATH="$HOME/bin:$PATH"' >> "$HOME/.bash_profile"
echo "Added ~/bin to PATH in ~/.bash_profile. Please restart your shell or run: source ~/.bash_profile"
fi
else
sudo curl -s -L "$BINARY_URL" -o /usr/local/bin/infctl
sudo chmod +x /usr/local/bin/infctl
fi
echo "infctl installed successfully!"
echo "infctl install done."