From d900fe41749b395a299bb8021c5e1d473c5ebc24 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 8 Sep 2024 11:39:42 +0900 Subject: [PATCH] Added final error checks on install-logs --- CHANGELOGS.md | 3 +++ install.sh | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/CHANGELOGS.md b/CHANGELOGS.md index e761d73..87a85a9 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 - Fix installation issue on hyprlock and xdph - disabled imagemagick compilation from source diff --git a/install.sh b/install.sh index 6aa075d..554c65e 100755 --- a/install.sh +++ b/install.sh @@ -246,9 +246,45 @@ fi clear +printf "\n%.0s" {1..3} + +# 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 encountered during Installation. See $ERROR_FILE for details." + else + echo "${OK} No errors were found." + fi +else + echo "Directory $LOG_DIR does not exist or could not be found." +fi + +printf "\n%.0s" {1..1} + # Check if either hyprland or hyprland-git is installed if dpkg -l | grep -qw hyprland || dpkg -l | grep -qw hyprland-git; 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" @@ -267,7 +303,7 @@ if dpkg -l | grep -qw hyprland || dpkg -l | grep -qw hyprland-git; 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${NOTE} Hyprland failed to install. Please check Install-Logs...\n\n" exit 1 fi