diff --git a/install.sh b/install.sh index 231a895..af328d5 100755 --- a/install.sh +++ b/install.sh @@ -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." diff --git a/vagrant/dev/ubuntu/tmp/inst.sh b/vagrant/dev/ubuntu/tmp/inst.sh new file mode 100644 index 0000000..231a895 --- /dev/null +++ b/vagrant/dev/ubuntu/tmp/inst.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -e + +# Determine the platform +OS=$(uname -s) +ARCH=$(uname -m) + +# Map architecture +if [ "$ARCH" == "x86_64" ]; then + ARCH="amd64" +elif [[ "$ARCH" == "arm64" || "$ARCH" == "aarch64" ]]; then + ARCH="arm64" +else + echo "Unsupported architecture: $ARCH" + exit 1 +fi + +# Map OS +case "$OS" in + Linux) OS="linux" ;; + Darwin) OS="darwin" ;; + *) echo "Unsupported OS: $OS"; exit 1 ;; +esac + +# Construct the download URL +VERSION="v0.0.4" +BINARY_URL="https://codeberg.org/headshed/infctl-cli/releases/download/$VERSION/infctl-$OS-$ARCH" + +# 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 + +echo "infctl installed successfully!"