New: archlinux user can upgrade system
This commit is contained in:
parent
b4a4809606
commit
47f8ac7629
|
@ -18,6 +18,7 @@ upd_script_check="/var/lib/upd/scripts/check"
|
||||||
upd_script_help="/var/lib/upd/scripts/help"
|
upd_script_help="/var/lib/upd/scripts/help"
|
||||||
upd_script_tools="/var/lib/upd/scripts/tools"
|
upd_script_tools="/var/lib/upd/scripts/tools"
|
||||||
upd_script_updater="/var/lib/upd/scripts/updater"
|
upd_script_updater="/var/lib/upd/scripts/updater"
|
||||||
|
upd_script_upgrader="/var/lib/upd/scripts/upgrader"
|
||||||
|
|
||||||
# Onlinde Repo
|
# Onlinde Repo
|
||||||
repo="https://git.a-lec.org/echolib/upd/-/raw/main/usr/local/bin/upd"
|
repo="https://git.a-lec.org/echolib/upd/-/raw/main/usr/local/bin/upd"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# version: 0.0.14
|
# version: 0.0.15
|
||||||
# file: upd
|
# file: upd
|
||||||
# Folder: /usr/local/bin
|
# Folder: /usr/local/bin
|
||||||
# By echolib
|
# By echolib
|
||||||
|
@ -119,6 +119,16 @@ case "$1" in
|
||||||
Updater
|
Updater
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-u)
|
||||||
|
if__file "$upd_script_upgrader" source
|
||||||
|
case "$arch" in
|
||||||
|
pacman)
|
||||||
|
upd__check_arch
|
||||||
|
upg__arch
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
readme)
|
readme)
|
||||||
if__file "/var/lib/upd/README.md" read
|
if__file "/var/lib/upd/README.md" read
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -12,7 +12,7 @@ checkupdates > "$upd_file_check"
|
||||||
|
|
||||||
# if arch AUR with yay
|
# if arch AUR with yay
|
||||||
[[ "$aur" == "yay" ]] \
|
[[ "$aur" == "yay" ]] \
|
||||||
&& yay -Qu > "$upd_file_check_aur"
|
&& yay -Qu --aur > "$upd_file_check_aur"
|
||||||
|
|
||||||
upd__prepare_show
|
upd__prepare_show
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,5 +94,8 @@ case "$is_admin" in
|
||||||
echo "! No admin rights"
|
echo "! No admin rights"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
sudo-1)
|
||||||
|
sudo -v
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# file: upgrader
|
||||||
|
# Folder: /var/lib/upd/scripts/
|
||||||
|
# By echolib
|
||||||
|
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||||
|
|
||||||
|
#======================================================================
|
||||||
|
# script version checker
|
||||||
|
#======================================================================
|
||||||
|
upg__arch() {
|
||||||
|
|
||||||
|
(( $upd_nbr == 0 )) && (( $upd_nbr_aur == 0 )) \
|
||||||
|
&& echo "# No updates available" \
|
||||||
|
&& exit 0
|
||||||
|
|
||||||
|
[[ -f /var/lib/pacman/db.lck ]] \
|
||||||
|
&& printf '%b%b\n' \
|
||||||
|
"$I_Red System is upgrading... " \
|
||||||
|
"or pacman is locked (/var/lib/pacman/db.lck)" \
|
||||||
|
&& return
|
||||||
|
|
||||||
|
upd__sudoroot # Tools: Check if user is admin
|
||||||
|
echo "# Syncing..."
|
||||||
|
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
|
||||||
|
read -rp "! Upgrade Kernel (y|N)? " upd_arch_ask
|
||||||
|
case "$upd_arch_ask" in
|
||||||
|
Y|y) unset upd_pkg_upg ;;
|
||||||
|
*) true ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "${I_Yellow} Upgrading System...\n"
|
||||||
|
sudo pacman -Su --needed $upd_pkg_upg
|
||||||
|
|
||||||
|
if [[ "$aur" == "yay" ]] && (( $upd_nbr_aur > 0 ));then
|
||||||
|
yay -Syu --save --sudoloop --nocleanmenu --nodiffmenu
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in New Issue