Test the changes that have been made

This commit is contained in:
Bishoy Ehab
2025-10-18 22:53:52 +03:00
parent 0facd08fa9
commit 1fd328f90a
13 changed files with 383 additions and 260 deletions
+8 -6
View File
@@ -1,6 +1,8 @@
# This is NOT a script for execution, but for loading functions, so NOT need execution permission or shebang.
# NOTE that you NOT need to `cd ..' because the `$0' is NOT this file, but the script file which will source this file.
# shellcheck shell=bash
# The script that use this file should have two lines on its top as follows:
# cd "$(dirname "$0")"
# export base="$(pwd)"
@@ -9,7 +11,7 @@ function try { "$@" || sleep 0; }
function v(){
echo -e "####################################################"
echo -e "${STY_BLUE}[$0]: Next command:${STY_RST}"
echo -e "${STY_GREEN}$@${STY_RST}"
echo -e "${STY_GREEN}$*${STY_RST}"
local execute=true
if $ask;then
while true;do
@@ -29,14 +31,14 @@ function v(){
done
fi
if $execute;then x "$@";else
echo -e "${STY_YELLOW}[$0]: Skipped \"$@\"${STY_RST}"
echo -e "${STY_YELLOW}[$0]: Skipped \"$*\"${STY_RST}"
fi
}
# When use v() for a defined function, use x() INSIDE its definition to catch errors.
function x(){
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 "${STY_RED}[$0]: Command \"${STY_GREEN}$*${STY_RED}\" has failed."
echo -e "You may need to resolve the problem manually BEFORE repeating this command."
echo -e "[Tip] If a certain package is failing to install, try installing it separately in another terminal.${STY_RST}"
echo " r = Repeat this command (DEFAULT)"
@@ -52,9 +54,9 @@ function x(){
esac
done
case $cmdstatus in
0) echo -e "${STY_BLUE}[$0]: Command \"${STY_GREEN}$@${STY_BLUE}\" finished.${STY_RST}";;
1) echo -e "${STY_RED}[$0]: Command \"${STY_GREEN}$@${STY_RED}\" has failed. Exiting...${STY_RST}";exit 1;;
2) echo -e "${STY_RED}[$0]: Command \"${STY_GREEN}$@${STY_RED}\" has failed but ignored by user.${STY_RST}";;
0) echo -e "${STY_BLUE}[$0]: Command \"${STY_GREEN}$*${STY_BLUE}\" finished.${STY_RST}";;
1) echo -e "${STY_RED}[$0]: Command \"${STY_GREEN}$*${STY_RED}\" has failed. Exiting...${STY_RST}";exit 1;;
2) echo -e "${STY_RED}[$0]: Command \"${STY_GREEN}$*${STY_RED}\" has failed but ignored by user.${STY_RST}";;
esac
}
function showfun(){
+19 -2
View File
@@ -1,13 +1,20 @@
# Handle args for subcmd: exp-update
# shellcheck shell=bash
showhelp(){
echo -e "Syntax: $0 exp-update [OPTIONS]...
echo -e "Usage: install.sh exp-update [OPTIONS]...
Experimental updating without full reinstall.
Updates dotfiles by syncing configuration files to home directory.
Options:
-f, --force Force check all files even if no new commits
-p, --packages Enable package checking and building
-n, --dry-run Show what would be done without making changes
-v, --verbose Enable verbose output
-h, --help Show this help message
-s, --skip-notice Skip notice about script being untested
--non-interactive Run without prompting for user input
This script updates your dotfiles by:
1. Auto-detecting repository structure (dots/ prefix or direct)
@@ -15,12 +22,19 @@ This script updates your dotfiles by:
3. Optionally rebuilding packages (if -p flag is used)
4. Syncing configuration files to home directory
5. Updating script permissions
Ignore file patterns support:
- Exact matches (e.g., 'path/to/file')
- Directory patterns (e.g., 'path/to/dir/')
- Wildcards (e.g., '*.log', 'path/*/file')
- Root-relative patterns (e.g., '/.config')
- Substring matching (prefix with '**', e.g., '**temp' matches any path containing 'temp')
"
}
# `man getopt` to see more
para=$(getopt \
-o hfpnv \
-l help,force,packages,dry-run,verbose,skip-notice \
-l help,force,packages,dry-run,verbose,skip-notice,non-interactive \
-n "$0" -- "$@")
[ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1
#####################################################################################
@@ -42,6 +56,7 @@ CHECK_PACKAGES=false
DRY_RUN=false
VERBOSE=false
SKIP_NOTICE=false
NON_INTERACTIVE=false
eval set -- "$para"
while true ; do
@@ -57,6 +72,8 @@ while true ; do
# log_info "Verbose mode enabled"
--skip-notice) SKIP_NOTICE=true;shift;;
# log_warning "Skipping notice about script being untested"
--non-interactive) NON_INTERACTIVE=true;shift;;
# log_info "Non-interactive mode enabled"
## Ending
--) break ;;
+1
View File
@@ -1,4 +1,5 @@
# Handle args for subcmd: install
# shellcheck shell=bash
showhelp(){
echo -e "Syntax: $0 [OPTIONS]...
+4 -1
View File
@@ -1,6 +1,8 @@
# This is NOT a script for execution, but for loading functions, so NOT need execution permission or shebang.
# NOTE that you NOT need to `cd ..' because the `$0' is NOT this file, but the script file which will source this file.
# shellcheck shell=bash
# The script that use this file should have two lines on its top as follows:
# cd "$(dirname "$0")" export base="$(pwd)"
showhelp_global(){
@@ -35,11 +37,12 @@ Subcommand:
Subcommand:
exp-update Using experimental update script.
Options for exp-update:
-u, --update-force Force check all files even if no new commits (update script)
-f, --force Force check all files even if no new commits (update script)
-p, --packages Enable package checking and building (update script)
-n, --dry-run Show what would be done without making changes (update script)
-v, --verbose Enable verbose output (update script)
--skip-notice Skip warning notice (for experimental scripts)
--non-interactive Run without prompting for user input
"
}
+20 -18
View File
@@ -2,6 +2,8 @@
# This is NOT a script for execution, but for loading functions, so NOT need execution permission or shebang.
# NOTE that you NOT need to `cd ..' because the `$0' is NOT this file, but the script file which will source this file.
# shellcheck shell=bash
# This file is provided for any distros, mainly non-Arch(based) distros.
# The script that use this file should have two lines on its top as follows:
@@ -9,8 +11,8 @@
# export base="$(pwd)"
install-agsv1(){
x mkdir -p $base/cache/agsv1
x cd $base/cache/agsv1
x mkdir -p $REPO_ROOT/cache/agsv1
x cd $REPO_ROOT/cache/agsv1
try git init -b main
try git remote add origin https://github.com/Aylur/ags.git
x git pull origin main && git submodule update --init --recursive
@@ -20,12 +22,12 @@ install-agsv1(){
x meson setup build # --reconfigure
x meson install -C build
x sudo mv /usr/local/bin/ags{,v1}
x cd $base
x cd $REPO_ROOT
}
install-Rubik(){
x mkdir -p $base/cache/Rubik
x cd $base/cache/Rubik
x mkdir -p $REPO_ROOT/cache/Rubik
x cd $REPO_ROOT/cache/Rubik
try git init -b main
try git remote add origin https://github.com/googlefonts/rubik.git
x git pull origin main && git submodule update --init --recursive
@@ -35,12 +37,12 @@ install-Rubik(){
x sudo cp OFL.txt /usr/local/share/licenses/ttf-rubik/LICENSE
x fc-cache -fv
x gsettings set org.gnome.desktop.interface font-name 'Rubik 11'
x cd $base
x cd $REPO_ROOT
}
install-Gabarito(){
x mkdir -p $base/cache/Gabarito
x cd $base/cache/Gabarito
x mkdir -p $REPO_ROOT/cache/Gabarito
x cd $REPO_ROOT/cache/Gabarito
try git init -b main
try git remote add origin https://github.com/naipefoundry/gabarito.git
x git pull origin main && git submodule update --init --recursive
@@ -49,12 +51,12 @@ install-Gabarito(){
x sudo mkdir -p /usr/local/share/licenses/ttf-gabarito/
x sudo cp OFL.txt /usr/local/share/licenses/ttf-gabarito/LICENSE
x fc-cache -fv
x cd $base
x cd $REPO_ROOT
}
install-OneUI(){
x mkdir -p $base/cache/OneUI4-Icons
x cd $base/cache/OneUI4-Icons
x mkdir -p $REPO_ROOT/cache/OneUI4-Icons
x cd $REPO_ROOT/cache/OneUI4-Icons
try git init -b main
try git remote add origin https://github.com/end-4/OneUI4-Icons.git
# try git remote add origin https://github.com/mjkim0727/OneUI4-Icons.git
@@ -63,12 +65,12 @@ install-OneUI(){
x sudo cp -r OneUI /usr/local/share/icons
x sudo cp -r OneUI-dark /usr/local/share/icons
x sudo cp -r OneUI-light /usr/local/share/icons
x cd $base
x cd $REPO_ROOT
}
install-bibata(){
x mkdir -p $base/cache/bibata-cursor
x cd $base/cache/bibata-cursor
x mkdir -p $REPO_ROOT/cache/bibata-cursor
x cd $REPO_ROOT/cache/bibata-cursor
name="Bibata-Modern-Classic"
file="$name.tar.xz"
# Use axel because `curl -O` always downloads a file with 0 byte size, idk why
@@ -76,12 +78,12 @@ install-bibata(){
tar -xf $file
x sudo mkdir -p /usr/local/share/icons
x sudo cp -r $name /usr/local/share/icons
x cd $base
x cd $REPO_ROOT
}
install-MicroTeX(){
x mkdir -p $base/cache/MicroTeX
x cd $base/cache/MicroTeX
x mkdir -p $REPO_ROOT/cache/MicroTeX
x cd $REPO_ROOT/cache/MicroTeX
try git init -b master
try git remote add origin https://github.com/NanoMichael/MicroTeX.git
x git pull origin master && git submodule update --init --recursive
@@ -92,7 +94,7 @@ install-MicroTeX(){
x sudo mkdir -p /opt/MicroTeX
x sudo cp ./LaTeX /opt/MicroTeX/
x sudo cp -r ./res /opt/MicroTeX/
x cd $base
x cd $REPO_ROOT
}
install-uv(){