Add pause(); distro specific also for setups

This commit is contained in:
clsty
2025-10-02 07:13:51 +08:00
parent 34c9cbeedb
commit 3a888f9be4
9 changed files with 170 additions and 34 deletions
+6
View File
@@ -7,6 +7,7 @@ XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
BACKUP_DIR=${BACKUP_DIR:-$HOME/backup} BACKUP_DIR=${BACKUP_DIR:-$HOME/backup}
# Note that all color styles contains a STY_RESET before it.
STY_RED='\e[00m\e[31m' STY_RED='\e[00m\e[31m'
STY_GREEN='\e[00m\e[32m' STY_GREEN='\e[00m\e[32m'
STY_YELLOW='\e[00m\e[33m' STY_YELLOW='\e[00m\e[33m'
@@ -21,5 +22,10 @@ STY_BG_BLUE='\e[30m\e[44m'
STY_BG_PURPLE='\e[30m\e[45m' STY_BG_PURPLE='\e[30m\e[45m'
STY_BG_CYAN='\e[30m\e[46m' STY_BG_CYAN='\e[30m\e[46m'
STY_BOLD='\e[1m'
STY_FAINT='\e[2m'
STY_SLANT='\e[3m'
STY_UNDERLINE='\e[4m' STY_UNDERLINE='\e[4m'
STY_BLINK='\e[5m'
STY_INVERT='\e[7m'
STY_RESET='\e[00m' STY_RESET='\e[00m'
+3
View File
@@ -63,6 +63,9 @@ function showfun(){
type -a $1 type -a $1
printf "${STY_RESET}" 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
}
function remove_bashcomments_emptylines(){ function remove_bashcomments_emptylines(){
mkdir -p $(dirname $2) mkdir -p $(dirname $2)
cat $1 | sed -e '/^[[:blank:]]*#/d;s/#.*//' -e '/^[[:space:]]*$/d' > $2 cat $1 | sed -e '/^[[:blank:]]*#/d;s/#.*//' -e '/^[[:space:]]*$/d' > $2
+6 -8
View File
@@ -41,6 +41,7 @@ if [[ "$INSTALL_VIA_NIX" == "true" ]]; then
printf "Proceed only at your own risk.\n" printf "Proceed only at your own risk.\n"
printf "\n" printf "\n"
printf "${STY_RESET}" printf "${STY_RESET}"
pause
source ./scriptdata/install-deps-nix.sh source ./scriptdata/install-deps-nix.sh
elif [[ "$OS_DISTRO_ID" =~ ^(arch|endeavouros)$ ]]; then elif [[ "$OS_DISTRO_ID" =~ ^(arch|endeavouros)$ ]]; then
@@ -51,6 +52,7 @@ elif [[ "$OS_DISTRO_ID" =~ ^(arch|endeavouros)$ ]]; then
printf "./scriptdata/install-deps-arch.sh will be used.\n" printf "./scriptdata/install-deps-arch.sh will be used.\n"
printf "\n" printf "\n"
printf "${STY_RESET}" printf "${STY_RESET}"
pause
source ./scriptdata/install-deps-arch.sh source ./scriptdata/install-deps-arch.sh
elif [[ -f "./scriptdata/install-deps-${OS_DISTRO_ID}.sh" ]]; then elif [[ -f "./scriptdata/install-deps-${OS_DISTRO_ID}.sh" ]]; then
@@ -67,6 +69,7 @@ elif [[ -f "./scriptdata/install-deps-${OS_DISTRO_ID}.sh" ]]; then
printf "Proceed only at your own risk.\n" printf "Proceed only at your own risk.\n"
printf "\n" printf "\n"
printf "${STY_RESET}" printf "${STY_RESET}"
pause
source ./scriptdata/install-deps-${OS_DISTRO_ID}.sh source ./scriptdata/install-deps-${OS_DISTRO_ID}.sh
elif [[ "$OS_DISTRO_ID_LIKE" == "arch" ]]; then elif [[ "$OS_DISTRO_ID_LIKE" == "arch" ]]; then
@@ -81,12 +84,13 @@ elif [[ "$OS_DISTRO_ID_LIKE" == "arch" ]]; then
printf "Proceed only at your own risk.\n" printf "Proceed only at your own risk.\n"
printf "\n" printf "\n"
printf "${STY_RESET}" printf "${STY_RESET}"
pause
source ./scriptdata/install-deps-arch.sh source ./scriptdata/install-deps-arch.sh
else else
printf "${STY_RED}" printf "${STY_RED}"
printf "===URGENT===\n" printf "${STY_BOLD}===URGENT===${STY_RED}\n"
printf "Detected distro ID: ${OS_DISTRO_ID}\n" printf "Detected distro ID: ${OS_DISTRO_ID}\n"
printf "Detected distro ID_LIKE: ${OS_DISTRO_ID_LIKE}\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-${OS_DISTRO_ID}.sh not found.\n"
@@ -94,13 +98,7 @@ else
printf "It may disrupt your system and will likely fail without your manual intervention.\n" printf "It may disrupt your system and will likely fail without your manual intervention.\n"
printf "Proceed only at your own risk.\n" printf "Proceed only at your own risk.\n"
printf "${STY_RESET}" printf "${STY_RESET}"
printf "${STY_BG_RED}" pause
printf "To tell you the truth, it is completely not worky at this time. The prompt here is only for testing and WIP. PLEASE JUST QUIT IMMEDIATELY.${STY_RESET}\n"
read -p "Still continue? [y/N] ====> " p
case $p in
[yY]) sleep 0 ;;
*) exit 1 ;;
esac
source ./scriptdata/install-deps-fallback.sh source ./scriptdata/install-deps-fallback.sh
fi fi
+1
View File
@@ -135,6 +135,7 @@ for i in ${warn_files_tests[@]}; do
done done
##################################################################################### #####################################################################################
# TODO: output the logs below to a temp file and cat that file, also show the path of the file so users will be able to read it again.
printf "\n" printf "\n"
printf "\n" printf "\n"
printf "\n" printf "\n"
+26 -15
View File
@@ -3,27 +3,38 @@
##################################################################################### #####################################################################################
printf "${STY_BLUE}[$0]: Hi there! Before we start:\n" printf "${STY_CYAN}[$0]: Hi there! Before we start:${STY_RESET}\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 "\n" printf "\n"
printf "${STY_PURPLE}${STY_BOLD}[NEW] illogical-impulse is now powered by Quickshell.${STY_PURPLE}\n"
printf '# 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:\n ${STY_INVERT} git checkout ii-ags && ./install.sh ${STY_RESET}\n"
printf "\n"
pause
printf "${STY_CYAN}${STY_BOLD}Quick overview about what this script does:${STY_CYAN}\n"
printf " 1. Install dependencies.\n"
printf " 2. Setup permissions/services etc.\n"
printf " 3. Copying config files.${STY_RESET}\n"
pause
printf "${STY_CYAN}${STY_BOLD}Tips:${STY_CYAN}\n"
printf " a) It has been designed to be idempotent which means you can run it multiple times.\n"
printf " b) Use ${STY_INVERT} --help ${STY_CYAN} for more options.${STY_RESET}\n"
printf "${STY_YELLOW}${STY_BOLD}Note: ${STY_YELLOW}"
printf "It does not handle system-level/hardware stuff like Nvidia drivers.\n"
printf "${STY_RESET}" printf "${STY_RESET}"
printf "\n"
pause
case $ask in case $ask in
false) sleep 0 ;; false) sleep 0 ;;
*) *)
printf "${STY_RED}" printf "${STY_BLUE}"
printf '\n' printf "${STY_BOLD}Do you want to confirm every time before a command executes?${STY_BLUE}\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 ' 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 ' n = No, I know everything this script will do, just execute them automatically.\n' printf " a = Abort.\n"
printf ' a = Abort.\n' read -p "===> [Y/n/a]: " p
read -p "====> " p
case $p in case $p in
n) ask=false ;; n) ask=false ;;
a) exit 1 ;; a) exit 1 ;;
+15
View File
@@ -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
+15
View File
@@ -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
+15
View File
@@ -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
+83 -11
View File
@@ -1,15 +1,87 @@
# This script is meant to be sourced. # This script is meant to be sourced.
# It's not for directly running. # 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. # Detect distro
showfun install-python-packages # Helpful link(s):
v install-python-packages # 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)
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 if [[ "$INSTALL_VIA_NIX" == "true" ]]; then
v sudo systemctl enable bluetooth --now
v gsettings set org.gnome.desktop.interface font-name 'Rubik 11' printf "${STY_YELLOW}"
v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' printf "===WARNING===\n"
v kwriteconfig6 --file kdeglobals --group KDE --key widgetStyle Darkly printf "Nix will be used to do setups.\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
elif [[ "$OS_DISTRO_ID" == "arch" ]]; then
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 "\n"
printf "${STY_RESET}"
pause
source ./scriptdata/install-setups-arch.sh
elif [[ -f "./scriptdata/install-setups-${OS_DISTRO_ID}.sh" ]]; then
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 "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-setups-${OS_DISTRO_ID}.sh
elif [[ "$OS_DISTRO_ID_LIKE" == "arch" ]]; 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-setups-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-setups-arch.sh
else
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 "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
fi