feat(preset):add preset for quick installlation

check var exist before ask

remove var

add preset file

add a question to check should use preset

patch custom question

fix blacklist nouveau name not clear

fix input group var not clear

fix pokemon var not clear

add comment for preset var

use preset env var before excute script

add preset to script

print preset info
This commit is contained in:
PostCyberPunk 2024-01-04 20:28:31 +08:00
parent 9c80e88985
commit 33f538966f
8 changed files with 116 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

@ -25,12 +25,17 @@ echo "$(tput setaf 3)NOTE: If you are installing on a VM, ensure to enable 3D ac
echo
read -p "$(tput setaf 6)Would you like to proceed? (y/n): $(tput sgr0)" proceed
read -p "$(tput setaf 6)Would you like to preset? (y/n): $(tput sgr0)" use_preset
if [ "$proceed" != "y" ]; then
echo "Installation aborted."
exit 1
fi
if [[ $use_preset = [Yy] ]]; then
source ./preset.sh
fi
# Create Directory for Install Logs
if [ ! -d Install-Logs ]; then
@ -59,22 +64,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
@ -91,6 +106,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
@ -108,7 +129,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
@ -129,8 +150,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="N"
###-Installing in a Asus ROG Laptops?
rog="N"
###-Do you want to download pre-configured Hyprland dotfiles?
dots="N"
### 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="N"