mirror of
https://github.com/JaKooLit/Debian-Hyprland.git
synced 2025-12-21 10:20:12 +01:00
Added Essential Packages final check in lieu of errors from Install log files in Install-Logs directory
This commit is contained in:
parent
1662f6a810
commit
f499ab4303
@ -1,5 +1,8 @@
|
||||
## Changelogs
|
||||
|
||||
## 14 Sep 2024
|
||||
- Added Essential Packages final check in lieu of errors from Install log files in Install-Logs directory
|
||||
|
||||
## 10 Sep 2024
|
||||
- added background check of known login managers if they are active if user chose to install sddm
|
||||
|
||||
|
||||
108
install-scripts/03-Final-Check.sh
Normal file
108
install-scripts/03-Final-Check.sh
Normal file
@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
# 💫 https://github.com/JaKooLit 💫 #
|
||||
# Final checking if packages are installed
|
||||
# NOTE: These package checks are only the essentials
|
||||
|
||||
packages=(
|
||||
imagemagick
|
||||
sway-notification-center
|
||||
waybar
|
||||
wl-clipboard
|
||||
cliphist
|
||||
wlogout
|
||||
kitty
|
||||
hypridle
|
||||
hyprlock
|
||||
hyprland
|
||||
)
|
||||
|
||||
# Local packages that should be in /usr/local/bin/
|
||||
local_pkgs_installed=(
|
||||
ags
|
||||
rofi
|
||||
hypridle
|
||||
hyprlock
|
||||
wallust
|
||||
)
|
||||
|
||||
local_pkgs_installed_2=(
|
||||
swww
|
||||
)
|
||||
|
||||
## 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/00_CHECK-$(date +%d-%H%M%S)_installed.log"
|
||||
|
||||
printf "\n%s - Final Check if Essential packages were installed \n" "${NOTE}"
|
||||
# Initialize an empty array to hold missing packages
|
||||
missing=()
|
||||
local_missing=()
|
||||
local_missing_2=()
|
||||
|
||||
# Function to check if a package is installed using dpkg
|
||||
is_installed_dpkg() {
|
||||
dpkg -l | grep -q "^ii $1 "
|
||||
}
|
||||
|
||||
# Loop through each package
|
||||
for pkg in "${packages[@]}"; do
|
||||
# Check if the package is installed via dpkg
|
||||
if ! is_installed_dpkg "$pkg"; then
|
||||
missing+=("$pkg")
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for local packages
|
||||
for pkg1 in "${local_pkgs_installed[@]}"; do
|
||||
if ! [ -f "/usr/local/bin/$pkg1" ]; then
|
||||
local_missing+=("$pkg1")
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for local packages in /usr/bin
|
||||
for pkg2 in "${local_pkgs_installed_2[@]}"; do
|
||||
if ! [ -f "/usr/bin/$pkg2" ]; then
|
||||
local_missing_2+=("$pkg2")
|
||||
fi
|
||||
done
|
||||
|
||||
# Log missing packages
|
||||
if [ ${#missing[@]} -eq 0 ] && [ ${#local_missing[@]} -eq 0 ] && [ ${#local_missing_2[@]} -eq 0 ]; then
|
||||
echo "${OK} All essential packages are installed." | tee -a "$LOG"
|
||||
else
|
||||
if [ ${#missing[@]} -ne 0 ]; then
|
||||
echo "${WARN} The following packages are not installed and will be logged:"
|
||||
for pkg in "${missing[@]}"; do
|
||||
echo "$pkg"
|
||||
echo "$pkg" >> "$LOG" # Log the missing package to the file
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ${#local_missing[@]} -ne 0 ]; then
|
||||
echo "${WARN} The following local packages are missing from /usr/local/bin/ and will be logged:"
|
||||
for pkg1 in "${local_missing[@]}"; do
|
||||
echo "$pkg1 is not installed. can't find it in /usr/local/bin/"
|
||||
echo "$pkg1" >> "$LOG" # Log the missing local package to the file
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ${#local_missing_2[@]} -ne 0 ]; then
|
||||
echo "${WARN} The following local packages are missing from /usr/bin/ and will be logged:"
|
||||
for pkg2 in "${local_missing_2[@]}"; do
|
||||
echo "$pkg2 is not installed. can't find it in /usr/bin/"
|
||||
echo "$pkg2" >> "$LOG" # Log the missing local package to the file
|
||||
done
|
||||
fi
|
||||
|
||||
# Add a timestamp when the missing packages were logged
|
||||
echo "${NOTE} Missing packages logged at $(date)" >> "$LOG"
|
||||
fi
|
||||
57
install.sh
57
install.sh
@ -195,11 +195,11 @@ sleep 1
|
||||
sudo apt update
|
||||
|
||||
# execute pre clean up
|
||||
execute_script "01-pre-cleanup.sh"
|
||||
execute_script "02-pre-cleanup.sh"
|
||||
|
||||
# Install hyprland packages
|
||||
execute_script "00-dependencies.sh"
|
||||
execute_script "00-hypr-pkgs.sh"
|
||||
execute_script "01-hypr-pkgs.sh"
|
||||
execute_script "fonts.sh"
|
||||
execute_script "wallust.sh"
|
||||
|
||||
@ -266,64 +266,33 @@ 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..2}
|
||||
# final check essential packages if it is installed
|
||||
execute_script "03-Final-Check.sh"
|
||||
|
||||
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} Hyprland is installed. However, there may some errors during installation "
|
||||
printf "\n${CAT} Please see the errors in Install-Logs as stated above\n"
|
||||
if dpkg -l | grep -qw hyprland; then
|
||||
printf "\n${OK} Hyprland is installed. However, some essential packages may not be installed Please see above!"
|
||||
printf "\n${CAT} Ignore this message if it states 'All essential packages are installed.'\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} You can start Hyprland by typing 'Hyprland' (IF SDDM is not installed) (note the capital H!).\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
|
||||
|
||||
# Check if the user answered 'y' or 'Y'
|
||||
if [[ "$HYP" =~ ^[Yy]$ ]]; then
|
||||
if [[ "$nvidia" == "Y" ]]; then
|
||||
echo "${NOTE} NVIDIA GPU detected. Rebooting the system..."
|
||||
systemctl reboot
|
||||
else
|
||||
systemctl reboot
|
||||
fi
|
||||
systemctl reboot
|
||||
fi
|
||||
else
|
||||
# Print error message if neither package is installed
|
||||
printf "\n${NOTE} Hyprland failed to install. Please check Install-Logs...\n\n"
|
||||
printf "\n${WARN} Hyprland failed to install. Please check 00_CHECK-time_installed.log and other files Install-Logs/ directory...\n\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user