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
8 changed files with 114 additions and 25 deletions

View File

@@ -2,6 +2,9 @@
# 💫 https://github.com/JaKooLit 💫 # # 💫 https://github.com/JaKooLit 💫 #
# Adding users into input group # # 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! ## ## WARNING: DO NOT EDIT BEYOND THIS LINE IF YOU DON'T KNOW WHAT YOU ARE DOING! ##
# Determine the directory where the script is located # 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 "${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." 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 # Check if the 'input' group exists
if grep -q '^input:' /etc/group; then if grep -q '^input:' /etc/group; then
echo "${OK} 'input' group exists." echo "${OK} 'input' group exists."
@@ -41,7 +46,7 @@ while true; do
# Log the addition of the user to the 'input' group # Log the addition of the user to the 'input' group
echo "User added to 'input' group" >> "$LOG" echo "User added to 'input' group" >> "$LOG"
break # Break out of the loop if 'yes' is chosen 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." echo "${NOTE} No changes made. Exiting the script."
break # Break out of the loop if 'no' is chosen break # Break out of the loop if 'no' is chosen
else else

View File

@@ -1,6 +1,9 @@
#!/bin/bash #!/bin/bash
# 💫 https://github.com/JaKooLit 💫 # # 💫 https://github.com/JaKooLit 💫 #
# Hyprland-Dots to download from Releases # # 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! ## ## 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 exit 0
else else
echo -e "${WARN} Hyprland-Dots.tar.gz is outdated (Existing version: $existing_version, Latest version: $latest_version)." echo -e "${WARN} Hyprland-Dots.tar.gz is outdated (Existing version: $existing_version, Latest version: $latest_version)."
if [[ -z $upgrade_choice ]]; then
read -p "Do you want to upgrade to the latest version? (y/n): " upgrade_choice read -p "Do you want to upgrade to the latest version? (y/n): " upgrade_choice
fi
if [ "$upgrade_choice" = "y" ]; then 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" 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 #!/bin/bash
# 💫 https://github.com/JaKooLit 💫 # # 💫 https://github.com/JaKooLit 💫 #
# Nvidia Stuffs # # Nvidia Stuffs #
if [[ $USE_PRESET = [Yy] ]]; then
source ./preset.sh
fi
nvidia_pkg=( nvidia_pkg=(
nvidia-dkms nvidia-dkms
@@ -93,9 +96,11 @@ else
fi fi
# Blacklist nouveau # 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 echo
if [[ $response =~ ^[Yy]$ ]]; then if [[ $blacklist_nouveau =~ ^[Yy]$ ]]; then
NOUVEAU="/etc/modprobe.d/nouveau.conf" NOUVEAU="/etc/modprobe.d/nouveau.conf"
if [ -f "$NOUVEAU" ]; then if [ -f "$NOUVEAU" ]; then
printf "${OK} Seems like nouveau is already blacklisted..moving on.\n" printf "${OK} Seems like nouveau is already blacklisted..moving on.\n"

View File

@@ -1,6 +1,9 @@
#!/bin/bash #!/bin/bash
# 💫 https://github.com/JaKooLit 💫 # # 💫 https://github.com/JaKooLit 💫 #
# SDDM Log-in Manager # # SDDM Log-in Manager #
if [[ $USE_PRESET = [Yy] ]]; then
source ./preset.sh
fi
sddm=( sddm=(
qt5-graphicaleffects qt5-graphicaleffects
@@ -28,7 +31,9 @@ LOG="Install-Logs/install-$(date +%d-%H%M%S)_sddm.log"
# Check if SDDM is already installed # Check if SDDM is already installed
if pacman -Qs sddm > /dev/null; then if pacman -Qs sddm > /dev/null; then
# Prompt user to manually install sddm-git to remove SDDM # Prompt user to manually install sddm-git to remove 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 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 echo
if [[ $manual_install_sddm =~ ^[Yy]$ ]]; then if [[ $manual_install_sddm =~ ^[Yy]$ ]]; then
$ISAUR -S sddm-git 2>&1 | tee -a "$LOG" $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 # SDDM-themes
valid_input=false valid_input=false
while [ "$valid_input" != true ]; do while [ "$valid_input" != true ]; do
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 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 if [[ $install_sddm_theme =~ ^[Yy]$ ]]; then
printf "\n%s - Installing Simple SDDM Theme\n" "${NOTE}" printf "\n%s - Installing Simple SDDM Theme\n" "${NOTE}"

View File

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

View File

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

View File

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