ini
This commit is contained in:
41
scripts/update-sys
Executable file
41
scripts/update-sys
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Original script by @speltriao on GitHub
|
||||
# https://github.com/speltriao/Pacman-Update-for-GNOME-Shell
|
||||
|
||||
# If the operating system is not Arch Linux, exit the script successfully
|
||||
if [ ! -f /etc/arch-release ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Calculate updates for each service
|
||||
AUR=$(yay -Qua | wc -l)
|
||||
OFFICIAL=$(checkupdates | wc -l)
|
||||
|
||||
# Case/switch for each service updates
|
||||
case $1 in
|
||||
aur) echo " $AUR";;
|
||||
official) echo " $OFFICIAL";;
|
||||
esac
|
||||
|
||||
# If the parameter is "update", update all services
|
||||
if [ "$1" = "update" ]; then
|
||||
kitty --title update-sys sh -c 'yay -Syu'
|
||||
fi
|
||||
|
||||
# If there aren't any parameters, return the total number of updates
|
||||
if [ "$1" = "" ]; then
|
||||
# Calculate total number of updates
|
||||
COUNT=$((OFFICIAL+AUR))
|
||||
# If there are updates, the script will output the following: Updates
|
||||
# If there are no updates, the script will output nothing.
|
||||
|
||||
if [[ "$COUNT" = "0" ]]
|
||||
then
|
||||
echo ""
|
||||
else
|
||||
# This Update symbol is RTL. So ‭ is left-to-right override.
|
||||
echo " $COUNT"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
Reference in New Issue
Block a user