Fix: pacman and AUR call

This commit is contained in:
Cyrille L 2022-04-25 17:45:31 +02:00
parent 8149886365
commit 4fc287d787
2 changed files with 21 additions and 23 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# version: 0.1.0 # version: 0.1.1
# file: upd # file: upd
# Folder: /usr/local/bin # Folder: /usr/local/bin
# By echolib # By echolib
@ -12,7 +12,7 @@
if__command() { if__command() {
! [[ `command -v $1` ]] \ ! [[ `command -v $1` ]] \
&& echo -e "$I_Red Missing $1 command" \ && echo -e "$I_Red Missing $1 command" \
&& exit 1 && exit
} }
if__file() { if__file() {
@ -20,7 +20,7 @@ case "$2" in
source) source)
! [[ -f "$1" ]] \ ! [[ -f "$1" ]] \
&& echo "# Missing file: $1" \ && echo "# Missing file: $1" \
&& exit 1 && exit
source "$1" source "$1"
;; ;;
create) create)
@ -43,11 +43,11 @@ if ! [[ -d "$1" ]];then
;; ;;
check) check)
echo "! Missing folder: $1" echo "! Missing folder: $1"
exit 1 exit
;; ;;
*) *)
echo "! Missing folder: $1" echo "! Missing folder: $1"
exit 1 exit
;; ;;
esac esac
fi fi
@ -63,7 +63,7 @@ elif [[ `command -v pacman` ]];then
&& aur=yay && aur=yay
else else
echo "! upd is not yet ready for this System" echo "! upd is not yet ready for this System"
exit 0 exit
fi fi
} }

View File

@ -15,15 +15,15 @@ case "$sysup" in
clear clear
upd__check_arch upd__check_arch
(( $upd_nbr == 0 )) \ (( $upd_nbr == 0 )) \
&& exit 0 && exit
upg__arch_system upg__arch_system
;; ;;
apt) apt)
clear clear
upd__check_deb upd__check_deb
(( $upd_nbr == 0 )) \ (( $upd_nbr == 0 )) \
&& exit 0 && exit
upg__deb_upgrade upg__deb_upgrade
;; ;;
@ -36,7 +36,7 @@ case "$sysup" in
clear clear
upd__check_arch upd__check_arch
(( $upd_nbr == 0 )) && (( $upd_nbr_aur == 0 )) \ (( $upd_nbr == 0 )) && (( $upd_nbr_aur == 0 )) \
&& exit 0 && exit
upg__arch_system upg__arch_system
upg__arch_aur upg__arch_aur
@ -45,8 +45,8 @@ case "$sysup" in
clear clear
upd__check_deb upd__check_deb
(( $upd_nbr == 0 )) \ (( $upd_nbr == 0 )) \
&& exit 0 && exit
upg__deb_full_upgrade upg__deb_full_upgrade
;; ;;
esac esac
@ -55,13 +55,12 @@ case "$sysup" in
aur) aur)
[[ $arch == "apt" ]] \ [[ $arch == "apt" ]] \
&& echo "# Invalid option for this system" \ && echo "# Invalid option for this system" \
&& exit 0 && exit
upd__check_arch upd__check_arch
(( $upd_nbr_aur == 0 )) \ (( $upd_nbr_aur == 0 )) \
&& exit 0 && exit
#clear
upg__arch_aur upg__arch_aur
;; ;;
@ -84,26 +83,25 @@ upd__sudoroot # Tools: Check if user is admin
echo "# Syncing..." echo "# Syncing..."
sudo pacman -Sy &>/dev/null sudo pacman -Sy &>/dev/null
echo -ne "\r\033[2K"
upd_pkg_upg="--ignore=linux --ignore=linux-headers"
if [[ `grep "^linux-" "$upd_file_check"` ]];then if [[ `grep "^linux-" "$upd_file_check"` ]];then
read -rp "$I_Red Upgrade Kernel (y|N)? " upd_arch_ask read -rp ": Upgrade Kernel (y|N)? " upd_arch_ask
case "$upd_arch_ask" in case "$upd_arch_ask" in
Y|y) unset upd_pkg_upg ;; Y|y) unset upd_pkg_upg ;;
*) true ;; *) upd_pkg_upg="--ignore linux,linux-headers" ;;
esac esac
fi fi
echo -e "$I_Yellow Upgrading System...\n" echo -e "$I_Yellow Upgrading System...\n"
sudo pacman -Su --noconfirm --needed "$upd_pkg_upg" sudo pacman -Su --noconfirm --needed $upd_pkg_upg
} }
upg__arch_aur() { upg__arch_aur() {
upd__sudoroot # Tools: Check if user is admin upd__sudoroot # Tools: Check if user is admin
if [[ "$aur" == "yay" ]];then if [[ "$aur" == "yay" ]];then
echo -e "$I_Yellow Upgrading AUR packages...\n" echo -e "$I_Yellow Upgrading AUR packages...\n"
yay -Syu --save --sudoloop --nocleanmenu --nodiffmenu --noeditmenu yay -Syu --aur --save --sudoloop \
--nocleanmenu --nodiffmenu --noeditmenu --noupgrademenu
else else
echo "$I_Red Not using yay ; abandon" echo "$I_Red Not using yay ; abandon"
fi fi