Skip to content

Commit

Permalink
feat: check git and rust installation before build
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-TW committed Jul 9, 2024
1 parent 014bcb1 commit 714046c
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions script/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
#!/usr/bin/env bash

# Check Git installed

if ! command -v git &> /dev/null; then
printf "Git is not installed. Do you want to install it? (y/n): "
read -r response
if [[ $response != "y" ]]; then
echo "Please install Git"
exit 1
fi
# check package manager
if command -v apt &> /dev/null; then
sudo apt install git
elif command -v pacman &> /dev/null; then
sudo pacman -S git
elif command -v dnf &> /dev/null; then
sudo dnf install git
elif command -v brew &> /dev/null; then
brew install git
else
echo "Can't find package manager, please install Git by yourself"
exit 1
fi
fi

# Check Rust and Cargo installed

if ! command -v rustc &> /dev/null; then
printf "Rust is not installed. Do you want to install it? (y/n): "
read -r response
if [[ $response != "y" ]]; then
echo "Please install Rust"
exit 1
fi
# check package manager
if command -v apt &> /dev/null; then
sudo apt install rustc
elif command -v pacman &> /dev/null; then
sudo pacman -S rust
elif command -v dnf &> /dev/null; then
sudo dnf install rust
elif command -v brew &> /dev/null; then
brew install rust
else
echo "Can't find package manager, please install Rust by yourself"
exit 1
fi
fi

# Install yu

git clone https://github.com/Young-TW/yu.git
cd yu || exit
cargo build --release
Expand Down

0 comments on commit 714046c

Please sign in to comment.