From ea6fa67385a37556c29f07bf73e1d892df2dc0ff Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 28 Sep 2026 21:31:29 +0500 Subject: arch.sh: refactoring --- %HOME%/.bash_utils/arch.sh | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/%HOME%/.bash_utils/arch.sh b/%HOME%/.bash_utils/arch.sh index c5d4c9a..2965ea6 100644 --- a/%HOME%/.bash_utils/arch.sh +++ b/%HOME%/.bash_utils/arch.sh @@ -3,21 +3,43 @@ # For details, see https://github.com/egor-tensin/linux-home # Distributed under the MIT License. +pacman_upgrade() ( + _bash_func_prelude + sudo pacman -Syu --noconfirm +) + +pacman_cleanup() ( + _bash_func_prelude + + local output + output="$( pacman -Qqdt )" || true + if [ -n "$output" ]; then + echo "$output" | sudo pacman -Rcsn --noconfirm - + fi +) + +yay_opts='--noconfirm --needed --cleanafter --removemake' + yay_upgrade() ( _bash_func_prelude - yay -Syua --noconfirm --needed --cleanafter + yay -Syua $yay_opts ) yay_install() ( _bash_func_prelude - yay -Sya --noconfirm --needed --cleanafter "$@" + yay -Sya $yay_opts "$@" +) + +yay_cleanup() ( + _bash_func_prelude + yay -Sca --noconfirm ) arch_upgrade() ( _bash_func_prelude echo ====================================================================== - sudo pacman -Syu --noconfirm + pacman_upgrade echo ====================================================================== yay_upgrade echo ====================================================================== @@ -32,12 +54,8 @@ arch_cleanup() ( _bash_func_prelude echo ====================================================================== - local output - output="$( pacman -Qqdt )" || true - if [ -n "$output" ]; then - echo "$output" | sudo pacman -Rcsn --noconfirm - - fi + pacman_cleanup echo ====================================================================== - yay -Sca --noconfirm + yay_cleanup echo ====================================================================== ) -- cgit v1.3