mirror of
https://github.com/tuxdotrs/tuxOS.git
synced 2025-07-07 02:06:34 +05:30
36 lines
956 B
Plaintext
36 lines
956 B
Plaintext
get_total_updates() {
|
|
local total_updates=$(($(checkupdates 2> /dev/null | wc -l || echo 0) + $(paru -Qua 2> /dev/null | wc -l || echo 0)))
|
|
echo "${total_updates:-0}"
|
|
}
|
|
|
|
get_list_updates() {
|
|
echo -e "\033[1m\033[34mRegular updates:\033[0m"
|
|
checkupdates | sed 's/->/\x1b[32;1m\x1b[0m/g'
|
|
}
|
|
|
|
print_updates() {
|
|
local print_updates=$(get_total_updates)
|
|
|
|
if [[ "$print_updates" -gt 0 ]]; then
|
|
echo -e "\033[1m\033[33mThere are $print_updates updates available:\033[0m\n"
|
|
get_list_updates
|
|
else
|
|
echo -e "\033[1m\033[32mYour system is already updated!\033[0m"
|
|
fi
|
|
}
|
|
|
|
update_system() {
|
|
paru -Syu --nocombinedupgrade
|
|
}
|
|
|
|
case "$1" in
|
|
--get-updates)get_total_updates;;
|
|
--print-updates)print_updates;;
|
|
--update-system)update_system;;
|
|
--help|*)echo -e "Updates [options]
|
|
|
|
Options:
|
|
--get-updates Get the numer of updates available.
|
|
--print-updates Print the available package to updates.
|
|
--update-system Update your system including AUR.\n"
|
|
esac |