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

@@ -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