Skip to content

Commit

Permalink
Create aichat.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
corgan2222 committed Jan 29, 2025
1 parent ba8fd97 commit 4e8dadb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions home/.dot/installer/aichat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Check if aichat command is available
if command -v aichat &> /dev/null; then
echo "aichat is already installed."
exit 0
fi

# Get Cargo version
CARGO_VERSION=$(cargo --version | awk '{print $2}')

# Function to compare version numbers
version_gt() {
[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1" ]
}

# Check if Cargo version is greater than 1.71
if version_gt "$CARGO_VERSION" "1.71"; then
cargo install aichat
else
# If Cargo is too old, update Rust and install again
curl -sf https://static.rust-lang.org/rustup.sh | sudo sh
cargo install aichat
fi

0 comments on commit 4e8dadb

Please sign in to comment.