From b47a5f7a9abfeae68a3fbc4ef35e3e714f21f98a Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 8 Sep 2024 11:02:58 +0900 Subject: [PATCH 1/3] added a final error check --- install-scripts/bluetooth.sh | 6 +++--- install.sh | 41 +++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/install-scripts/bluetooth.sh b/install-scripts/bluetooth.sh index bbb0301..a16ce67 100755 --- a/install-scripts/bluetooth.sh +++ b/install-scripts/bluetooth.sh @@ -3,9 +3,9 @@ # Bluetooth Stuff # blue=( -bluez -bluez-utils -blueman + bluez + bluez-utils + blueman ) ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## diff --git a/install.sh b/install.sh index 8d409fc..bf96342 100755 --- a/install.sh +++ b/install.sh @@ -259,14 +259,49 @@ if [ "$dots" == "Y" ]; then fi +# Error-checking section +LOG_DIR="Install-Logs" +ERROR_FILE="$LOG_DIR/00-Error.log" + +# Create or clear the error file +: > "$ERROR_FILE" + +# Check if the Install-Logs directory exists +if [ -d "$LOG_DIR" ]; then + # Iterate through each file in the Install-Logs directory + for log_file in "$LOG_DIR"/*; do + # Check if it's a file + if [ -f "$log_file" ]; then + # Search for lines containing the word "error" (case-insensitive) in the log file + if grep -i "error" "$log_file" > /dev/null; then + # If errors are found, add the filename to the error file + echo "${WARN} Errors found in file: $(basename "$log_file")" >> "$ERROR_FILE" + fi + fi + done + + # Check if the error file has any content + if [ -s "$ERROR_FILE" ]; then + echo "${ERROR} Errors were found. See $ERROR_FILE for details." + else + echo "${OK} No errors were found." + # Optionally remove the error file if it's empty + rm "$ERROR_FILE" + fi +else + echo "Directory $LOG_DIR does not exist or could not be found." +fi + +printf "\n%.0s" {1..1} # Check if hyprland or hyprland-git is installed if pacman -Q hyprland &> /dev/null || pacman -Q hyprland-git &> /dev/null; then - printf "\n${OK} Yey! Installation Completed.\n" + printf "\n${OK} Hyprland is installed. However, there may some errors during installation " + printf "\n${CAT} Please see the errors in Install-Logs as stated above\n" sleep 2 printf "\n${NOTE} You can start Hyprland by typing Hyprland (IF SDDM is not installed) (note the capital H!).\n" printf "\n" - printf "\n${NOTE} It is highly recommended to reboot your system.\n\n" + printf "\n${NOTE} However, It is highly recommended to reboot your system.\n\n" # Prompt user to reboot read -rp "${CAT} Would you like to reboot now? (y/n): " HYP @@ -281,6 +316,6 @@ if pacman -Q hyprland &> /dev/null || pacman -Q hyprland-git &> /dev/null; then fi else # Print error message if neither package is installed - printf "\n${WARN} Hyprland failed to install. Please check Install-Logs...\n\n" + printf "\n${WARN} Hyprland failed to install. Please check Error Log and Install-Logs directory...\n\n" exit 1 fi From 16f3c44ec8e2b88e5d55b682a265026accb615c2 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 8 Sep 2024 11:25:42 +0900 Subject: [PATCH 2/3] Added error checks --- install-scripts/00-hypr-pkgs.sh | 1 + install.sh | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/install-scripts/00-hypr-pkgs.sh b/install-scripts/00-hypr-pkgs.sh index 961873f..4ca0d50 100755 --- a/install-scripts/00-hypr-pkgs.sh +++ b/install-scripts/00-hypr-pkgs.sh @@ -73,6 +73,7 @@ uninstall=( dunst mako rofi + wallust-git ) ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ## diff --git a/install.sh b/install.sh index bf96342..b90f18e 100755 --- a/install.sh +++ b/install.sh @@ -21,8 +21,8 @@ fi clear # Check if PulseAudio package is installed -if pacman -Qq pulseaudio >/dev/null 2>&1; then - echo "$ERROR PulseAudio is installed. Uninstall it first or edit install.sh on line 211 (execute_script 'pipewire.sh')." +if pacman -Qq | grep -qw pulseaudio; then + echo "$ERROR PulseAudio is detected as installed. Uninstall it first or edit install.sh on line 211 (execute_script 'pipewire.sh')." exit 1 fi @@ -259,6 +259,8 @@ if [ "$dots" == "Y" ]; then fi +printf "\n%.0s" {1..3} + # Error-checking section LOG_DIR="Install-Logs" ERROR_FILE="$LOG_DIR/00-Error.log" @@ -282,7 +284,7 @@ if [ -d "$LOG_DIR" ]; then # Check if the error file has any content if [ -s "$ERROR_FILE" ]; then - echo "${ERROR} Errors were found. See $ERROR_FILE for details." + echo "${ERROR} Errors encountered during Installation. See $ERROR_FILE for details." else echo "${OK} No errors were found." # Optionally remove the error file if it's empty From 4f7ff525239e9cda29908f098ff3223c4da99e2a Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 8 Sep 2024 11:40:30 +0900 Subject: [PATCH 3/3] Added final error checks on install-logs --- CHANGELOGS.md | 3 +++ install.sh | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOGS.md b/CHANGELOGS.md index d03de31..6982440 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -1,5 +1,8 @@ ## Changelogs +## 08 Sep 2024 +- Added final error checks on install-logs + ## 07 Sep 2024 - added pulseaudio check - added sof-firmware diff --git a/install.sh b/install.sh index b90f18e..96c1bdc 100755 --- a/install.sh +++ b/install.sh @@ -259,6 +259,8 @@ if [ "$dots" == "Y" ]; then fi +clear + printf "\n%.0s" {1..3} # Error-checking section @@ -287,8 +289,6 @@ if [ -d "$LOG_DIR" ]; then echo "${ERROR} Errors encountered during Installation. See $ERROR_FILE for details." else echo "${OK} No errors were found." - # Optionally remove the error file if it's empty - rm "$ERROR_FILE" fi else echo "Directory $LOG_DIR does not exist or could not be found."