From 87c031b825144d2e38fa4b3725509ac8a88dd378 Mon Sep 17 00:00:00 2001 From: clsty Date: Wed, 1 Oct 2025 20:44:25 +0800 Subject: [PATCH] Rearrange install.sh to split Arch thingy apart --- install.sh | 299 ++--------------------------------- scriptdata/checkdeps.sh | 24 --- scriptdata/dependencies.conf | 5 - scriptdata/functions | 13 +- scriptdata/install-deps-arch | 116 ++++++++++++++ scriptdata/install-files | 176 +++++++++++++++++++++ scriptdata/install-greeting | 34 ++++ scriptdata/install-setups | 15 ++ scriptdata/installers | 42 +---- scriptdata/options | 2 +- 10 files changed, 355 insertions(+), 371 deletions(-) delete mode 100755 scriptdata/checkdeps.sh delete mode 100644 scriptdata/dependencies.conf create mode 100644 scriptdata/install-deps-arch create mode 100644 scriptdata/install-files create mode 100644 scriptdata/install-greeting create mode 100644 scriptdata/install-setups diff --git a/install.sh b/install.sh index 227254d13..ba06afcd9 100755 --- a/install.sh +++ b/install.sh @@ -6,296 +6,19 @@ source ./scriptdata/functions source ./scriptdata/installers source ./scriptdata/options -##################################################################################### -if ! command -v pacman >/dev/null 2>&1; then - printf "\e[31m[$0]: pacman not found, it seems that the system is not ArchLinux or Arch-based distros. Aborting...\e[0m\n" - exit 1 -fi prevent_sudo_or_root - -startask () { - printf "\e[34m[$0]: Hi there! Before we start:\n" - printf '\n' - printf '[NEW] illogical-impulse is now powered by Quickshell. If you were using the old version with AGS and would like to keep it, do not run this script.\n' - printf ' The AGS version, although uses less memory, has much worse performance (it uses Gtk3). \n' - printf ' If you aren'\''t running on ewaste, the Quickshell version is recommended. \n' - printf ' If you would like the AGS version anyway, run the script in its branch instead: git checkout ii-ags && ./install.sh\n' - printf '\n' - printf 'This script: 1. only works for Arch Linux and Arch-based distros.\n' - printf ' 2. does not handle system-level/hardware stuff like Nvidia drivers\n' - printf "\e[31m" - - printf "Would you like to create a backup for \"$XDG_CONFIG_HOME\" and \"$HOME/.local/\" folders?\n[y/N]: " - read -p " " backup_confirm - case $backup_confirm in - [yY][eE][sS]|[yY]) - backup_configs - ;; - *) - echo "Skipping backup..." - ;; - esac - - - printf '\n' - printf 'Do you want to confirm every time before a command executes?\n' - printf ' y = Yes, ask me before executing each of them. (DEFAULT)\n' - printf ' n = No, just execute them automatically.\n' - printf ' a = Abort.\n' - read -p "====> " p - case $p in - n) ask=false ;; - a) exit 1 ;; - *) ask=true ;; - esac -} - -case $ask in - false)sleep 0 ;; - *)startask ;; -esac - set -e -##################################################################################### -printf "\e[36m[$0]: 1. Get packages and setup user groups/services\n\e[0m" - -# Issue #363 -case $SKIP_SYSUPDATE in - true) sleep 0;; - *) v sudo pacman -Syu;; -esac - -remove_bashcomments_emptylines ${DEPLISTFILE} ./cache/dependencies_stripped.conf -readarray -t pkglist < ./cache/dependencies_stripped.conf - -# 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 "\e[33m[$0]: \"yay\" not found.\e[0m" - showfun install-yay - v install-yay -fi - -# Install extra packages from dependencies.conf as declared by the user -if (( ${#pkglist[@]} != 0 )); then - if $ask; then - # execute per element of the array $pkglist - for i in "${pkglist[@]}";do v yay -S --needed $i;done - else - # execute for all elements of the array $pkglist in one line - v yay -S --needed --noconfirm ${pkglist[*]} - fi -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=(./arch-packages/illogical-impulse-{audio,backlight,basic,fonts-themes,kde,portal,python,screencapture,toolkit,widgets}) -metapkgs+=(./arch-packages/illogical-impulse-hyprland) -metapkgs+=(./arch-packages/illogical-impulse-microtex-git) -# metapkgs+=(./arch-packages/illogical-impulse-oneui4-icons-git) -[[ -f /usr/share/icons/Bibata-Modern-Classic/index.theme ]] || \ - metapkgs+=(./arch-packages/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 - -# These python packages are installed using uv, not pacman. -showfun install-python-packages -v install-python-packages - -## 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 "\e[33m[$0]: NOTE: The size of \"plasma-browser-integration\" is about 600 MiB.\e[0m" - echo -e "\e[33mIt is needed if you want playtime of media in Firefox to be shown on the music controls widget.\e[0m" - echo -e "\e[33mInstall it? [y/N]\e[0m" - 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 - -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 - ##################################################################################### -printf "\e[36m[$0]: 2. Copying + Configuring\e[0m\n" - -# In case some folders does not exists -v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME - -# `--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 - -# MISC (For .config/* but not fish, not Hyprland) -case $SKIP_MISCCONF in - true) sleep 0;; - *) - for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'fish' ! -name 'hypr' -exec basename {} \;); do -# i=".config/$i" - echo "[$0]: Found target: .config/$i" - if [ -d ".config/$i" ];then v rsync -av --delete ".config/$i/" "$XDG_CONFIG_HOME/$i/" - elif [ -f ".config/$i" ];then v rsync -av ".config/$i" "$XDG_CONFIG_HOME/$i" - fi - done - ;; -esac - -case $SKIP_FISH in - true) sleep 0;; - *) - v rsync -av --delete .config/fish/ "$XDG_CONFIG_HOME"/fish/ - ;; -esac - -# For Hyprland -case $SKIP_HYPRLAND in - true) sleep 0;; - *) - v rsync -av --delete --exclude '/custom' --exclude '/hyprlock.conf' --exclude '/hypridle.conf' --exclude '/hyprland.conf' .config/hypr/ "$XDG_CONFIG_HOME"/hypr/ - t="$XDG_CONFIG_HOME/hypr/hyprland.conf" - if [ -f $t ];then - echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" - v mv $t $t.old - v cp -f .config/hypr/hyprland.conf $t - existed_hypr_conf_firstrun=y - else - echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" - v cp .config/hypr/hyprland.conf $t - existed_hypr_conf=n - fi - t="$XDG_CONFIG_HOME/hypr/hypridle.conf" - if [ -f $t ];then - echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" - v cp -f .config/hypr/hypridle.conf $t.new - existed_hypridle_conf=y - else - echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" - v cp .config/hypr/hypridle.conf $t - existed_hypridle_conf=n - fi - t="$XDG_CONFIG_HOME/hypr/hyprlock.conf" - if [ -f $t ];then - echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" - v cp -f .config/hypr/hyprlock.conf $t.new - existed_hyprlock_conf=y - else - echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" - v cp .config/hypr/hyprlock.conf $t - existed_hyprlock_conf=n - fi - t="$XDG_CONFIG_HOME/hypr/custom" - if [ -d $t ];then - echo -e "\e[34m[$0]: \"$t\" already exists, will not do anything.\e[0m" - else - echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" - v rsync -av --delete .config/hypr/custom/ $t/ - fi - ;; -esac - - -# some foldes (eg. .local/bin) should be processed separately to avoid `--delete' for rsync, -# since the files here come from different places, not only about one program. -# v rsync -av ".local/bin/" "$XDG_BIN_HOME" # No longer needed since scripts are no longer in ~/.local/bin -v rsync -av ".local/share/icons/" "${XDG_DATA_HOME:-$HOME/.local/share}"/icons/ -v rsync -av ".local/share/konsole/" "${XDG_DATA_HOME:-$HOME/.local/share}"/konsole/ - -# Prevent hyprland from not fully loaded -sleep 1 -try hyprctl reload - -existed_zsh_conf=n -grep -q 'source ${XDG_CONFIG_HOME:-~/.config}/zshrc.d/dots-hyprland.zsh' ~/.zshrc && existed_zsh_conf=y - -warn_files=() -warn_files_tests=() -warn_files_tests+=(/usr/local/lib/{GUtils-1.0.typelib,Gvc-1.0.typelib,libgutils.so,libgvc.so}) -warn_files_tests+=(/usr/local/share/fonts/TTF/Rubik{,-Italic}'[wght]'.ttf) -warn_files_tests+=(/usr/local/share/licenses/ttf-rubik) -warn_files_tests+=(/usr/local/share/fonts/TTF/Gabarito-{Black,Bold,ExtraBold,Medium,Regular,SemiBold}.ttf) -warn_files_tests+=(/usr/local/share/licenses/ttf-gabarito) -warn_files_tests+=(/usr/local/share/icons/OneUI{,-dark,-light}) -warn_files_tests+=(/usr/local/share/icons/Bibata-Modern-Classic) -warn_files_tests+=(/usr/local/bin/{LaTeX,res}) -for i in ${warn_files_tests[@]}; do - echo $i - test -f $i && warn_files+=($i) - test -d $i && warn_files+=($i) -done - +# 0. Before we start +source ./scriptdata/install-greeting ;; ##################################################################################### -printf "\n" -printf "\n" -printf "\n" -printf "\e[36m[$0]: Finished\e[0m\n" -printf "\n" -printf "\e[36mWhen starting Hyprland from your display manager (login screen) \e[30m\e[46m DO NOT SELECT UWSM \e[0m\e[36m\e[0m\n" -printf "\n" -printf "\e[36mIf you are already running Hyprland,\e[0m\n" -printf "\e[36mPress \e[30m\e[46m Ctrl+Super+T \e[0m\e[36m to select a wallpaper\e[0m\n" -printf "\e[36mPress \e[30m\e[46m Super+/ \e[0m\e[36m for a list of keybinds\e[0m\n" -printf "\n" -printf "\e[36mFor suggestions/hints after installation:\e[0m\n" -printf "\e[36m\e[4m https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/01setup/#post-installation \e[0m\n" -printf "\n" - -case $existed_hypr_conf_firstrun in - y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before. As it seems it is your first run, we replaced it with a new one. \e[0m\n" - printf "\e[33mAs it seems it is your first run, we replaced it with a new one. The old one has been renamed to \"$XDG_CONFIG_HOME/hypr/hyprland.conf.old\".\e[0m\n" -;;esac -case $existed_hypr_conf in - y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before and we didn't overwrite it. \e[0m\n" - printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hyprland.conf.new\" as a reference for a proper format.\e[0m\n" -;;esac -case $existed_hypridle_conf in - y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hypridle.conf\" already existed before and we didn't overwrite it. \e[0m\n" - printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hypridle.conf.new\" as a reference for a proper format.\e[0m\n" -;;esac -case $existed_hyprlock_conf in - y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprlock.conf\" already existed before and we didn't overwrite it. \e[0m\n" - printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hyprlock.conf.new\" as a reference for a proper format.\e[0m\n" -;;esac - -if [[ -z "${ILLOGICAL_IMPULSE_VIRTUAL_ENV}" ]]; then - printf "\n\e[31m[$0]: \!! Important \!! : Please ensure environment variable \e[0m \$ILLOGICAL_IMPULSE_VIRTUAL_ENV \e[31m is set to proper value (by default \"~/.local/state/quickshell/.venv\"), or Quickshell config will not work. We have already provided this configuration in ~/.config/hypr/hyprland/env.conf, but you need to ensure it is included in hyprland.conf, and also a restart is needed for applying it.\e[0m\n" -fi - -if [[ ! -z "${warn_files[@]}" ]]; then - printf "\n\e[31m[$0]: \!! Important \!! : Please delete \e[0m ${warn_files[*]} \e[31m manually as soon as possible, since we\'re now using AUR package or local PKGBUILD to install them for Arch(based) Linux distros, and they'll take precedence over our installation, or at least take up more space.\e[0m\n" -fi +printf "\e[36m[$0]: 1. Install dependencies\n\e[0m" +# TODO: if `--via-nix` is specified, source `install-deps-nix` instead. +source ./scriptdata/install-deps-arch +##################################################################################### +printf "\e[36m[$0]: 2. Setup for user groups/services etc\n\e[0m" +source ./scriptdata/install-setups +##################################################################################### +printf "\e[36m[$0]: 3. Copying + Configuring\e[0m\n" +source ./scriptdata/install-files diff --git a/scriptdata/checkdeps.sh b/scriptdata/checkdeps.sh deleted file mode 100755 index 16c40066e..000000000 --- a/scriptdata/checkdeps.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -# Check whether pkgs exist in AUR or repos of Arch. -# This is a workaround for https://github.com/end-4/dots-hyprland/discussions/204 -# Do NOT abuse this since it consumes extra bandwidth from AUR server. - -set -e -cd "$(dirname "$0")" -cd .. -export base="$(pwd)" -source ./scriptdata/functions -source ./scriptdata/installers - -pkglistfile=$(mktemp) -pkglistfile_orig=./scriptdata/dependencies.conf -pkglistfile_orig_s=./cache/dependencies_stripped.conf -remove_bashcomments_emptylines $pkglistfile_orig $pkglistfile_orig_s - -cat $pkglistfile_orig_s | sed "s_\ _\n_g" > $pkglistfile - -echo "The non-existent pkgs in $pkglistfile_orig are listed as follows." -# Borrowed from https://bbs.archlinux.org/viewtopic.php?pid=1490795#p1490795 -comm -23 <(sort -u $pkglistfile) <(sort -u <(wget -q -O - https://aur.archlinux.org/packages.gz | gunzip) <(pacman -Ssq)) -echo "End of list. If nothing appears, then all pkgs exist." -rm $pkglistfile diff --git a/scriptdata/dependencies.conf b/scriptdata/dependencies.conf deleted file mode 100644 index de16fe7ed..000000000 --- a/scriptdata/dependencies.conf +++ /dev/null @@ -1,5 +0,0 @@ -### This file supports bash-style comments, and blank lines. -### PKGs on same line will be sent to `yay` together, unless `-f` is specified. - -### Most dependencies have been moved to meta packages as declared in arch-packages. -### Use this file for declaring extra dependencies which you need but are not declared by default. diff --git a/scriptdata/functions b/scriptdata/functions index f4559fb02..a1304d249 100644 --- a/scriptdata/functions +++ b/scriptdata/functions @@ -69,17 +69,6 @@ function remove_bashcomments_emptylines(){ } function prevent_sudo_or_root(){ case $(whoami) in - root)echo -e "\e[31m[$0]: This script is NOT to be executed with sudo or as root. Aborting...\e[0m";exit 1;; + root) echo -e "\e[31m[$0]: This script is NOT to be executed with sudo or as root. Aborting...\e[0m";exit 1;; esac } - - -function backup_configs() { - local backup_dir="$BACKUP_DIR" - mkdir -p "$backup_dir" - echo "Backing up $XDG_CONFIG_HOME to $backup_dir/config_backup" - rsync -av --progress "$XDG_CONFIG_HOME/" "$backup_dir/config_backup/" - - echo "Backing up $HOME/.local to $backup_dir/local_backup" - rsync -av --progress "$HOME/.local/" "$backup_dir/local_backup/" -} diff --git a/scriptdata/install-deps-arch b/scriptdata/install-deps-arch new file mode 100644 index 000000000..a390f34f7 --- /dev/null +++ b/scriptdata/install-deps-arch @@ -0,0 +1,116 @@ +# 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 "\e[36m[$0]: Removing deprecated dependencies:\e[0m\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 "\e[31m[$0]: pacman not found, it seems that the system is not ArchLinux or Arch-based distros. Aborting...\e[0m\n" + exit 1 +fi + +# Issue #363 +case $SKIP_SYSUPDATE in + true) sleep 0;; + *) v sudo pacman -Syu;; +esac + +remove_bashcomments_emptylines ${DEPLISTFILE} ./cache/dependencies_stripped.conf +readarray -t pkglist < ./cache/dependencies_stripped.conf + +# 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 "\e[33m[$0]: \"yay\" not found.\e[0m" + showfun install-yay + v install-yay +fi + +# Install extra packages from dependencies.conf as declared by the user +if (( ${#pkglist[@]} != 0 )); then + if $ask; then + # execute per element of the array $pkglist + for i in "${pkglist[@]}";do v yay -S --needed $i;done + else + # execute for all elements of the array $pkglist in one line + v yay -S --needed --noconfirm ${pkglist[*]} + fi +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=(./arch-packages/illogical-impulse-{audio,backlight,basic,fonts-themes,kde,portal,python,screencapture,toolkit,widgets}) +metapkgs+=(./arch-packages/illogical-impulse-hyprland) +metapkgs+=(./arch-packages/illogical-impulse-microtex-git) +# metapkgs+=(./arch-packages/illogical-impulse-oneui4-icons-git) +[[ -f /usr/share/icons/Bibata-Modern-Classic/index.theme ]] || \ + metapkgs+=(./arch-packages/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 "\e[33m[$0]: NOTE: The size of \"plasma-browser-integration\" is about 600 MiB.\e[0m" + echo -e "\e[33mIt is needed if you want playtime of media in Firefox to be shown on the music controls widget.\e[0m" + echo -e "\e[33mInstall it? [y/N]\e[0m" + 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 diff --git a/scriptdata/install-files b/scriptdata/install-files new file mode 100644 index 000000000..e77e756f3 --- /dev/null +++ b/scriptdata/install-files @@ -0,0 +1,176 @@ +# This script is meant to be sourced. +# It's not for directly running. + +# TODO: make function backup_configs only cover the possibly overwritten ones. +function backup_configs() { + local backup_dir="$BACKUP_DIR" + mkdir -p "$backup_dir" + echo "Backing up $XDG_CONFIG_HOME to $backup_dir/config_backup" + rsync -av --progress "$XDG_CONFIG_HOME/" "$backup_dir/config_backup/" + + echo "Backing up $HOME/.local to $backup_dir/local_backup" + rsync -av --progress "$HOME/.local/" "$backup_dir/local_backup/" +} + +function ask_backup_configs() { + printf "\e[31m" + printf "Would you like to create a backup for \"$XDG_CONFIG_HOME\" and \"$HOME/.local/\" folders?\n[y/N]: " + read -p " " backup_confirm + case $backup_confirm in + [yY][eE][sS]|[yY]) backup_configs ;; + *) echo "Skipping backup..." ;; + esac + printf "\e[00m" +} + +##################################################################################### + +# In case some folders does not exists +v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME + +case $ask in + false) sleep 0 ;; + *) ask_backup_configs ;; +esac + +# `--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 + +# MISC (For .config/* but not fish, not Hyprland) +case $SKIP_MISCCONF in + true) sleep 0;; + *) + for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'fish' ! -name 'hypr' -exec basename {} \;); do +# i=".config/$i" + echo "[$0]: Found target: .config/$i" + if [ -d ".config/$i" ];then v rsync -av --delete ".config/$i/" "$XDG_CONFIG_HOME/$i/" + elif [ -f ".config/$i" ];then v rsync -av ".config/$i" "$XDG_CONFIG_HOME/$i" + fi + done + ;; +esac + +case $SKIP_FISH in + true) sleep 0;; + *) + v rsync -av --delete .config/fish/ "$XDG_CONFIG_HOME"/fish/ + ;; +esac + +# For Hyprland +case $SKIP_HYPRLAND in + true) sleep 0;; + *) + v rsync -av --delete --exclude '/custom' --exclude '/hyprlock.conf' --exclude '/hypridle.conf' --exclude '/hyprland.conf' .config/hypr/ "$XDG_CONFIG_HOME"/hypr/ + t="$XDG_CONFIG_HOME/hypr/hyprland.conf" + if [ -f $t ];then + echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" + v mv $t $t.old + v cp -f .config/hypr/hyprland.conf $t + existed_hypr_conf_firstrun=y + else + echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" + v cp .config/hypr/hyprland.conf $t + existed_hypr_conf=n + fi + t="$XDG_CONFIG_HOME/hypr/hypridle.conf" + if [ -f $t ];then + echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" + v cp -f .config/hypr/hypridle.conf $t.new + existed_hypridle_conf=y + else + echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" + v cp .config/hypr/hypridle.conf $t + existed_hypridle_conf=n + fi + t="$XDG_CONFIG_HOME/hypr/hyprlock.conf" + if [ -f $t ];then + echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" + v cp -f .config/hypr/hyprlock.conf $t.new + existed_hyprlock_conf=y + else + echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" + v cp .config/hypr/hyprlock.conf $t + existed_hyprlock_conf=n + fi + t="$XDG_CONFIG_HOME/hypr/custom" + if [ -d $t ];then + echo -e "\e[34m[$0]: \"$t\" already exists, will not do anything.\e[0m" + else + echo -e "\e[33m[$0]: \"$t\" does not exist yet.\e[0m" + v rsync -av --delete .config/hypr/custom/ $t/ + fi + ;; +esac + + +# some foldes (eg. .local/bin) should be processed separately to avoid `--delete' for rsync, +# since the files here come from different places, not only about one program. +# v rsync -av ".local/bin/" "$XDG_BIN_HOME" # No longer needed since scripts are no longer in ~/.local/bin +v rsync -av ".local/share/icons/" "${XDG_DATA_HOME:-$HOME/.local/share}"/icons/ +v rsync -av ".local/share/konsole/" "${XDG_DATA_HOME:-$HOME/.local/share}"/konsole/ + +# Prevent hyprland from not fully loaded +sleep 1 +try hyprctl reload + +existed_zsh_conf=n +grep -q 'source ${XDG_CONFIG_HOME:-~/.config}/zshrc.d/dots-hyprland.zsh' ~/.zshrc && existed_zsh_conf=y + +warn_files=() +warn_files_tests=() +warn_files_tests+=(/usr/local/lib/{GUtils-1.0.typelib,Gvc-1.0.typelib,libgutils.so,libgvc.so}) +warn_files_tests+=(/usr/local/share/fonts/TTF/Rubik{,-Italic}'[wght]'.ttf) +warn_files_tests+=(/usr/local/share/licenses/ttf-rubik) +warn_files_tests+=(/usr/local/share/fonts/TTF/Gabarito-{Black,Bold,ExtraBold,Medium,Regular,SemiBold}.ttf) +warn_files_tests+=(/usr/local/share/licenses/ttf-gabarito) +warn_files_tests+=(/usr/local/share/icons/OneUI{,-dark,-light}) +warn_files_tests+=(/usr/local/share/icons/Bibata-Modern-Classic) +warn_files_tests+=(/usr/local/bin/{LaTeX,res}) +for i in ${warn_files_tests[@]}; do + echo $i + test -f $i && warn_files+=($i) + test -d $i && warn_files+=($i) +done + +##################################################################################### +printf "\n" +printf "\n" +printf "\n" +printf "\e[36m[$0]: Finished\e[0m\n" +printf "\n" +printf "\e[36mWhen starting Hyprland from your display manager (login screen) \e[30m\e[46m DO NOT SELECT UWSM \e[0m\e[36m\e[0m\n" +printf "\n" +printf "\e[36mIf you are already running Hyprland,\e[0m\n" +printf "\e[36mPress \e[30m\e[46m Ctrl+Super+T \e[0m\e[36m to select a wallpaper\e[0m\n" +printf "\e[36mPress \e[30m\e[46m Super+/ \e[0m\e[36m for a list of keybinds\e[0m\n" +printf "\n" +printf "\e[36mFor suggestions/hints after installation:\e[0m\n" +printf "\e[36m\e[4m https://end-4.github.io/dots-hyprland-wiki/en/ii-qs/01setup/#post-installation \e[0m\n" +printf "\n" + +case $existed_hypr_conf_firstrun in + y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before. As it seems it is your first run, we replaced it with a new one. \e[0m\n" + printf "\e[33mAs it seems it is your first run, we replaced it with a new one. The old one has been renamed to \"$XDG_CONFIG_HOME/hypr/hyprland.conf.old\".\e[0m\n" +;;esac +case $existed_hypr_conf in + y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before and we didn't overwrite it. \e[0m\n" + printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hyprland.conf.new\" as a reference for a proper format.\e[0m\n" +;;esac +case $existed_hypridle_conf in + y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hypridle.conf\" already existed before and we didn't overwrite it. \e[0m\n" + printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hypridle.conf.new\" as a reference for a proper format.\e[0m\n" +;;esac +case $existed_hyprlock_conf in + y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprlock.conf\" already existed before and we didn't overwrite it. \e[0m\n" + printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hyprlock.conf.new\" as a reference for a proper format.\e[0m\n" +;;esac + +if [[ -z "${ILLOGICAL_IMPULSE_VIRTUAL_ENV}" ]]; then + printf "\n\e[31m[$0]: \!! Important \!! : Please ensure environment variable \e[0m \$ILLOGICAL_IMPULSE_VIRTUAL_ENV \e[31m is set to proper value (by default \"~/.local/state/quickshell/.venv\"), or Quickshell config will not work. We have already provided this configuration in ~/.config/hypr/hyprland/env.conf, but you need to ensure it is included in hyprland.conf, and also a restart is needed for applying it.\e[0m\n" +fi + +if [[ ! -z "${warn_files[@]}" ]]; then + printf "\n\e[31m[$0]: \!! Important \!! : Please delete \e[0m ${warn_files[*]} \e[31m manually as soon as possible, since we\'re now using AUR package or local PKGBUILD to install them for Arch(based) Linux distros, and they'll take precedence over our installation, or at least take up more space.\e[0m\n" +fi diff --git a/scriptdata/install-greeting b/scriptdata/install-greeting new file mode 100644 index 000000000..37954993c --- /dev/null +++ b/scriptdata/install-greeting @@ -0,0 +1,34 @@ +# This script is meant to be sourced. +# It's not for directly running. + +##################################################################################### + +printf "\e[34m[$0]: Hi there! Before we start:\n" +printf '\n' +printf '[NEW] illogical-impulse is now powered by Quickshell. If you were using the old version with AGS and would like to keep it, do not run this script.\n' +printf ' The AGS version, although uses less memory, has much worse performance (it uses Gtk3). \n' +printf ' If you aren'\''t running on ewaste, the Quickshell version is recommended. \n' +printf ' If you would like the AGS version anyway, run the script in its branch instead: git checkout ii-ags && ./install.sh\n' +printf '\n' +printf 'This script does not handle system-level/hardware stuff like Nvidia drivers.\n' +printf "\e[00m" + + +case $ask in + false) sleep 0 ;; + *) + printf "\e[31m" + printf '\n' + printf 'Do you want to confirm every time before a command executes?\n' + printf ' y = Yes, ask me before executing each of them. (DEFAULT)\n' + printf ' n = No, I know everything this script will do, just execute them automatically.\n' + printf ' a = Abort.\n' + read -p "====> " p + case $p in + n) ask=false ;; + a) exit 1 ;; + *) ask=true ;; + esac + printf "\e[00m" + ;; +esac diff --git a/scriptdata/install-setups b/scriptdata/install-setups new file mode 100644 index 000000000..923ac2bc5 --- /dev/null +++ b/scriptdata/install-setups @@ -0,0 +1,15 @@ +# 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/installers b/scriptdata/installers index 7de00454c..4cf45f3a9 100644 --- a/scriptdata/installers +++ b/scriptdata/installers @@ -1,6 +1,4 @@ -# This file is provided for non-Arch(based) distros. -# As for Arch Linux, we use local PKGBUILDs or AUR packages, which is the "right" way compared to copying files directly into /usr/local/* . -# P.S. install-yay() should be kept for Arch(based) distros. +# This file is provided for any distros, mainly non-Arch(based) distros. # This script depends on `functions' . # This is NOT a script for execution, but for loading functions, so NOT need execution permission or shebang. @@ -10,19 +8,6 @@ # cd "$(dirname "$0")" # export base="$(pwd)" -# Only for Arch(based) distro. -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 -} - -# Not for Arch(based) distro. install-agsv1 (){ x mkdir -p $base/cache/agsv1 x cd $base/cache/agsv1 @@ -38,7 +23,6 @@ install-agsv1 (){ x cd $base } -# Not for Arch(based) distro. install-Rubik (){ x mkdir -p $base/cache/Rubik x cd $base/cache/Rubik @@ -54,7 +38,6 @@ install-Rubik (){ x cd $base } -# Not for Arch(based) distro. install-Gabarito (){ x mkdir -p $base/cache/Gabarito x cd $base/cache/Gabarito @@ -69,7 +52,6 @@ install-Gabarito (){ x cd $base } -# Not for Arch(based) distro. install-OneUI (){ x mkdir -p $base/cache/OneUI4-Icons x cd $base/cache/OneUI4-Icons @@ -84,7 +66,6 @@ install-OneUI (){ x cd $base } -# Not for Arch(based) distro. install-bibata (){ x mkdir -p $base/cache/bibata-cursor x cd $base/cache/bibata-cursor @@ -98,7 +79,6 @@ install-bibata (){ x cd $base } -# Not for Arch(based) distro. install-MicroTeX (){ x mkdir -p $base/cache/MicroTeX x cd $base/cache/MicroTeX @@ -115,12 +95,10 @@ install-MicroTeX (){ x cd $base } -# Not for Arch(based) distro. install-uv (){ x bash <(curl -LJs "https://astral.sh/uv/install.sh") } -# Both for Arch(based) and other distros. install-python-packages (){ UV_NO_MODIFY_PATH=1 ILLOGICAL_IMPULSE_VIRTUAL_ENV=$XDG_STATE_HOME/quickshell/.venv @@ -131,21 +109,3 @@ install-python-packages (){ x uv pip install -r scriptdata/requirements.txt x deactivate # We don't need the virtual environment anymore } - -# Only for Arch(based) distro. -handle-deprecated-dependencies (){ - printf "\e[36m[$0]: Removing deprecated dependencies:\e[0m\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 -} diff --git a/scriptdata/options b/scriptdata/options index 2194ed14b..300bd2b15 100644 --- a/scriptdata/options +++ b/scriptdata/options @@ -12,7 +12,7 @@ If no option is specified, run default install process. -h, --help Print this help message and exit -f, --force (Dangerous) Force mode without any confirm -c, --clean Clean the build cache first - -s, --skip-sysupdate Skip \"sudo pacman -Syu\" + -s, --skip-sysupdate Skip system package upgrade e.g. \"sudo pacman -Syu\" --skip-hyprland Skip installing the config for Hyprland --skip-fish Skip installing the config for Fish --skip-plasmaintg Skip installing plasma-browser-integration