From 8141e15bd97bdcf6bcd791c5b212bb7d93393f3d Mon Sep 17 00:00:00 2001 From: clsty Date: Thu, 23 Oct 2025 05:20:22 +0800 Subject: [PATCH] Add subcmds; Not skip backup unless input y/n --- sdata/step/3.install-files.sh | 22 ++++++++++++++-------- setup | 31 ++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/sdata/step/3.install-files.sh b/sdata/step/3.install-files.sh index 547e3a30a..eaea5017a 100644 --- a/sdata/step/3.install-files.sh +++ b/sdata/step/3.install-files.sh @@ -53,15 +53,21 @@ function ask_backup_configs(){ showfun backup_clashing_targets printf "${STY_RED}" printf "Would you like to backup clashing dirs/files under \"$XDG_CONFIG_HOME\" and \"$XDG_DATA_HOME\" to \"$BACKUP_DIR\"?" - read -p "[y/N] " backup_confirm - case $backup_confirm in - [yY][eE][sS]|[yY]) - backup_clashing_targets dots/.config $XDG_CONFIG_HOME "${BACKUP_DIR}/.config" - backup_clashing_targets dots/.local/share $XDG_DATA_HOME "${BACKUP_DIR}/.local/share" - ;; - *) echo "Skipping backup..." ;; - esac printf "${STY_RST}" + while true;do + echo " y = Yes, backup" + echo " n = No, skip to next" + local p; read -p "====> " p + case $p in + [yY]) echo -e "${STY_BLUE}OK, doing backup...${STY_RST}" ;local backup=true;break ;; + [nN]) echo -e "${STY_BLUE}Alright, skipping...${STY_RST}" ;local backup=false;break ;; + *) echo -e "${STY_RED}Please enter [y/n].${STY_RST}";; + esac + done + if $backup;then + backup_clashing_targets dots/.config $XDG_CONFIG_HOME "${BACKUP_DIR}/.config" + backup_clashing_targets dots/.local/share $XDG_DATA_HOME "${BACKUP_DIR}/.local/share" + fi } ##################################################################################### diff --git a/setup b/setup index 88fb487e1..ebbab3988 100755 --- a/setup +++ b/setup @@ -18,6 +18,9 @@ Syntax: Subcommands: install (Default) Install/Reinstall/Update illogical-impulse. + install-deps Run the install step \"1. Install dependencies\" + install-setups Run the install step \"2. Setup for permissions/services etc\" + install-files Run the install step \"3. Copying config files\" exp-uninstall (Experimental) Uninstall illogical-impulse. exp-update (Experimental) Update illogical-impulse without fully reinstall. help Show this help message. @@ -30,7 +33,8 @@ case $1 in # Global help help|--help|-h)showhelp_global;exit;; # Correct subcommand - install|exp-uninstall|exp-update)SCRIPT_SUBCOMMAND=$1;shift;; + install|install-deps|install-setups|install-files|exp-uninstall|exp-update) + SCRIPT_SUBCOMMAND=$1;shift;; # No subcommand -*|"")SCRIPT_SUBCOMMAND=install;; # Wrong subcommand @@ -60,6 +64,31 @@ case ${SCRIPT_SUBCOMMAND} in fi fi ;; + install-deps) + source ./sdata/options/install.sh + if [[ "${SKIP_ALLDEPS}" != true ]]; then + printf "${STY_CYAN}[$0]: 1. Install dependencies\n${STY_RST}" + source ./sdata/step/1.install-deps-selector.sh + fi + ;; + install-setups) + source ./sdata/options/install.sh + if [[ "${SKIP_ALLSETUPS}" != true ]]; then + printf "${STY_CYAN}[$0]: 2. Setup for permissions/services etc\n${STY_RST}" + source ./sdata/step/2.install-setups-selector.sh + fi + ;; + install-files) + source ./sdata/options/install.sh + if [[ "${SKIP_ALLFILES}" != true ]]; then + printf "${STY_CYAN}[$0]: 3. Copying config files\n${STY_RST}" + if [[ "${EXPERIMENTAL_FILES_SCRIPT}" == true ]]; then + source ./sdata/step/3.install-files.experimental.sh + else + source ./sdata/step/3.install-files.sh + fi + fi + ;; exp-uninstall) source ./sdata/options/exp-uninstall.sh source ./sdata/step/exp-uninstall.sh