Merge pull request #17 from PostCyberPunk/main

feat(preset): Added a Preset for Quick Installation / Update without prompting the user to answer questions
This commit is contained in:
Ja.KooLit 2024-01-05 22:38:07 +09:00 committed by GitHub
commit dc6f780932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 114 additions and 25 deletions

View File

@ -2,6 +2,9 @@
# 💫 https://github.com/JaKooLit 💫 #
# Adding users into input group #
if [[ $USE_PRESET = [Yy] ]]; then
source ./preset.sh
fi
## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ##
# Determine the directory where the script is located
@ -20,9 +23,11 @@ while true; do
echo "${WARN} This script will add or remove your user from the 'input' group."
echo "${NOTE} Please note that adding yourself to the 'input' group might be necessary for waybar keyboard-state functionality."
read -p "${YELLOW}Do you want to proceed? (y/n): ${RESET}" choice
if [[ -z $input_group_choid ]]; then
read -p "${YELLOW}Do you want to proceed? (y/n): ${RESET}" input_group_choid
fi
if [[ $choice == "y" || $choice == "Y" ]]; then
if [[ $input_group_choid == "y" || $input_group_choid == "Y" ]]; then
# Check if the 'input' group exists
if grep -q '^input:' /etc/group; then
echo "${OK} 'input' group exists."
@ -41,7 +46,7 @@ while true; do
# Log the addition of the user to the 'input' group
echo "User added to 'input' group" >> "$LOG"
break # Break out of the loop if 'yes' is chosen
elif [[ $choice == "n" || $choice == "N" ]]; then
elif [[ $input_group_choid == "n" || $input_group_choid == "N" ]]; then
echo "${NOTE} No changes made. Exiting the script."
break # Break out of the loop if 'no' is chosen
else
@ -49,4 +54,4 @@ while true; do
fi
done
clear
clear

View File

@ -1,6 +1,9 @@
#!/bin/bash
# 💫 https://github.com/JaKooLit 💫 #
# Hyprland-Dots to download from Releases #
if [[ $USE_PRESET = [Yy] ]]; then
source ./preset.sh
fi
## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ##
@ -28,7 +31,9 @@ if [ -f Hyprland-Dots.tar.gz ]; then
exit 0
else
echo -e "${WARN} Hyprland-Dots.tar.gz is outdated (Existing version: $existing_version, Latest version: $latest_version)."
read -p "Do you want to upgrade to the latest version? (y/n): " upgrade_choice
if [[ -z $upgrade_choice ]]; then
read -p "Do you want to upgrade to the latest version? (y/n): " upgrade_choice
fi
if [ "$upgrade_choice" = "y" ]; then
echo -e "${NOTE} Proceeding to download the latest release." 2>&1 | tee -a "../Install-Logs/install-$(date +'%d-%H%M%S')_dotfiles.log"

View File

