adjusted install.sh

This commit is contained in:
JaKooLit
2025-03-02 13:21:02 +09:00
parent 54ff099d51
commit 16f1b2418d

View File

@@ -19,17 +19,24 @@ BLUE="$(tput setaf 4)"
SKY_BLUE="$(tput setaf 6)"
RESET="$(tput sgr0)"
# Create Directory for Install Logs
if [ ! -d Install-Logs ]; then
mkdir Install-Logs
fi
# Set the name of the log file to include the current date and time
LOG="Install-Logs/01-Hyprland-Install-Scripts-$(date +%d-%H%M%S).log"
# Check if running as root. If root, script will exit
if [[ $EUID -eq 0 ]]; then
echo "${ERROR} This script should ${WARNING}NOT${RESET} be executed as root!! Exiting......."
echo "${ERROR} This script should ${WARNING}NOT${RESET} be executed as root!! Exiting......." | tee -a "$LOG"
printf "\n%.0s" {1..2}
exit 1
fi
# Check if PulseAudio package is installed
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')."
echo "$ERROR PulseAudio is detected as installed. Uninstall it first or edit install.sh on line 211 (execute_script 'pipewire.sh')." | tee -a "$LOG"
printf "\n%.0s" {1..2}
exit 1
fi
@@ -41,17 +48,17 @@ else
echo "$NOTE Install base-devel.........."
if sudo pacman -S --noconfirm base-devel; then
echo "👌 ${OK} base-devel has been installed successfully."
echo "👌 ${OK} base-devel has been installed successfully." | tee -a "$LOG"
else
echo "$ERROR base-devel not found nor cannot be installed."
echo "$ACTION Please install base-devel manually before running this script... Exiting"
echo "$ERROR base-devel not found nor cannot be installed." | tee -a "$LOG"
echo "$ACTION Please install base-devel manually before running this script... Exiting" | tee -a "$LOG"
exit 1
fi
fi
# install whiptails if detected not installed. Necessary for this version
if ! command -v whiptail >/dev/null; then
echo "${NOTE} - whiptail is not installed. Installing..."
echo "${NOTE} - whiptail is not installed. Installing..." | tee -a "$LOG"
sudo pacman -S --noconfirm whiptail
printf "\n%.0s" {1..1}
fi
@@ -77,30 +84,23 @@ NOTE: If you are installing on a VM, ensure to enable 3D acceleration else Hyprl
if ! whiptail --title "Proceed with Installation?" \
--yesno "Would you like to proceed?" 7 50; then
echo -e "\n"
echo "${INFO} You 🫵 chose ${YELLOW}NOT${RESET} to proceed. ${YELLOW}Exiting...${RESET}"
echo "${INFO} You 🫵 chose ${YELLOW}NOT${RESET} to proceed. ${YELLOW}Exiting...${RESET}" | tee -a "$LOG"
echo -e "\n"
exit 1
fi
echo "👌 ${OK} 🇵🇭 ${MAGENTA}KooL..${RESET} ${SKY_BLUE}lets continue with the installation...${RESET}"
echo "👌 ${OK} 🇵🇭 ${MAGENTA}KooL..${RESET} ${SKY_BLUE}lets continue with the installation...${RESET}" | tee -a "$LOG"
sleep 1
printf "\n%.0s" {1..1}
# install pciutils if detected not installed. Necessary for detecting GPU
if ! pacman -Qs pciutils > /dev/null; then
echo "${NOTE} - pciutils is not installed. Installing..."
echo "${NOTE} - pciutils is not installed. Installing..." | tee -a "$LOG"
sudo pacman -S --noconfirm pciutils
printf "\n%.0s" {1..1}
fi
# Set the name of the log file to include the current date and time
LOG="install-$(date +%d-%H%M%S).log"
# Create Directory for Install Logs
if [ ! -d Install-Logs ]; then
mkdir Install-Logs
fi
# Path to the install-scripts directory
script_directory=install-scripts
@@ -163,11 +163,11 @@ if ! command -v yay &>/dev/null && ! command -v paru &>/dev/null; then
3>&1 1>&2 2>&3)
if [ -z "$aur_helper" ]; then
echo "${INFO} You 🫵 cancelled the selection. ${YELLOW}Goodbye!${RESET}"
echo "${INFO} You 🫵 cancelled the selection. ${YELLOW}Goodbye!${RESET}" | tee -a "$LOG"
exit 0
fi
echo "${INFO} - You selected: $aur_helper as your AUR helper"
echo "${INFO} - You selected: $aur_helper as your AUR helper" | tee -a "$LOG"
aur_helper=$(echo "$aur_helper" | tr -d '"')
@@ -217,7 +217,7 @@ fi
# Initialize the options array for whiptail checklist
options_command=(
whiptail --title "Select Options" --checklist "Choose options to install or configure\nNOTE: spacebar to select" 28 85 20
whiptail --title "Select Options" --checklist "Choose options to install or configure\nNOTE: 'SPACEBAR' to select & 'TAB' key to change selection" 28 85 20
)
# Add NVIDIA options if detected
@@ -228,7 +228,7 @@ if [ "$nvidia_detected" == "true" ]; then
)
fi
# Check if user is already in the 'input' group
# Add 'input_group' option if user is not in input group
input_group_detected=false
if ! groups "$(whoami)" | grep -q '\binput\b'; then
input_group_detected=true
@@ -257,46 +257,72 @@ options_command+=(
"dots" "Download and install pre-configured KooL Hyprland dotfiles?" "OFF"
)
# Capture the selected options before the while loop starts
while true; do
# Execute the checklist and capture the selected options
selected_options=$("${options_command[@]}" 3>&1 1>&2 2>&3)
# Check if the user pressed Cancel (exit status 1)
if [ $? -ne 0 ]; then
echo -e "\n"
echo "${INFO} You 🫵 cancelled the selection. ${YELLOW}Goodbye!${RESET}"
echo "${INFO} You 🫵 cancelled the selection. ${YELLOW}Goodbye!${RESET}" | tee -a "$LOG"
exit 0 # Exit the script if Cancel is pressed
fi
# If no option was selected, notify and restart the selection
if [ -z "$selected_options" ]; then
whiptail --title "Warning" --msgbox "⚠️ No options were selected. Please select at least one option." 10 60
whiptail --title "Warning" --msgbox "No options were selected. Please select at least one option." 10 60
continue # Return to selection if no options selected
fi
# Strip the quotes and trim spaces if necessary (sanitize the input)
selected_options=$(echo "$selected_options" | tr -d '"' | tr -s ' ')
# Convert selected options into an array (preserving spaces in values)
IFS=' ' read -r -a options <<< "$selected_options"
# Prepare Confirmation Message
# Check if the "dots" option was selected
dots_selected="OFF"
for option in "${options[@]}"; do
if [[ "$option" == "dots" ]]; then
dots_selected="ON"
break
fi
done
# If "dots" is not selected, show a note and ask the user to proceed or return to choices
if [[ "$dots_selected" == "OFF" ]]; then
# Show a note about not selecting the "dots" option
if ! whiptail --title "KooL Hyprland Dot Files" --yesno \
"❓ You have not selected to install the pre-configured KooL Hyprland dotfiles.\n\nKindly NOTE that if you proceed without Dots, Hyprland will start with default vanilla Hyprland configuration and I won't be able to give you support.\n\n🔙 Would you like to continue install without KooL Hyprland Dots or return to choices/options?" \
--yes-button "Continue" --no-button "Return" 15 90; then
echo "🔙 Returning to options..." | tee -a "$LOG"
continue
else
# User chose to continue
echo "${INFO} ⚠️ Continuing WITHOUT the dotfiles installation..." | tee -a "$LOG"
printf "\n%.0s" {1..1}
fi
fi
# Prepare the confirmation message
confirm_message="You have selected the following options:\n\n"
for option in "${options[@]}"; do
confirm_message+=" - $option\n"
done
confirm_message+="\nAre you happy with these choices?"
confirm_message+="\n😀 Are you happy with these choices?"
# onfirmation prompt
# Confirmation prompt
if ! whiptail --title "Confirm Your Choices" --yesno "$(printf "%s" "$confirm_message")" 25 80; then
echo -e "\n"
echo "${SKY_BLUE}You 🫵 cancelled the confirmation${RESET}. ${YELLOW}Exiting...${RESET}"
echo "${SKY_BLUE}You 🫵 cancelled the confirmation${RESET}. ${YELLOW}Exiting...${RESET}" | tee -a "$LOG"
exit 0
fi
echo "👌 ${OK} You confirmed your choices. Proceeding with ${SKY_BLUE}KooL 🇵🇭 Hyprland Installation...${RESET}"
echo "👌 ${OK} You confirmed your choices. Proceeding with ${SKY_BLUE}KooL 🇵🇭 Hyprland Installation...${RESET}" | tee -a "$LOG"
break
done
# Proceed with installation
echo "👌 ${OK} - Proceeding with selected options..."
printf "\n%.0s" {1..1}
# Ensuring base-devel is installed
execute_script "00-base.sh"
@@ -314,15 +340,15 @@ fi
sleep 1
# Run the Hyprland related scripts
echo "Installing KooL Hyprland additional packages..."
echo "Installing KooL Hyprland additional packages..." | tee -a "$LOG"
sleep 1
execute_script "01-hypr-pkgs.sh"
echo "Installing pipewire and pipewire-audio..."
echo "Installing pipewire and pipewire-audio..." | tee -a "$LOG"
sleep 1
execute_script "pipewire.sh"
echo "Installing necessary fonts..."
echo "Installing necessary fonts..." | tee -a "$LOG"
sleep 1
execute_script "fonts.sh"
@@ -345,65 +371,65 @@ for option in "${options[@]}"; do
whiptail --title "Error" --msgbox "One of the following login services is running:\n$active_list\n\nPlease stop & disable it or DO not choose SDDM." 12 60
exec "$0"
else
echo "Installing and configuring SDDM..."
echo "Installing and configuring SDDM..." | tee -a "$LOG"
execute_script "sddm.sh"
fi
;;
nvidia)
echo "Configuring nvidia stuff"
echo "Configuring nvidia stuff" | tee -a "$LOG"
execute_script "nvidia.sh"
;;
nouveau)
echo "blacklisting nouveau"
execute_script "nvidia_nouveau.sh"
execute_script "nvidia_nouveau.sh" | tee -a "$LOG"
;;
gtk_themes)
echo "Installing GTK themes..."
echo "Installing GTK themes..." | tee -a "$LOG"
execute_script "gtk_themes.sh"
;;
input_group)
echo "Adding user into input group..."
echo "Adding user into input group..." | tee -a "$LOG"
execute_script "InputGroup.sh"
;;
ags)
echo "Installing AGS..."
echo "Installing AGS..." | tee -a "$LOG"
execute_script "ags.sh"
;;
xdph)
echo "Installing XDG-DESKTOP-PORTAL-HYPRLAND..."
echo "Installing XDG-DESKTOP-PORTAL-HYPRLAND..." | tee -a "$LOG"
execute_script "xdph.sh"
;;
bluetooth)
echo "Configuring Bluetooth..."
echo "Configuring Bluetooth..." | tee -a "$LOG"
execute_script "bluetooth.sh"
;;
thunar)
echo "Installing Thunar file manager..."
echo "Installing Thunar file manager..." | tee -a "$LOG"
execute_script "thunar.sh"
execute_script "thunar_default.sh"
;;
sddm_theme)
echo "Downloading & Installing Additional SDDM theme..."
echo "Downloading & Installing Additional SDDM theme..." | tee -a "$LOG"
execute_script "sddm_theme.sh"
;;
zsh)
echo "Installing zsh with Oh-My-Zsh..."
echo "Installing zsh with Oh-My-Zsh..." | tee -a "$LOG"
execute_script "zsh.sh"
;;
pokemon)
echo "Adding Pokemon color scripts to terminal..."
echo "Adding Pokemon color scripts to terminal..." | tee -a "$LOG"
execute_script "zsh_pokemon.sh"
;;
rog)
echo "Installing ROG packages..."
echo "Installing ROG packages..." | tee -a "$LOG"
execute_script "rog.sh"
;;
dots)
echo "Installing pre-configured Hyprland dotfiles..."
echo "Installing pre-configured Hyprland dotfiles..." | tee -a "$LOG"
execute_script "dotfiles-main.sh"
;;
*)
echo "Unknown option: $option"
echo "Unknown option: $option" | tee -a "$LOG"
;;
esac
done