Rearrange install scripts.

This commit is a preparation for detection about
whether a dist-<DISTRO_ID>/ folder is outdated.
This commit is contained in:
clsty
2025-10-02 16:38:43 +08:00
parent 0ee141493f
commit 918997acfa
12 changed files with 37 additions and 27 deletions
@@ -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
@@ -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
-102
View File
@@ -1,102 +0,0 @@
# This script is meant to be sourced.
# It's not for directly running.
install-yay(){
x sudo pacman -S --needed --noconfirm base-devel
x git clone https://aur.archlinux.org/yay-bin.git /tmp/buildyay
x cd /tmp/buildyay
x makepkg -o
x makepkg -se
x makepkg -i --noconfirm
x cd $base
rm -rf /tmp/buildyay
}
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
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
}
#####################################################################################
if ! command -v pacman >/dev/null 2>&1; then
printf "${STY_RED}[$0]: pacman not found, it seems that the system is not ArchLinux or Arch-based distros. Aborting...${STY_RESET}\n"
exit 1
fi
# Issue #363
case $SKIP_SYSUPDATE in
true) sleep 0;;
*) v sudo pacman -Syu;;
esac
# Use yay. Because paru does not support cleanbuild.
# Also see https://wiki.hyprland.org/FAQ/#how-do-i-update
if ! command -v yay >/dev/null 2>&1;then
echo -e "${STY_YELLOW}[$0]: \"yay\" not found.${STY_RESET}"
showfun install-yay
v install-yay
fi
showfun handle-deprecated-dependencies
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
x pushd $location
source ./PKGBUILD
x yay -S $installflags --asdeps "${depends[@]}"
x makepkg -Asi --noconfirm
x popd
}
# Install core dependencies from the meta-packages
metapkgs=(./dist-arch/illogical-impulse-{audio,backlight,basic,fonts-themes,kde,portal,python,screencapture,toolkit,widgets})
metapkgs+=(./dist-arch/illogical-impulse-hyprland)
metapkgs+=(./dist-arch/illogical-impulse-microtex-git)
# metapkgs+=(./dist-arch/packages/illogical-impulse-oneui4-icons-git)
[[ -f /usr/share/icons/Bibata-Modern-Classic/index.theme ]] || \
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"
done
## Optional dependencies
if pacman -Qs ^plasma-browser-integration$ ;then SKIP_PLASMAINTG=true;fi
case $SKIP_PLASMAINTG in
true) sleep 0;;
*)
if $ask;then
echo -e "${STY_YELLOW}[$0]: NOTE: The size of \"plasma-browser-integration\" is about 600 MiB.${STY_RESET}"
echo -e "${STY_YELLOW}It is needed if you want playtime of media in Firefox to be shown on the music controls widget.${STY_RESET}"
echo -e "${STY_YELLOW}Install it? [y/N]${STY_RESET}"
read -p "====> " p
else
p=y
fi
case $p in
y) x sudo pacman -S --needed --noconfirm plasma-browser-integration ;;
*) echo "Ok, won't install"
esac
;;
esac
-11
View File
@@ -1,11 +0,0 @@
# This script is meant to be sourced.
# It's not for directly running.
# This file is currently WIP.
v install-Rubik
v install-Gabarito
v install-OneUI
v install-bibata
v install-MicroTeX
v install-uv
-23
View File
@@ -1,23 +0,0 @@
# This script is meant to be sourced.
# It's not for directly running.
# This file is currently WIP.
#
#
# 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)
#
# TODO:
# In this script, i.e. `scriptdata/install-deps.nix.sh`, 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`.
# 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.
#
# TODO:
# Write guide for people already use nix, so they can manually grab things from this repo to their own Nix/home-manager configurations to install the dependencies.
-15
View File
@@ -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
-15
View File
@@ -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
-15
View File
@@ -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