@ -1,6 +1,9 @@
#!/bin/bash
# 💫 https://github.com/JaKooLit 💫 #
# Nvidia Stuffs #
if [[ $USE_PRESET = [Yy] ]]; then
source ./preset.sh
fi
nvidia_pkg=(
nvidia-dkms
@ -93,9 +96,11 @@ else
fi
# Blacklist nouveau
read -n1 -rep "${CAT} Would you like to blacklist nouveau? (y/n)" response
if [[ -z $blacklist_nouveau ]]; then
read -n1 -rep "${CAT} Would you like to blacklist nouveau? (y/n)" blacklist_nouveau
fi
echo
if [[ $response =~ ^[Yy]$ ]]; then
if [[ $blacklist_nouveau =~ ^[Yy]$ ]]; then
NOUVEAU="/etc/modprobe.d/nouveau.conf"
if [ -f "$NOUVEAU" ]; then
printf "${OK} Seems like nouveau is already blacklisted..moving on.\n"

View File

@ -1,6 +1,9 @@
#!/bin/bash
# 💫 https://github.com/JaKooLit 💫 #
# SDDM Log-in Manager #
if [[ $USE_PRESET = [Yy] ]]; then
source ./preset.sh
fi
sddm=(
qt5-graphicaleffects
@ -28,7 +31,9 @@ LOG="Install-Logs/install-$(date +%d-%H%M%S)_sddm.log"
# Check if SDDM is already installed
if pacman -Qs sddm > /dev/null; then
# Prompt user to manually install sddm-git to remove SDDM
read -n1 -rep "SDDM is already installed. Would you like to manually install sddm-git to remove it? This requires manual intervention. (y/n)" manual_install_sddm
if [[ -z $manual_install_sddm ]]; then
read -n1 -rep "SDDM is already installed. Would you like to manually install sddm-git to remove it? This requires manual intervention. (y/n)" manual_install_sddm
fi
echo
if [[ $manual_install_sddm =~ ^[Yy]$ ]]; then
$ISAUR -S sddm-git 2>&1 | tee -a "$LOG"
@ -65,7 +70,9 @@ sudo cp assets/hyprland.desktop "$wayland_sessions_dir/" 2>&1 | tee -a "$LOG"
# SDDM-themes
valid_input=false
while [ "$valid_input" != true ]; do
read -n 1 -r -p "${CAT} OPTIONAL - Would you like to install SDDM themes? (y/n)" install_sddm_theme
if [[ -z $install_sddm_theme ]]; then
read -n 1 -r -p "${CAT} OPTIONAL - Would you like to install SDDM themes? (y/n)" install_sddm_theme
fi
if [[ $install_sddm_theme =~ ^[Yy]$ ]]; then
printf "\n%s - Installing Simple SDDM Theme\n" "${NOTE}"

View File

@ -1,6 +1,9 @@
#!/bin/bash
# 💫 https://github.com/JaKooLit 💫 #
# XDG-Desktop-Portals #
if [[ $USE_PRESET = [Yy] ]]; then
source ./preset.sh
fi
xdg=(
xdg-desktop-portal-hyprland
@ -37,7 +40,9 @@ sleep 1
printf "\n"
printf "${NOTE} XDG-desktop-portal-KDE & GNOME (if installed) should be manually disabled or removed! I can't remove it... sorry...\n"
while true; do
read -rp "${CAT} Would you like to try to remove other XDG-Desktop-Portal-Implementations? (y/n) " XDPH1
if [[ -z $XDPH1 ]]; then
read -rp "${CAT} Would you like to try to remove other XDG-Desktop-Portal-Implementations? (y/n) " XDPH1
fi
echo
sleep 1

View File

@ -1,6 +1,9 @@
#!/bin/bash
# 💫 https://github.com/JaKooLit 💫 #
# zsh and oh my zsh including pokemon-color-scripts#
if [[ $USE_PRESET = [Yy] ]]; then
source ./preset.sh
fi
zsh=(
zsh
@ -23,8 +26,10 @@ LOG="Install-Logs/install-$(date +%d-%H%M%S)_zsh.log"
## Optional Pokemon color scripts
while true; do
read -p "${CAT} OPTIONAL - Do you want to add Pokemon color scripts? (y/n): " choice
case "$choice" in
if [[ -z $pokemon_choice ]]; then
read -p "${CAT} OPTIONAL - Do you want to add Pokemon color scripts? (y/n): " pokemon_choice
fi
case "$pokemon_choice" in
[Yy]*)
zsh+=('pokemon-colorscripts-git')
sed -i '/#pokemon-colorscripts --no-title -s -r/s/^#//' assets/.zshrc

View File

@ -38,6 +38,9 @@ if [ "$proceed" != "y" ]; then
exit 1
fi
if [[ $use_preset = [Yy] ]]; then
source ./preset.sh
fi
@ -76,22 +79,32 @@ colorize_prompt() {
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=""
# aur_helper=""
# bluetooth=""
# dots=""
# gtk_themes=""
# nvidia=""
# rog=""
# sddm=""
# thunar=""
# xdph=""
# zsh=""
# Define the directory where your scripts are located
script_directory=install-scripts
# Function to ask a yes/no question and set the response in a variable
ask_yes_no() {
if [[ ! -z "${!2}" ]]; then
echo "$(colorize_prompt "$CAT" "$1 (Preset): ${!2}")"
if [[ "${!2}" = [Yy] ]]; then
return 0
else
return 1
fi
else
eval "$2=''"
fi
while true; do
read -p "$(colorize_prompt "$CAT" "$1 (y/n): ")" choice
case "$choice" in
@ -108,6 +121,12 @@ ask_custom_option() {
local valid_options="$2"
local response_var="$3"
if [[ ! -z "${!3}" ]]; then
return 0
else
eval "$3=''"
fi
while true; do
read -p "$(colorize_prompt "$CAT" "$prompt ($valid_options): ")" choice
if [[ " $valid_options " == *" $choice "* ]]; then
@ -125,7 +144,7 @@ execute_script() {
if [ -f "$script_path" ]; then
chmod +x "$script_path"
if [ -x "$script_path" ]; then
"$script_path"
env USE_PRESET=$use_preset "$script_path"
else
echo "Failed to make script '$script' executable."
fi
@ -146,8 +165,6 @@ ask_yes_no "-Do you want to configure Bluetooth?" bluetooth
printf "\n"
ask_yes_no "-Do you want to install Thunar file manager?" thunar
printf "\n"
ask_yes_no "-Install & configure SDDM log-in Manager w/ (Optional) SDDM Theme?" sddm
printf "\n"
ask_yes_no "-Install XDG-DESKTOP-PORTAL-HYPRLAND? (For proper Screen Share ie OBS)" xdph
printf "\n"
ask_yes_no "-Install zsh, oh-my-zsh & (Optional) pokemon-colorscripts?" zsh

40
preset.sh Normal file
View File

@ -0,0 +1,40 @@
############ !!!!!Make sure you use the right answer or it may failed
###
### -Type AUR helper
### yay or paru
aur_helper="yay"
############ use : "Y" or "N"
###-Do you have any nvidia gpu in your system?
nvidia="Y"
###-Install GTK themes (required for Dark/Light function)?
gtk_themes="Y"
###-Do you want to configure Bluetooth?
bluetooth="Y"
###-Do you want to install Thunar file manager?
thunar="Y"
###-Do you want to install Thunar file manager?
sddm="Y"
###-Install XDG-DESKTOP-PORTAL-HYPRLAND? (For proper Screen Share ie OBS)
xdph="Y"
###-Install zsh, oh-my-zsh & (Optional) pokemon-colorscripts?
zsh="Y"
###-Installing in a Asus ROG Laptops?
rog="N"
###-Do you want to download pre-configured Hyprland dotfiles?
dots="Y"
### Would you like to blacklist nouveau? (y/n)
blacklist_nouveau="Y"
### Do you want to upgrade to the latest version? (y/n):
upgrade_choice="Y"
### Would you like to try to remove other XDG-Desktop-Portal-Implementations? (y/n)
XDPH1="Y"
### SDDM is already installed. Would you like to manually install sddm-git to remove it? This requires manual intervention. (y/n)
manual_install_sddm="N"
### OPTIONAL - Would you like to install SDDM themes? (y/n)
install_sddm_theme="Y"
### " This script will add or remove your user from the 'input' group."
### " Please note that adding yourself to the 'input' group might be necessary for waybar keyboard-state functionality."
input_group_choid="Y"
### OPTIONAL - Do you want to add Pokemon color scripts? (y/n):
pokemon_choice="Y"