Skip to content

Commit

Permalink
Added support for OpenSUSE update checks with Zypper
Browse files Browse the repository at this point in the history
  • Loading branch information
G2-Games committed May 7, 2023
1 parent f78aed8 commit e82a0cf
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions welcome.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ updates () {

# Check for updates from different places... wonder if there's a better way
updchk () {
# Check for APT
# Check for APT (Debian based)
if command -v apt-get &> /dev/null; then
debian=$(apt-get -s dist-upgrade -V | grep -c '=>')
fi

# Check for different Arch things
# Check for Arch things
if command -v checkupdates &> /dev/null; then
arch=$(checkupdates 2> /dev/null | wc -l)
elif command -v yay &> /dev/null; then
Expand All @@ -144,6 +144,12 @@ updates () {
fedora=$((fedora-1))
fi

# Check for OpenSUSE things
if command -v zypper &> /dev/null; then
suse=$(zypper list-updates 2> /dev/null | wc -l)
suse=$((suse-4))
fi

# Check for Brew updates
if command -v brew &> /dev/null; then
brew=$(brew outdated 2> /dev/null | wc -l)
Expand All @@ -155,7 +161,7 @@ updates () {
fi

# Add all update counts together
updates=$((debian + arch + fedora + flatpak + brew))
updates=$((debian + arch + fedora + suse + flatpak + brew))
echo $updates >| ~/.welcome/updates
pkill -P "${pid}" sleep # When update checking is finished, kill the sleep function running under this bash process
sleep 5
Expand All @@ -164,7 +170,7 @@ updates () {
fi
}

pid=$$ # Grab the PID of the process
pid=$$ # Grab the PID of the process
updchk & # Check for updates Asynchronously

set +e # Allow nonzero exit status for killing sleep
Expand Down

0 comments on commit e82a0cf

Please sign in to comment.