From 8995c47902b182ece52a105fe135659944cacbaf Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 3 Feb 2025 00:57:08 +0900 Subject: [PATCH] heh!!!... still tweaking --- install-scripts/Global_functions.sh | 24 ++++++++++++++++++++++++ install.sh | 15 ++------------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/install-scripts/Global_functions.sh b/install-scripts/Global_functions.sh index 938859e..13dda1a 100755 --- a/install-scripts/Global_functions.sh +++ b/install-scripts/Global_functions.sh @@ -15,7 +15,9 @@ MAGENTA="$(tput setaf 5)" ORANGE="$(tput setaf 214)" WARNING="$(tput setaf 1)" YELLOW="$(tput setaf 3)" +GREEN="$(tput setaf 2)" BLUE="$(tput setaf 4)" +SKY_BLUE="$(tput setaf 6)" RESET="$(tput sgr0)" # Create Directory for Install Logs @@ -92,3 +94,25 @@ install_package() { fi fi } + +# Function for uninstalling packages +uninstall_package() { + local pkg="$1" + + # Checking if package is installed + if pacman -Qi "$pkg" &>> /dev/null ; then + # Package is installed + echo -e "${NOTE} Uninstalling $pkg ..." + sudo pacman -R --noconfirm "$pkg" 2>&1 | tee -a "$LOG" | grep -v "error: target not found" + # Check if the package was uninstalled + if ! pacman -Qi "$pkg" &>> /dev/null ; then + echo -e "\e[1A\e[K${OK} $pkg was uninstalled." + else + echo -e "\e[1A\e[K${ERROR} $pkg failed to uninstall. Please check the log." + return 1 + fi + else + echo -e "${NOTE} $pkg is not installed, skipping uninstallation." + fi + return 0 +} \ No newline at end of file diff --git a/install.sh b/install.sh index 34c78ce..6810e90 100755 --- a/install.sh +++ b/install.sh @@ -69,14 +69,14 @@ read -p "${SKY_BLUE}Would you like to proceed? (y/n): ${RESET}" proceed printf "\n%.0s" {1..2} if [ "$proceed" != "y" ]; then - echo "Installation aborted." + echo "${INFO} Installation aborted No changes done! Goodbye!" printf "\n%.0s" {1..2} exit 1 fi printf "\n%.0s" {1..2} -echo "${NOTE} ${WARNING}ATTENTION: Choosing Y on use preset question will install also ${MAGENTA}nvidia packages${RESET}!" +echo "${NOTE} ${WARNING}ATTENTION: Choosing Y on use preset question will install also ${MAGENTA}nvidia packages!!!${RESET}" echo "${YELLOW}CTRL C or Q to cancel and edit the file ${MAGENTA}preset.sh${RESET} ${RESET}" echo "If you are not sure what to do, answer N in here" read -p "${SKY_BLUE}Would you like to Use ${YELLOW}Preset Install Settings?${RESET} (See note above)? (y/n): ${RESET}" use_preset @@ -96,17 +96,6 @@ colorize_prompt() { # Set the name of the log file to include the current date and time LOG="install-$(date +%d-%H%M%S).log" -# Initialize variables to store user responses -# aur_helper="" -# bluetooth="" -# dots="" -# gtk_themes="" -# nvidia="" -# rog="" -# sddm="" -# thunar="" -# xdph="" -# zsh="" # Create Directory for Install Logs if [ ! -d Install-Logs ]; then