You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

84 lines
1.8 KiB

#!/bin/bash
if ping -q -c 1 -W 1 8.8.8.8 &>/dev/null; then
if sudo -n true 2>/dev/null; then
if [[ -f /etc/arch-release ]]; then
echo "Arch Linux detected"
distro="arch"
if command -v python &>/dev/null; then
echo "Python is already installed, proceeding"
else
echo "Installing python..."
sudo pacman -Sy python --noconfirm > /dev/null
fi
fi
if [[ -f /etc/debian_version ]]; then
echo "Debian detected"
distro="debian"
echo "Updating system..."
sudo apt update -y > /dev/null
if command -v python &>/dev/null; then
echo "Python is already installed, proceeding"
else
echo "Installing python..."
sudo apt install python3 -y > /dev/null
fi
fi
if [[ -f /etc/redhat-release ]]; then
echo "Redhat linux detected"
distro="redhat"
echo "Updating system..."
sudo dnf update -y > /dev/null
if command -v python &>/dev/null; then
echo "Python is already installed, proceeding"
else
echo "Installing python..."
sudo dnf install python3 -y > /dev/null
fi
fi
dotfiles="$HOME/dotfiles"
read -p "Is '$dotfiles' the directory where your dotfiles are located? (y/N): " response
if [[ $response =~ ^[Yy]$ ]]; then
echo "Proceeding"
else
read -p "Please enter the correct directory path: " new_directory
dotfiles="$new_directory"
fi
scripts="$dotfiles/scripts"
install_scripts="$scripts/install"
echo "Linking all config files to their respective directories..."
$dotfiles/link -c $dotfiles/link.conf.yaml
echo "Linking all of the files that need root permissions to their respective directories..."
sudo $dotfiles/link -c $dotfiles/link-root.conf.yaml
if [[ $distro == "arch" ]]; then
$install_scripts/arch $dotfiles
fi
else
echo "You don't have sudo rights, exiting..."
fi
else
echo "No internet connection available, exiting..."
fi