Skip to content

Commit

Permalink
Update yay_setup.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvmistry2000 authored Sep 11, 2024
1 parent f616dae commit dd94a05
Showing 1 changed file with 39 additions and 24 deletions.
63 changes: 39 additions & 24 deletions yay_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,51 @@ is_arch_based() {
fi
}

# Function to check if yay is installed
is_yay_installed() {
if command -v yay >/dev/null 2>&1; then
return 0 # yay is installed
else
return 1 # yay is not installed
fi
}

# Check if the system is Arch-based
if is_arch_based; then
echo -e "${YELLOW}Starting yay installation${RC}"

# Update system
echo "Updating system..."
sudo pacman -Syu --noconfirm

# Install required packages
echo "Installing base-devel and git..."
sudo pacman -S --noconfirm base-devel git

# Clone yay repository into the current directory
if [ -d "$YAY_DIR" ]; then
echo "Directory $YAY_DIR already exists. Skipping cloning."
# Check if yay is installed
if is_yay_installed; then
echo "yay is already installed. Exiting."
exit 0
else
echo "Cloning yay repository into $YAY_DIR..."
git clone $YAY_REPO $YAY_DIR
fi
echo -e "${YELLOW}Starting yay installation${RC}"

# Update system
echo "Updating system..."
sudo pacman -Syu --noconfirm

# Install required packages
echo "Installing base-devel and git..."
sudo pacman -S --noconfirm base-devel git

# Build and install yay
cd $YAY_DIR
echo "Building and installing yay..."
makepkg -si --noconfirm
# Clone yay repository into the current directory
if [ -d "$YAY_DIR" ]; then
echo "Directory $YAY_DIR already exists. Skipping cloning."
else
echo "Cloning yay repository into $YAY_DIR..."
git clone $YAY_REPO $YAY_DIR
fi

# Clean up
cd ..
rm -rf $YAY_DIR
# Build and install yay
cd $YAY_DIR
echo "Building and installing yay..."
makepkg -si --noconfirm

echo "yay installation completed successfully!"
# Clean up
cd ..
rm -rf $YAY_DIR

echo "yay installation completed successfully!"
fi
else
echo "This script is intended for Arch-based systems only. Exiting."
fi

0 comments on commit dd94a05

Please sign in to comment.