diff --git a/install-scripts/00-base.sh b/install-scripts/00-base.sh index 7659ece..21cf82f 100755 --- a/install-scripts/00-base.sh +++ b/install-scripts/00-base.sh @@ -6,45 +6,19 @@ base=( base-devel ) ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## + +# Determine the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Change the working directory to the parent directory of the script +PARENT_DIR="$SCRIPT_DIR/.." +cd "$PARENT_DIR" || exit 1 + +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_base.log" -set -e -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - -## Function for installing packages -install_package_pacman() { - # Checking if package is already installed - if pacman -Q "$1" &>/dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - sudo pacman -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if pacman -Q "$1" &>/dev/null ; then - echo -e "${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "${ERROR} $1 failed to install. Please check the $LOG. You may need to install manually." - exit 1 - fi - fi -} # Installation of main components printf "\n%s - Installing base-devel \n" "${NOTE}" diff --git a/install-scripts/00-hypr-pkgs.sh b/install-scripts/00-hypr-pkgs.sh index 7cc818f..a5554f8 100755 --- a/install-scripts/00-hypr-pkgs.sh +++ b/install-scripts/00-hypr-pkgs.sh @@ -84,67 +84,18 @@ uninstall=( ) ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## +# Determine the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Change the working directory to the parent directory of the script +PARENT_DIR="$SCRIPT_DIR/.." +cd "$PARENT_DIR" || exit 1 + +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_hypr-pkgs.log" -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - -ISAUR=$(command -v yay || command -v paru) - -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} - -# Function for uninstalling packages -uninstall_package() { - # Checking if package is installed - if pacman -Qi "$1" &>> /dev/null ; then - # Package is installed - echo -e "${NOTE} Uninstalling $1 ..." - sudo pacman -Rns --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is uninstalled - if ! pacman -Qi "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was uninstalled." - else - # Something went wrong, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to uninstall. Please check the log." - exit 1 - fi - fi -} # Installation of main components printf "\n%s - Installing hyprland packages.... \n" "${NOTE}" diff --git a/install-scripts/Global_functions.sh b/install-scripts/Global_functions.sh new file mode 100755 index 0000000..133b7ff --- /dev/null +++ b/install-scripts/Global_functions.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# 💫 https://github.com/JaKooLit 💫 # +# Global Functions for Scripts # + +set -e + +# Set some colors for output messages +OK="$(tput setaf 2)[OK]$(tput sgr0)" +ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" +NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" +WARN="$(tput setaf 166)[WARN]$(tput sgr0)" +CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" +ORANGE=$(tput setaf 166) +YELLOW=$(tput setaf 3) +RESET=$(tput sgr0) + + +# Create Directory for Install Logs +if [ ! -d Install-Logs ]; then + mkdir Install-Logs +fi + +# Function for installing packages +install_package_pacman() { + # Checking if package is already installed + if pacman -Q "$1" &>/dev/null ; then + echo -e "${OK} $1 is already installed. Skipping..." + else + # Package not installed + echo -e "${NOTE} Installing $1 ..." + sudo pacman -S --noconfirm "$1" 2>&1 | tee -a "$LOG" + # Making sure package is installed + if pacman -Q "$1" &>/dev/null ; then + echo -e "${OK} $1 was installed." + else + # Something is missing, exiting to review log + echo -e "${ERROR} $1 failed to install. Please check the $LOG. You may need to install manually." + exit 1 + fi + fi +} + + +ISAUR=$(command -v yay || command -v paru) + +# Function for installing packages +install_package() { + # Checking if package is already installed + if $ISAUR -Q "$1" &>> /dev/null ; then + echo -e "${OK} $1 is already installed. Skipping..." + else + # Package not installed + echo -e "${NOTE} Installing $1 ..." + $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" + # Making sure package is installed + if $ISAUR -Q "$1" &>> /dev/null ; then + echo -e "\e[1A\e[K${OK} $1 was installed." + else + # Something is missing, exiting to review log + echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" + exit 1 + fi + fi +} + +# Function for uninstalling packages +uninstall_package() { + # Checking if package is installed + if pacman -Qi "$1" &>> /dev/null ; then + # Package is installed + echo -e "${NOTE} Uninstalling $1 ..." + sudo pacman -Rns --noconfirm "$1" 2>&1 | tee -a "$LOG" + # Making sure package is uninstalled + if ! pacman -Qi "$1" &>> /dev/null ; then + echo -e "\e[1A\e[K${OK} $1 was uninstalled." + else + # Something went wrong, exiting to review log + echo -e "\e[1A\e[K${ERROR} $1 failed to uninstall. Please check the log." + exit 1 + fi + fi +} \ No newline at end of file diff --git a/install-scripts/InputGroup.sh b/install-scripts/InputGroup.sh index 0b32ec0..b98c995 100755 --- a/install-scripts/InputGroup.sh +++ b/install-scripts/InputGroup.sh @@ -11,25 +11,11 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PARENT_DIR="$SCRIPT_DIR/.." cd "$PARENT_DIR" || exit 1 +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_input.log" -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - while true; do echo "${WARN} This script will add or remove your user from the 'input' group." echo "${NOTE} Please note that adding yourself to the 'input' group might be necessary for waybar keyboard-state functionality." diff --git a/install-scripts/bluetooth.sh b/install-scripts/bluetooth.sh index 945b68c..4eafee4 100755 --- a/install-scripts/bluetooth.sh +++ b/install-scripts/bluetooth.sh @@ -9,49 +9,18 @@ blueman ) ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## +# Determine the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Change the working directory to the parent directory of the script +PARENT_DIR="$SCRIPT_DIR/.." +cd "$PARENT_DIR" || exit 1 + +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_bluetooth.log" -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - -ISAUR=$(command -v yay || command -v paru) - -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} - # Bluetooth printf "${NOTE} Installing Bluetooth Packages...\n" for BLUE in "${blue[@]}"; do diff --git a/install-scripts/dotfiles.sh b/install-scripts/dotfiles.sh index e9893ae..75576d6 100755 --- a/install-scripts/dotfiles.sh +++ b/install-scripts/dotfiles.sh @@ -4,21 +4,7 @@ ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" printf "${NOTE} Downloading / Checking for existing Hyprland-Dots.tar.gz...\n" diff --git a/install-scripts/gtk_themes.sh b/install-scripts/gtk_themes.sh index 9c41055..b384462 100755 --- a/install-scripts/gtk_themes.sh +++ b/install-scripts/gtk_themes.sh @@ -16,49 +16,11 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PARENT_DIR="$SCRIPT_DIR/.." cd "$PARENT_DIR" || exit 1 +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_themes.log" -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - -ISAUR=$(command -v yay || command -v paru) - -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} - # installing engine needed for gtk themes for PKG1 in "${engine[@]}"; do diff --git a/install-scripts/hyprland.sh b/install-scripts/hyprland.sh index 789f87f..389dccb 100755 --- a/install-scripts/hyprland.sh +++ b/install-scripts/hyprland.sh @@ -7,48 +7,18 @@ hyprland ) ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## + +# Determine the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Change the working directory to the parent directory of the script +PARENT_DIR="$SCRIPT_DIR/.." +cd "$PARENT_DIR" || exit 1 + # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_hyprland.log" -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - -ISAUR=$(command -v yay || command -v paru) - -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" # Removing other Hyprland to avoid conflict printf "${YELLOW} Checking for other hyprland packages and remove if any..${RESET}\n" diff --git a/install-scripts/nvidia.sh b/install-scripts/nvidia.sh index 323d99a..413fd7f 100755 --- a/install-scripts/nvidia.sh +++ b/install-scripts/nvidia.sh @@ -15,48 +15,18 @@ hypr=( ) ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## +# Determine the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Change the working directory to the parent directory of the script +PARENT_DIR="$SCRIPT_DIR/.." +cd "$PARENT_DIR" || exit 1 + +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_nvidia.log" -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - -ISAUR=$(command -v yay || command -v paru) - -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} # nvidia stuff printf "${YELLOW} Checking for other hyprland packages and remove if any..${RESET}\n" diff --git a/install-scripts/paru.sh b/install-scripts/paru.sh index c58d2ea..46bcd0f 100755 --- a/install-scripts/paru.sh +++ b/install-scripts/paru.sh @@ -6,7 +6,7 @@ ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## # Set the name of the log file to include the current date and time -LOG="Install-Logs/install-$(date +%d-%H%M%S)_paru.log" +LOG="install-$(date +%d-%H%M%S)_paru.log" # Set some colors for output messages OK="$(tput setaf 2)[OK]$(tput sgr0)" @@ -24,6 +24,10 @@ if [ ! -d Install-Logs ]; then mkdir Install-Logs fi +if [ ! -d paru-bin ]; then + rm -rf paru-bin 2>&1 | tee -a "$LOG" +fi + # Check for AUR helper and install if not found ISAUR=$(command -v yay || command -v paru) @@ -35,6 +39,10 @@ else git clone https://aur.archlinux.org/paru-bin.git || { printf "%s - Failed to clone paru from AUR\n" "${ERROR}"; exit 1; } cd paru-bin || { printf "%s - Failed to enter paru-bin directory\n" "${ERROR}"; exit 1; } makepkg -si --noconfirm 2>&1 | tee -a "$LOG" || { printf "%s - Failed to install paru from AUR\n" "${ERROR}"; exit 1; } + + # moving install logs in to Install-Logs folder + mv $LOG ../Install-Logs/ || true + cd .. fi # Update system before proceeding diff --git a/install-scripts/pipewire.sh b/install-scripts/pipewire.sh index 0150216..3ea0232 100755 --- a/install-scripts/pipewire.sh +++ b/install-scripts/pipewire.sh @@ -11,49 +11,21 @@ pipewire=( ) ############## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ############## +# Set some colors for output messages +# Determine the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Change the working directory to the parent directory of the script +PARENT_DIR="$SCRIPT_DIR/.." +cd "$PARENT_DIR" || exit 1 + +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_pipewire.log" -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - ISAUR=$(command -v yay || command -v paru) -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} - # Removal of pulseaudio printf "${YELLOW}Removing pulseaudio stuff...${RESET}\n" for pulseaudio in pulseaudio pulseaudio-alsa pulseaudio-bluetooth; do diff --git a/install-scripts/rog.sh b/install-scripts/rog.sh index 59acca0..fad133d 100755 --- a/install-scripts/rog.sh +++ b/install-scripts/rog.sh @@ -10,49 +10,11 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PARENT_DIR="$SCRIPT_DIR/.." cd "$PARENT_DIR" || exit 1 +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_rog.log" -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - -ISAUR=$(command -v yay || command -v paru) - -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} - ### Install software for Asus ROG laptops ### printf " Installing ASUS ROG packages...\n" diff --git a/install-scripts/sddm.sh b/install-scripts/sddm.sh index 9a21ef8..a72e95e 100755 --- a/install-scripts/sddm.sh +++ b/install-scripts/sddm.sh @@ -18,48 +18,11 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PARENT_DIR="$SCRIPT_DIR/.." cd "$PARENT_DIR" || exit 1 +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" + # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_sddm.log" -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - - -ISAUR=$(command -v yay || command -v paru) -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} # SDDM # Check if SDDM is already installed diff --git a/install-scripts/thunar.sh b/install-scripts/thunar.sh index af66b53..04f9524 100755 --- a/install-scripts/thunar.sh +++ b/install-scripts/thunar.sh @@ -19,49 +19,11 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PARENT_DIR="$SCRIPT_DIR/.." cd "$PARENT_DIR" || exit 1 -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_thunar.log" -ISAUR=$(command -v yay || command -v paru) - -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} - # Thunar printf "${NOTE} Installing Thunar Packages...\n" for THUNAR in "${thunar[@]}"; do diff --git a/install-scripts/xdph.sh b/install-scripts/xdph.sh index 1a3ba86..3a2ee1a 100755 --- a/install-scripts/xdph.sh +++ b/install-scripts/xdph.sh @@ -8,49 +8,19 @@ xdg-desktop-portal-gtk ) ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## -set -e -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) +# Determine the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# Change the working directory to the parent directory of the script +PARENT_DIR="$SCRIPT_DIR/.." +cd "$PARENT_DIR" || exit 1 -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_xdph.log" -ISAUR=$(command -v yay || command -v paru) - -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} - # XDG-DESKTOP-PORTAL-HYPRLAND for xdgs in "${xdg[@]}"; do install_package "$xdgs" 2>&1 | tee -a "$LOG" diff --git a/install-scripts/yay.sh b/install-scripts/yay.sh index 27ce734..446fa9e 100755 --- a/install-scripts/yay.sh +++ b/install-scripts/yay.sh @@ -6,7 +6,7 @@ ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## # Set the name of the log file to include the current date and time -LOG="Install-Logs/install-$(date +%d-%H%M%S)_yay.log" +LOG="install-$(date +%d-%H%M%S)_yay.log" # Set some colors for output messages OK="$(tput setaf 2)[OK]$(tput sgr0)" @@ -23,6 +23,11 @@ if [ ! -d Install-Logs ]; then mkdir Install-Logs fi +# Check Existing yay-bin +if [ ! -d yay-bin ]; then + rm -rf yay-bin 2>&1 | tee -a "$LOG" +fi + # Check for AUR helper and install if not found ISAUR=$(command -v yay || command -v paru) if [ -n "$ISAUR" ]; then @@ -33,6 +38,10 @@ else git clone https://aur.archlinux.org/yay-bin.git || { printf "%s - Failed to clone yay from AUR\n" "${ERROR}"; exit 1; } cd yay-bin || { printf "%s - Failed to enter yay-bin directory\n" "${ERROR}"; exit 1; } makepkg -si --noconfirm 2>&1 | tee -a "$LOG" || { printf "%s - Failed to install yay from AUR\n" "${ERROR}"; exit 1; } + + # moving install logs in to Install-Logs folder + mv $LOG ../Install-Logs/ || true + cd .. fi # Update system before proceeding diff --git a/install-scripts/zsh.sh b/install-scripts/zsh.sh index 3db16ce..cbbf853 100755 --- a/install-scripts/zsh.sh +++ b/install-scripts/zsh.sh @@ -16,50 +16,11 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" PARENT_DIR="$SCRIPT_DIR/.." cd "$PARENT_DIR" || exit 1 -set -e - -# Set some colors for output messages -OK="$(tput setaf 2)[OK]$(tput sgr0)" -ERROR="$(tput setaf 1)[ERROR]$(tput sgr0)" -NOTE="$(tput setaf 3)[NOTE]$(tput sgr0)" -WARN="$(tput setaf 166)[WARN]$(tput sgr0)" -CAT="$(tput setaf 6)[ACTION]$(tput sgr0)" -ORANGE=$(tput setaf 166) -YELLOW=$(tput setaf 3) -RESET=$(tput sgr0) - - -# Create Directory for Install Logs -if [ ! -d Install-Logs ]; then - mkdir Install-Logs -fi - +source "$(dirname "$(readlink -f "$0")")/Global_functions.sh" # Set the name of the log file to include the current date and time LOG="Install-Logs/install-$(date +%d-%H%M%S)_zsh.log" -ISAUR=$(command -v yay || command -v paru) - -# Function for installing packages -install_package() { - # Checking if package is already installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "${OK} $1 is already installed. Skipping..." - else - # Package not installed - echo -e "${NOTE} Installing $1 ..." - $ISAUR -S --noconfirm "$1" 2>&1 | tee -a "$LOG" - # Making sure package is installed - if $ISAUR -Q "$1" &>> /dev/null ; then - echo -e "\e[1A\e[K${OK} $1 was installed." - else - # Something is missing, exiting to review log - echo -e "\e[1A\e[K${ERROR} $1 failed to install :( , please check the install.log. You may need to install manually! Sorry I have tried :(" - exit 1 - fi - fi -} - ## Optional Pokemon color scripts while true; do read -p "${CAT} OPTIONAL - Do you want to add Pokemon color scripts? (y/n): " choice