From 918997acfa7b56eaf9e15f785809fc48f8c5883d Mon Sep 17 00:00:00 2001 From: clsty Date: Thu, 2 Oct 2025 16:38:43 +0800 Subject: [PATCH] Rearrange install scripts. This commit is a preparation for detection about whether a dist-/ folder is outdated. --- .../install-deps.sh | 0 .../install-setups.sh | 0 .../install-deps.sh | 0 .../install-setups.sh | 0 .../install-deps.sh | 0 .../install-setups.sh | 0 install.sh | 10 +++---- ...tall-greeting.sh => 0.install-greeting.sh} | 0 ...all-deps.sh => 1.install-deps-selector.sh} | 27 +++++++++++-------- ...setups.sh => 2.install-setups-selector.sh} | 27 +++++++++++-------- .../{install-files.sh => 3.install-files.sh} | 0 .../{installers.sh => package-installers.sh} | 0 12 files changed, 37 insertions(+), 27 deletions(-) rename scriptdata/install-deps-arch.sh => dist-arch/install-deps.sh (100%) rename scriptdata/install-setups-arch.sh => dist-arch/install-setups.sh (100%) rename scriptdata/install-deps-fallback.sh => dist-fallback/install-deps.sh (100%) rename scriptdata/install-setups-fallback.sh => dist-fallback/install-setups.sh (100%) rename scriptdata/install-deps-nix.sh => dist-nix/install-deps.sh (100%) rename scriptdata/install-setups-nix.sh => dist-nix/install-setups.sh (100%) rename scriptdata/{install-greeting.sh => 0.install-greeting.sh} (100%) rename scriptdata/{install-deps.sh => 1.install-deps-selector.sh} (81%) rename scriptdata/{install-setups.sh => 2.install-setups-selector.sh} (77%) rename scriptdata/{install-files.sh => 3.install-files.sh} (100%) rename scriptdata/{installers.sh => package-installers.sh} (100%) diff --git a/scriptdata/install-deps-arch.sh b/dist-arch/install-deps.sh similarity index 100% rename from scriptdata/install-deps-arch.sh rename to dist-arch/install-deps.sh diff --git a/scriptdata/install-setups-arch.sh b/dist-arch/install-setups.sh similarity index 100% rename from scriptdata/install-setups-arch.sh rename to dist-arch/install-setups.sh diff --git a/scriptdata/install-deps-fallback.sh b/dist-fallback/install-deps.sh similarity index 100% rename from scriptdata/install-deps-fallback.sh rename to dist-fallback/install-deps.sh diff --git a/scriptdata/install-setups-fallback.sh b/dist-fallback/install-setups.sh similarity index 100% rename from scriptdata/install-setups-fallback.sh rename to dist-fallback/install-setups.sh diff --git a/scriptdata/install-deps-nix.sh b/dist-nix/install-deps.sh similarity index 100% rename from scriptdata/install-deps-nix.sh rename to dist-nix/install-deps.sh diff --git a/scriptdata/install-setups-nix.sh b/dist-nix/install-setups.sh similarity index 100% rename from scriptdata/install-setups-nix.sh rename to dist-nix/install-setups.sh diff --git a/install.sh b/install.sh index 32f924cd2..63f64d6d8 100755 --- a/install.sh +++ b/install.sh @@ -3,7 +3,7 @@ cd "$(dirname "$0")" export base="$(pwd)" source ./scriptdata/environment-variables.sh source ./scriptdata/functions.sh -source ./scriptdata/installers.sh +source ./scriptdata/package-installers.sh source ./scriptdata/options.sh prevent_sudo_or_root @@ -11,19 +11,19 @@ set -e ##################################################################################### # 0. Before we start -source ./scriptdata/install-greeting.sh +source ./scriptdata/0.install-greeting.sh ##################################################################################### if [[ "${SKIP_ALLDEPS}" != true ]]; then printf "${STY_CYAN}[$0]: 1. Install dependencies\n${STY_RESET}" - source ./scriptdata/install-deps.sh + source ./scriptdata/1.install-deps-selector.sh fi ##################################################################################### if [[ "${SKIP_ALLSETUPS}" != true ]]; then printf "${STY_CYAN}[$0]: 2. Setup for permissions/services etc\n${STY_RESET}" - source ./scriptdata/install-setups.sh + source ./scriptdata/2.install-setups-selector.sh fi ##################################################################################### if [[ "${SKIP_ALLFILES}" != true ]]; then printf "${STY_CYAN}[$0]: 3. Copying config files\n${STY_RESET}" - source ./scriptdata/install-files.sh + source ./scriptdata/3.install-files.sh fi diff --git a/scriptdata/install-greeting.sh b/scriptdata/0.install-greeting.sh similarity index 100% rename from scriptdata/install-greeting.sh rename to scriptdata/0.install-greeting.sh diff --git a/scriptdata/install-deps.sh b/scriptdata/1.install-deps-selector.sh similarity index 81% rename from scriptdata/install-deps.sh rename to scriptdata/1.install-deps-selector.sh index 379e524fb..cda6bdea3 100644 --- a/scriptdata/install-deps.sh +++ b/scriptdata/1.install-deps-selector.sh @@ -34,6 +34,7 @@ export OS_DISTRO_ID_LIKE=$(awk -F'=' '/^ID_LIKE=/ { gsub("\"","",$2); print tolo if [[ "$INSTALL_VIA_NIX" == "true" ]]; then + TARGET_ID=nix printf "${STY_YELLOW}" printf "===WARNING===\n" printf "Nix will be used to install dependencies.\n" @@ -42,25 +43,27 @@ if [[ "$INSTALL_VIA_NIX" == "true" ]]; then printf "\n" printf "${STY_RESET}" pause - source ./scriptdata/install-deps-nix.sh + source ./dist-${TARGET_ID}/install-deps.sh elif [[ "$OS_DISTRO_ID" =~ ^(arch|endeavouros)$ ]]; then + TARGET_ID=arch printf "${STY_GREEN}" printf "===INFO===\n" printf "Detected distro ID: ${OS_DISTRO_ID}\n" - printf "./scriptdata/install-deps-arch.sh will be used.\n" + printf "./dist-${TARGET_ID}/install-deps.sh will be used.\n" printf "\n" printf "${STY_RESET}" pause - source ./scriptdata/install-deps-arch.sh + source ./dist-${TARGET_ID}/install-deps.sh -elif [[ -f "./scriptdata/install-deps-${OS_DISTRO_ID}.sh" ]]; then +elif [[ -f "./dist-${OS_DISTRO_ID}/install-deps.sh" ]]; then + TARGET_ID=${OS_DISTRO_ID} printf "${STY_PURPLE}" printf "===NOTICE===\n" printf "Detected distro ID: ${OS_DISTRO_ID}\n" - printf "./scriptdata/install-deps-${OS_DISTRO_ID}.sh detected and will be used.\n" + printf "./dist-${TARGET_ID}/install-deps.sh will be used.\n" printf "This file is provided by the community.\n" printf "It is not officially supported by github:end-4/dots-hyprland .\n" printf "${STY_BG_PURPLE}" @@ -70,36 +73,38 @@ elif [[ -f "./scriptdata/install-deps-${OS_DISTRO_ID}.sh" ]]; then printf "\n" printf "${STY_RESET}" pause - source ./scriptdata/install-deps-${OS_DISTRO_ID}.sh + source ./dist-${TARGET_ID}/install-deps.sh elif [[ "$OS_DISTRO_ID_LIKE" == "arch" || "$OS_DISTRO_ID" == "cachyos" ]]; then + TARGET_ID=arch printf "${STY_YELLOW}" printf "===WARNING===\n" printf "Detected distro ID: ${OS_DISTRO_ID}\n" printf "Detected distro ID_LIKE: ${OS_DISTRO_ID_LIKE}\n" - printf "./scriptdata/install-deps-arch.sh will be used.\n" + printf "./dist-${TARGET_ID}/install-deps.sh will be used.\n" printf "Ideally, it should also work for your distro.\n" printf "Still, there is a chance that it not works as expected or even fails.\n" printf "Proceed only at your own risk.\n" printf "\n" printf "${STY_RESET}" pause - source ./scriptdata/install-deps-arch.sh + source ./dist-${TARGET_ID}/install-deps.sh else + TARGET_ID=fallback printf "${STY_RED}" printf "${STY_BOLD}===URGENT===${STY_RED}\n" printf "Detected distro ID: ${OS_DISTRO_ID}\n" printf "Detected distro ID_LIKE: ${OS_DISTRO_ID_LIKE}\n" - printf "./scriptdata/install-deps-${OS_DISTRO_ID}.sh not found.\n" - printf "./scriptdata/install-deps-fallback.sh will be used.\n" + printf "./dist-${OS_DISTRO_ID}/install-deps.sh not found.\n" + printf "./dist-${TARGET_ID}/install-deps.sh will be used.\n" printf "1. It may disrupt your system and will likely fail without your manual intervention.\n" printf "2. It's WIP and only contains small number of dependencies far from enough.\n" printf "Proceed only at your own risk.\n" printf "${STY_RESET}" pause - source ./scriptdata/install-deps-fallback.sh + source ./dist-${TARGET_ID}/install-deps.sh fi diff --git a/scriptdata/install-setups.sh b/scriptdata/2.install-setups-selector.sh similarity index 77% rename from scriptdata/install-setups.sh rename to scriptdata/2.install-setups-selector.sh index 4c513399b..44e97b2c3 100644 --- a/scriptdata/install-setups.sh +++ b/scriptdata/2.install-setups-selector.sh @@ -16,6 +16,7 @@ export OS_DISTRO_ID_LIKE=$(awk -F'=' '/^ID_LIKE=/ { gsub("\"","",$2); print tolo if [[ "$INSTALL_VIA_NIX" == "true" ]]; then + TARGET_ID=nix printf "${STY_YELLOW}" printf "===WARNING===\n" printf "Nix will be used to do setups.\n" @@ -24,25 +25,27 @@ if [[ "$INSTALL_VIA_NIX" == "true" ]]; then printf "\n" printf "${STY_RESET}" pause - source ./scriptdata/install-setups-nix.sh + source ./dist-${TARGET_ID}/install-setups.sh elif [[ "$OS_DISTRO_ID" == "arch" ]]; then + TARGET_ID=arch printf "${STY_GREEN}" printf "===INFO===\n" printf "Detected distro ID: ${OS_DISTRO_ID}\n" - printf "./scriptdata/install-setups-arch.sh will be used.\n" + printf "./dist-${TARGET_ID}/install-setups.sh will be used.\n" printf "\n" printf "${STY_RESET}" pause - source ./scriptdata/install-setups-arch.sh + source ./dist-${TARGET_ID}/install-setups.sh -elif [[ -f "./scriptdata/install-setups-${OS_DISTRO_ID}.sh" ]]; then +elif [[ -f "./dist-${OS_DISTRO_ID}/install-setups.sh" ]]; then + TARGET_ID=${OS_DISTRO_ID} printf "${STY_PURPLE}" printf "===NOTICE===\n" printf "Detected distro ID: ${OS_DISTRO_ID}\n" - printf "./scriptdata/install-setups-${OS_DISTRO_ID}.sh detected and will be used.\n" + printf "./dist-${TARGET_ID}/install-setups.sh will be used.\n" printf "This file is provided by the community.\n" printf "It is not officially supported by github:end-4/dots-hyprland .\n" printf "${STY_BG_PURPLE}" @@ -52,36 +55,38 @@ elif [[ -f "./scriptdata/install-setups-${OS_DISTRO_ID}.sh" ]]; then printf "\n" printf "${STY_RESET}" pause - source ./scriptdata/install-setups-${OS_DISTRO_ID}.sh + source ./dist-${TARGET_ID}/install-setups.sh elif [[ "$OS_DISTRO_ID_LIKE" == "arch" || "$OS_DISTRO_ID" == "cachyos" ]]; then + TARGET_ID=arch printf "${STY_YELLOW}" printf "===WARNING===\n" printf "Detected distro ID: ${OS_DISTRO_ID}\n" printf "Detected distro ID_LIKE: ${OS_DISTRO_ID_LIKE}\n" - printf "./scriptdata/install-setups-arch.sh will be used.\n" + printf "./dist-${TARGET_ID}/install-setups.sh will be used.\n" printf "Ideally, it should also work for your distro.\n" printf "Still, there is a chance that it not works as expected or even fails.\n" printf "Proceed only at your own risk.\n" printf "\n" printf "${STY_RESET}" pause - source ./scriptdata/install-setups-arch.sh + source ./dist-${TARGET_ID}/install-setups.sh else + TARGET_ID=fallback printf "${STY_RED}" printf "===WARNING===\n" printf "Detected distro ID: ${OS_DISTRO_ID}\n" printf "Detected distro ID_LIKE: ${OS_DISTRO_ID_LIKE}\n" - printf "./scriptdata/install-setups-${OS_DISTRO_ID}.sh not found.\n" - printf "./scriptdata/install-setups-fallback.sh will be used.\n" + printf "./dist-${OS_DISTRO_ID}/install-setups.sh not found.\n" + printf "./dist-${TARGET_ID}/install-setups.sh will be used.\n" printf "It might fail or disrupt your system.\n" printf "Proceed only at your own risk.\n" printf "\n" printf "${STY_RESET}" pause - source ./scriptdata/install-setups-fallback.sh + source ./dist-${TARGET_ID}/install-setups.sh fi diff --git a/scriptdata/install-files.sh b/scriptdata/3.install-files.sh similarity index 100% rename from scriptdata/install-files.sh rename to scriptdata/3.install-files.sh diff --git a/scriptdata/installers.sh b/scriptdata/package-installers.sh similarity index 100% rename from scriptdata/installers.sh rename to scriptdata/package-installers.sh