diff --git a/.gitignore b/.gitignore index e8c1afabe..416e808c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,4 @@ -.config/ags/node_modules -.config/ags/scss/_musicmaterial.scss -.config/ags/scss/_musicwal.scss -.config/ags/scss/_material.scss /diagnose.result -/ii_ags.log /cache # Ignore Python cache files __pycache__/ diff --git a/scriptdata/install-deps-arch.sh b/dist-arch/install-deps.sh similarity index 73% rename from scriptdata/install-deps-arch.sh rename to dist-arch/install-deps.sh index 7e02f05a4..487bb79ff 100644 --- a/scriptdata/install-deps-arch.sh +++ b/dist-arch/install-deps.sh @@ -12,21 +12,23 @@ install-yay(){ rm -rf /tmp/buildyay } +# NOTE: `handle-deprecated-dependencies` was for the old days when we just switch from dependencies.conf to local PKGBUILDs. +# However, let's just keep it as references for other distros writing their `dist-/install-deps.sh`, if they need it. handle-deprecated-dependencies(){ printf "${STY_CYAN}[$0]: Removing deprecated dependencies:${STY_RESET}\n" for i in illogical-impulse-{microtex,pymyc-aur,ags,agsv1} {hyprutils,hyprpicker,hyprlang,hypridle,hyprland-qt-support,hyprland-qtutils,hyprlock,xdg-desktop-portal-hyprland,hyprcursor,hyprwayland-scanner,hyprland}-git;do try sudo pacman --noconfirm -Rdd $i;done # Convert old dependencies to non explicit dependencies so that they can be orphaned if not in meta packages - remove_bashcomments_emptylines ./scriptdata/previous_dependencies.conf ./cache/old_deps_stripped.conf - readarray -t old_deps_list < ./cache/old_deps_stripped.conf - pacman -Qeq > ./cache/pacman_explicit_packages - readarray -t explicitly_installed < ./cache/pacman_explicit_packages + remove_bashcomments_emptylines ./dist-arch/previous_dependencies.conf ./cache/old_deps_stripped.conf + readarray -t old_deps_list < ./cache/old_deps_stripped.conf + pacman -Qeq > ./cache/pacman_explicit_packages + readarray -t explicitly_installed < ./cache/pacman_explicit_packages - echo "Attempting to set previously explicitly installed deps as implicit..." - for i in "${explicitly_installed[@]}"; do for j in "${old_deps_list[@]}"; do - [ "$i" = "$j" ] && yay -D --asdeps "$i" - done; done + echo "Attempting to set previously explicitly installed deps as implicit..." + for i in "${explicitly_installed[@]}"; do for j in "${old_deps_list[@]}"; do + [ "$i" = "$j" ] && yay -D --asdeps "$i" + done; done - return 0 + return 0 } ##################################################################################### @@ -55,16 +57,16 @@ v handle-deprecated-dependencies # https://github.com/end-4/dots-hyprland/issues/581 # yay -Bi is kinda hit or miss, instead cd into the relevant directory and manually source and install deps install-local-pkgbuild() { - local location=$1 - local installflags=$2 + local location=$1 + local installflags=$2 - x pushd $location + x pushd $location - source ./PKGBUILD - x yay -S $installflags --asdeps "${depends[@]}" - x makepkg -Asi --noconfirm + source ./PKGBUILD + x yay -S $installflags --asdeps "${depends[@]}" + x makepkg -Asi --noconfirm - x popd + x popd } # Install core dependencies from the meta-packages @@ -76,9 +78,9 @@ metapkgs+=(./dist-arch/illogical-impulse-microtex-git) metapkgs+=(./dist-arch/illogical-impulse-bibata-modern-classic-bin) for i in "${metapkgs[@]}"; do - metainstallflags="--needed" - $ask && showfun install-local-pkgbuild || metainstallflags="$metainstallflags --noconfirm" - v install-local-pkgbuild "$i" "$metainstallflags" + metainstallflags="--needed" + $ask && showfun install-local-pkgbuild || metainstallflags="$metainstallflags --noconfirm" + v install-local-pkgbuild "$i" "$metainstallflags" done ## Optional dependencies 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/dist-arch/outdate-detect-mode b/dist-arch/outdate-detect-mode new file mode 100644 index 000000000..0fd754152 --- /dev/null +++ b/dist-arch/outdate-detect-mode @@ -0,0 +1 @@ +AUTO diff --git a/scriptdata/previous_dependencies.conf b/dist-arch/previous_dependencies.conf similarity index 100% rename from scriptdata/previous_dependencies.conf rename to dist-arch/previous_dependencies.conf 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/dist-fallback/outdate-detect-mode b/dist-fallback/outdate-detect-mode new file mode 100644 index 000000000..00d7bdd40 --- /dev/null +++ b/dist-fallback/outdate-detect-mode @@ -0,0 +1 @@ +WIP diff --git a/scriptdata/install-deps-nix.sh b/dist-nix/install-deps.sh similarity index 73% rename from scriptdata/install-deps-nix.sh rename to dist-nix/install-deps.sh index 0342b1996..c46510c8d 100644 --- a/scriptdata/install-deps-nix.sh +++ b/dist-nix/install-deps.sh @@ -3,18 +3,19 @@ # This file is currently WIP. # +# NOTE: The dist-nix is not for NixOS but every distro, using Nix and home-manager. # # TODO: -# Write a proper `flake.nix` and optionally `home.nix` and other files (under a new folder `scriptdata/iiqs-hm`) to install all dependencies that `scriptdata/install-deps-arch.sh` does. (excluding the screenlock) +# Write a proper `flake.nix` and optionally `home.nix` and other files under ./dist-nix/iiqs-hm/ to install all dependencies that `./dist-arch/install-deps.sh` does. (**excluding** the screenlock) # # TODO: -# In this script, i.e. `scriptdata/install-deps.nix.sh`, implement the process below: +# In this script, implement the process below: # 1. Warning user about "this script is only experimental and must only use it at your own risks.", and prompt `y/N` (default N) before proceeding. # 2. If nix not installed: # 1. install nix via [DeterminateSystems/nix-installer](https://github.com/DeterminateSystems/nix-installer). # 2. Enable nix (probably in `.zshrc` or `~/.config/fish`). # 3. Ensure the experimental feature, Nix Flake, is enabled. -# 3. Sync (copy) `iiqs-hm` folder to `~/.config/iiqs-hm` using `rsync`. +# 3. Sync (copy) `./dist-nix/iiqs-hm/` folder to `~/.config/iiqs-hm/` using `rsync`. # 4. Use something like `home-manager switch --flake .#iiqs` to install the dependencies. # 5. Install screen lock using system package manager of the current distro. # Note that this script must be idempotent. diff --git a/dist-nix/outdate-detect-mode b/dist-nix/outdate-detect-mode new file mode 100644 index 000000000..00d7bdd40 --- /dev/null +++ b/dist-nix/outdate-detect-mode @@ -0,0 +1 @@ +WIP diff --git a/install.sh b/install.sh index 32f924cd2..bfddd6903 100755 --- a/install.sh +++ b/install.sh @@ -1,29 +1,29 @@ #!/usr/bin/env bash cd "$(dirname "$0")" export base="$(pwd)" -source ./scriptdata/environment-variables.sh -source ./scriptdata/functions.sh -source ./scriptdata/installers.sh -source ./scriptdata/options.sh +source ./scriptdata/lib/environment-variables.sh +source ./scriptdata/lib/functions.sh +source ./scriptdata/lib/package-installers.sh +source ./scriptdata/lib/options.sh prevent_sudo_or_root set -e ##################################################################################### # 0. Before we start -source ./scriptdata/install-greeting.sh +source ./scriptdata/step/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/step/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/step/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/step/3.install-files.sh fi diff --git a/scriptdata/install-deps.sh b/scriptdata/install-deps.sh deleted file mode 100644 index 379e524fb..000000000 --- a/scriptdata/install-deps.sh +++ /dev/null @@ -1,105 +0,0 @@ -# This script is meant to be sourced. -# It's not for directly running. - -#################### -# Detect architecture -# Helpful link(s): -# http://stackoverflow.com/questions/45125516 -export MACHINE_ARCH=$(uname -m) -case $MACHINE_ARCH in - "x86_64") sleep 0;; - *) - printf "${STY_YELLOW}" - printf "===WARNING===\n" - printf "Detected machine architecture: ${MACHINE_ARCH}\n" - printf "This script only supports x86_64.\n" - printf "It is very likely to fail when installing dependencies on your machine.\n" - printf "\n" - printf "${STY_RESET}" - ;; - esac - -#################### -# Detect distro -# Helpful link(s): -# http://stackoverflow.com/questions/29581754 -# https://github.com/which-distro/os-release -export OS_RELEASE_FILE=${OS_RELEASE_FILE:-/etc/os-release} -test -f ${OS_RELEASE_FILE} || \ - ( echo "${OS_RELEASE_FILE} does not exist. Aborting..." ; exit 1 ; ) -export OS_DISTRO_ID=$(awk -F'=' '/^ID=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null) -export OS_DISTRO_ID_LIKE=$(awk -F'=' '/^ID_LIKE=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null) - - - -if [[ "$INSTALL_VIA_NIX" == "true" ]]; then - - printf "${STY_YELLOW}" - printf "===WARNING===\n" - printf "Nix will be used to install dependencies.\n" - printf "The process is still WIP.\n" - printf "Proceed only at your own risk.\n" - printf "\n" - printf "${STY_RESET}" - pause - source ./scriptdata/install-deps-nix.sh - -elif [[ "$OS_DISTRO_ID" =~ ^(arch|endeavouros)$ ]]; then - - 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 "\n" - printf "${STY_RESET}" - pause - source ./scriptdata/install-deps-arch.sh - -elif [[ -f "./scriptdata/install-deps-${OS_DISTRO_ID}.sh" ]]; then - - 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 "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}" - printf "If you find out any problems about it, PR is welcomed if you are able to address it. Or, create a discussion about it, but please do not submit issue, because the developers do not use this distro, therefore they cannot help.${STY_RESET}\n" - printf "${STY_PURPLE}" - printf "Proceed only at your own risk.\n" - printf "\n" - printf "${STY_RESET}" - pause - source ./scriptdata/install-deps-${OS_DISTRO_ID}.sh - -elif [[ "$OS_DISTRO_ID_LIKE" == "arch" || "$OS_DISTRO_ID" == "cachyos" ]]; then - - 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 "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 - -else - - 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 "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 - -fi diff --git a/scriptdata/install-setups-nix.sh b/scriptdata/install-setups-nix.sh deleted file mode 100644 index 923ac2bc5..000000000 --- a/scriptdata/install-setups-nix.sh +++ /dev/null @@ -1,15 +0,0 @@ -# This script is meant to be sourced. -# It's not for directly running. - -##################################################################################### -# These python packages are installed using uv into the venv (virtual environment). Once the folder of the venv gets deleted, they are all gone cleanly. So it's considered as setups, not dependencies. -showfun install-python-packages -v install-python-packages - -v sudo usermod -aG video,i2c,input "$(whoami)" -v bash -c "echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf" -v systemctl --user enable ydotool --now -v sudo systemctl enable bluetooth --now -v gsettings set org.gnome.desktop.interface font-name 'Rubik 11' -v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' -v kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Darkly diff --git a/scriptdata/environment-variables.sh b/scriptdata/lib/environment-variables.sh similarity index 100% rename from scriptdata/environment-variables.sh rename to scriptdata/lib/environment-variables.sh diff --git a/scriptdata/functions.sh b/scriptdata/lib/functions.sh similarity index 78% rename from scriptdata/functions.sh rename to scriptdata/lib/functions.sh index 531df3ef3..b829c6be8 100644 --- a/scriptdata/functions.sh +++ b/scriptdata/lib/functions.sh @@ -10,7 +10,7 @@ function v(){ echo -e "####################################################" echo -e "${STY_BLUE}[$0]: Next command:${STY_RESET}" echo -e "${STY_GREEN}$@${STY_RESET}" - execute=true + local execute=true if $ask;then while true;do echo -e "${STY_BLUE}Execute? ${STY_RESET}" @@ -18,7 +18,7 @@ function v(){ echo " e = Exit now" echo " s = Skip this command (NOT recommended - your setup might not work correctly)" echo " yesforall = Yes and don't ask again; NOT recommended unless you really sure" - read -p "====> " p + local p; read -p "====> " p case $p in [yY]) echo -e "${STY_BLUE}OK, executing...${STY_RESET}" ;break ;; [eE]) echo -e "${STY_BLUE}Exiting...${STY_RESET}" ;exit ;break ;; @@ -34,7 +34,7 @@ function v(){ } # When use v() for a defined function, use x() INSIDE its definition to catch errors. function x(){ - if "$@";then cmdstatus=0;else cmdstatus=1;fi # 0=normal; 1=failed; 2=failed but ignored + if "$@";then local cmdstatus=0;else local cmdstatus=1;fi # 0=normal; 1=failed; 2=failed but ignored while [ $cmdstatus == 1 ] ;do echo -e "${STY_RED}[$0]: Command \"${STY_GREEN}$@${STY_RED}\" has failed." echo -e "You may need to resolve the problem manually BEFORE repeating this command." @@ -42,7 +42,7 @@ function x(){ echo " r = Repeat this command (DEFAULT)" echo " e = Exit now" echo " i = Ignore this error and continue (your setup might not work correctly)" - read -p " [R/e/i]: " p + local p; read -p " [R/e/i]: " p case $p in [iI]) echo -e "${STY_BLUE}Alright, ignore and continue...${STY_RESET}";cmdstatus=2;; [eE]) echo -e "${STY_BLUE}Alright, will exit.${STY_RESET}";break;; @@ -64,7 +64,11 @@ function showfun(){ printf "${STY_RESET}" } function pause(){ - if [ ! "$ask" == "false" ];then printf "${STY_FAINT}${STY_SLANT}";read -p "(Ctrl-C to abort, others to proceed)" p;printf "${STY_RESET}";fi + if [ ! "$ask" == "false" ];then + printf "${STY_FAINT}${STY_SLANT}" + local p; read -p "(Ctrl-C to abort, others to proceed)" p + printf "${STY_RESET}" + fi } function remove_bashcomments_emptylines(){ mkdir -p $(dirname $2) @@ -75,3 +79,19 @@ function prevent_sudo_or_root(){ root) echo -e "${STY_RED}[$0]: This script is NOT to be executed with sudo or as root. Aborting...${STY_RESET}";exit 1;; esac } +function git_auto_unshallow(){ +# We need this function for latest_commit_hash to work properly + if [[ -f "$(git rev-parse --git-dir)/shallow" ]]; then + echo "Shallow clone detected. Unshallowing..." + git fetch --unshallow + fi +} +function latest_commit_timestamp(){ + local target_path="$1" + local result=$(git log -1 --format="%ct" -- "$target_path" 2>/dev/null) + if [[ -z "$result" ]]; then + echo "[latest_commit_timestamp] The timestamp of \"$target_path\" is empty. Aborting..." >&2 + return 1 + fi + echo $result +} diff --git a/scriptdata/options.sh b/scriptdata/lib/options.sh similarity index 100% rename from scriptdata/options.sh rename to scriptdata/lib/options.sh diff --git a/scriptdata/installers.sh b/scriptdata/lib/package-installers.sh similarity index 98% rename from scriptdata/installers.sh rename to scriptdata/lib/package-installers.sh index ffbf2bc53..c4d6e03a6 100644 --- a/scriptdata/installers.sh +++ b/scriptdata/lib/package-installers.sh @@ -106,6 +106,6 @@ install-python-packages(){ # we need python 3.12 https://github.com/python-pillow/Pillow/issues/8089 x uv venv --prompt .venv $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV) -p 3.12 x source $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate - x uv pip install -r scriptdata/requirements.txt + x uv pip install -r scriptdata/uv/requirements.txt x deactivate # We don't need the virtual environment anymore } diff --git a/scriptdata/requirements.txt b/scriptdata/requirements.txt deleted file mode 100644 index e6b96aba1..000000000 --- a/scriptdata/requirements.txt +++ /dev/null @@ -1,50 +0,0 @@ -# This file was autogenerated by uv via the following command: -# uv pip compile scriptdata/requirements.in -o scriptdata/requirements.txt -build==1.2.2.post1 - # via -r scriptdata/requirements.in -cffi==1.17.1 - # via pywayland -click==8.2.1 - # via -r scriptdata/requirements.in -libsass==0.23.0 - # via -r scriptdata/requirements.in -loguru==0.7.3 - # via -r scriptdata/requirements.in -material-color-utilities==0.2.1 - # via -r scriptdata/requirements.in -materialyoucolor==2.0.10 - # via -r scriptdata/requirements.in -numpy==2.2.2 - # via material-color-utilities -packaging==24.2 - # via - # build - # setuptools-scm -pillow==11.1.0 - # via - # -r scriptdata/requirements.in - # material-color-utilities -psutil==6.1.1 - # via -r scriptdata/requirements.in -pycairo==1.28.0 - # via - # -r scriptdata/requirements.in - # pygobject -pycparser==2.22 - # via cffi -pygobject==3.52.3 - # via -r scriptdata/requirements.in -pyproject-hooks==1.2.0 - # via build -pywayland==0.4.18 - # via -r scriptdata/requirements.in -setproctitle==1.3.4 - # via -r scriptdata/requirements.in -setuptools==80.9.0 - # via setuptools-scm -setuptools-scm==8.1.0 - # via -r scriptdata/requirements.in -tqdm==4.67.1 - # via -r scriptdata/requirements.in -wheel==0.45.1 - # via -r scriptdata/requirements.in diff --git a/scriptdata/install-greeting.sh b/scriptdata/step/0.install-greeting.sh similarity index 100% rename from scriptdata/install-greeting.sh rename to scriptdata/step/0.install-greeting.sh diff --git a/scriptdata/step/1.install-deps-selector.sh b/scriptdata/step/1.install-deps-selector.sh new file mode 100644 index 000000000..90f1182a7 --- /dev/null +++ b/scriptdata/step/1.install-deps-selector.sh @@ -0,0 +1,150 @@ +# This script is meant to be sourced. +# It's not for directly running. + +function outdate_detect(){ + # Shallow clone makes latest_commit_timestamp() not worky. + git_auto_unshallow + + local source_path="$1" + local target_path="$2" + local source_timestamp="$(latest_commit_timestamp $source_path 2>/dev/null)" + local target_timestamp="$(latest_commit_timestamp $target_path 2>/dev/null)" + local outdate_detect_mode="$(cat ${target_path}/outdate-detect-mode)" + + # Does target path have an outdate-detect-mode file which content is special? + if [[ "${outdate_detect_mode}" =~ ^(WIP|FORCE_OUTDATED|FORCE_UPDATED)$ ]]; then + echo "${outdate_detect_mode}" + # Does source path has an empty timestamp? + elif [ -z "$source_timestamp" ]; then + echo "EMPTY_SOURCE" + # Does target path has an empty timestamp? + elif [ -z "$target_timestamp" ]; then + echo "EMPTY_TARGET" + # If target path is older than source path, it's outdated. + elif [[ "$target_timestamp" -lt "$source_timestamp" ]]; then + echo "OUTDATED" + else + echo "UPDATED" + fi +} +#################### +# Detect architecture +# Helpful link(s): +# http://stackoverflow.com/questions/45125516 +export MACHINE_ARCH=$(uname -m) +case $MACHINE_ARCH in + "x86_64") sleep 0;; + *) + printf "${STY_YELLOW}" + printf "===WARNING===\n" + printf "Detected machine architecture: ${MACHINE_ARCH}\n" + printf "This script only supports x86_64.\n" + printf "It is very likely to fail when installing dependencies on your machine.\n" + printf "\n" + printf "${STY_RESET}" + ;; +esac + +#################### +# Detect distro +# Helpful link(s): +# http://stackoverflow.com/questions/29581754 +# https://github.com/which-distro/os-release +export OS_RELEASE_FILE=${OS_RELEASE_FILE:-/etc/os-release} +test -f ${OS_RELEASE_FILE} || \ + ( echo "${OS_RELEASE_FILE} does not exist. Aborting..." ; exit 1 ; ) +export OS_DISTRO_ID=$(awk -F'=' '/^ID=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null) +export OS_DISTRO_ID_LIKE=$(awk -F'=' '/^ID_LIKE=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null) + + +if [[ "$INSTALL_VIA_NIX" == "true" ]]; then + + TARGET_ID=nix + printf "${STY_YELLOW}" + printf "===WARNING===\n" + printf "./dist-${TARGET_ID}/install-deps.sh will be used.\n" + printf "The process is still WIP.\n" + printf "Proceed only at your own risk.\n" + printf "\n" + printf "${STY_RESET}" + pause + 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 "./dist-${TARGET_ID}/install-deps.sh will be used.\n" + printf "\n" + printf "${STY_RESET}" + pause + source ./dist-${TARGET_ID}/install-deps.sh + +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 "./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}" + printf "If you find out any problems about it, PR is welcomed if you are able to address it. Or, create a discussion about it, but please do not submit issue, because the developers do not use this distro, therefore they cannot help.${STY_RESET}\n" + printf "${STY_PURPLE}" + printf "Proceed only at your own risk.\n" + printf "\n" + printf "${STY_RESET}" + pause + tmp_update_status="$(outdate_detect dist-arch dist-${TARGET_ID})" + if [[ "${tmp_update_status}" =~ ^(OUTDATED|EMPTY_TARGET|EMPTY_SOURCE|FORCE_OUTDATED|WIP)$ ]]; then + printf "${STY_RED}" + printf "${STY_BOLD}===URGENT===${STY_RED}\n" + printf "The community provided ./dist-${TARGET_ID}/ is not updated (update status: ${tmp_update_status}),\n" + printf "which means it does not fully reflect the latest changes of ./dist-arch/ .\n" + printf "You are highly recommended to abort this script, until someone (maybe you?) has updated the ./dist-${TARGET_ID}/ to fully reflect the latest changes in ./dist-arch/ . PR is welcomed.\n" + printf "${STY_INVERT}If you are proceeding anyway, illogical-impulse will very likely not work as expected.${STY_RESET}\n" + printf "${STY_RED}Still proceed?${STY_RESET}\n" + read -p "[y/N]: " p + case "$p" in + [yY])sleep 0;; + *)echo "Aborting...";exit 1;; + esac + fi + 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 "./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 ./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 "./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 ./dist-${TARGET_ID}/install-deps.sh + +fi diff --git a/scriptdata/install-setups.sh b/scriptdata/step/2.install-setups-selector.sh similarity index 75% rename from scriptdata/install-setups.sh rename to scriptdata/step/2.install-setups-selector.sh index 4c513399b..2ca344014 100644 --- a/scriptdata/install-setups.sh +++ b/scriptdata/step/2.install-setups-selector.sh @@ -16,33 +16,36 @@ export OS_DISTRO_ID_LIKE=$(awk -F'=' '/^ID_LIKE=/ { gsub("\"","",$2); print tolo if [[ "$INSTALL_VIA_NIX" == "true" ]]; then + TARGET_ID=fallback printf "${STY_YELLOW}" printf "===WARNING===\n" - printf "Nix will be used to do setups.\n" + printf "./dist-${TARGET_ID}/install-setups.sh will be used.\n" printf "The process is still WIP.\n" printf "Proceed only at your own risk.\n" 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/step/3.install-files.sh similarity index 95% rename from scriptdata/install-files.sh rename to scriptdata/step/3.install-files.sh index 8a4ca9ba7..ac0639567 100644 --- a/scriptdata/install-files.sh +++ b/scriptdata/step/3.install-files.sh @@ -33,6 +33,12 @@ case $ask in *) ask_backup_configs ;; esac +# TODO: A better method for users to choose their customization, +# for example some users may prefer ZSH over FISH, and foot over kitty. +# But the dot files are using FISH and kitty as the default software, e.g. `.local/share/Konsole` has `Command=/bin/fish`. +# It may be possible that we provide options for users to make their decision. + + # `--delete' for rsync to make sure that # original dotfiles and new ones in the SAME DIRECTORY # (eg. in ~/.config/hypr) won't be mixed together diff --git a/scriptdata/requirements.in b/scriptdata/uv/requirements.in similarity index 100% rename from scriptdata/requirements.in rename to scriptdata/uv/requirements.in diff --git a/scriptdata/uv/requirements.txt b/scriptdata/uv/requirements.txt new file mode 100644 index 000000000..912fc2460 --- /dev/null +++ b/scriptdata/uv/requirements.txt @@ -0,0 +1,50 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile scriptdata/uv/requirements.in -o scriptdata/uv/requirements.txt +build==1.2.2.post1 + # via -r scriptdata/uv/requirements.in +cffi==1.17.1 + # via pywayland +click==8.2.1 + # via -r scriptdata/uv/requirements.in +libsass==0.23.0 + # via -r scriptdata/uv/requirements.in +loguru==0.7.3 + # via -r scriptdata/uv/requirements.in +material-color-utilities==0.2.1 + # via -r scriptdata/uv/requirements.in +materialyoucolor==2.0.10 + # via -r scriptdata/uv/requirements.in +numpy==2.2.2 + # via material-color-utilities +packaging==24.2 + # via + # build + # setuptools-scm +pillow==11.1.0 + # via + # -r scriptdata/uv/requirements.in + # material-color-utilities +psutil==6.1.1 + # via -r scriptdata/uv/requirements.in +pycairo==1.28.0 + # via + # -r scriptdata/uv/requirements.in + # pygobject +pycparser==2.22 + # via cffi +pygobject==3.52.3 + # via -r scriptdata/uv/requirements.in +pyproject-hooks==1.2.0 + # via build +pywayland==0.4.18 + # via -r scriptdata/uv/requirements.in +setproctitle==1.3.4 + # via -r scriptdata/uv/requirements.in +setuptools==80.9.0 + # via setuptools-scm +setuptools-scm==8.1.0 + # via -r scriptdata/uv/requirements.in +tqdm==4.67.1 + # via -r scriptdata/uv/requirements.in +wheel==0.45.1 + # via -r scriptdata/uv/requirements.in diff --git a/uninstall.sh b/uninstall.sh index d76104166..561f11aa5 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash cd "$(dirname "$0")" -source ./scriptdata/environment-variables.sh -source ./scriptdata/functions.sh +source ./scriptdata/lib/environment-variables.sh +source ./scriptdata/lib/functions.sh prevent_sudo_or_root function v() { @@ -52,7 +52,7 @@ v sudo rm /etc/modules-load.d/i2c-dev.conf ############################################################################################################################## read -p "Do you want to uninstall the illogical-impulse-* meta packages (Arch Linux only)? -Ctrl+C to exit, or press Enter to proceed" +Ctrl+C to exit, or press Enter to proceed" p # Removing installed yay packages and dependencies v yay -Rns illogical-impulse-{agsv1,audio,backlight,basic,bibata-modern-classic-bin,fonts-themes,gnome,gtk,hyprland,microtex-git,oneui4-icons-git,portal,python,screencapture,widgets} plasma-browser-integration diff --git a/update.sh b/update.sh index 8fb7a299a..38cd7a999 100755 --- a/update.sh +++ b/update.sh @@ -813,12 +813,6 @@ fi # Step 4: Update script permissions log_header "Updating Script Permissions" -if [[ -d "${REPO_DIR}/scriptdata" ]]; then - find "${REPO_DIR}/scriptdata" -type f -name "*.sh" -exec chmod +x {} \; - find "${REPO_DIR}/scriptdata" -type f -executable -exec chmod +x {} \; - log_success "Updated script permissions" -fi - # Make sure local bin scripts are executable if [[ -d "${HOME}/.local/bin" ]]; then find "${HOME}/.local/bin" -type f -exec chmod +x {} \; 2>/dev/null || true