updates-fedora: add script

master
Rémon S 2019-02-21 17:17:45 +01:00 committed by x70b1
parent 8a84a33d9c
commit 6dbd82b7cf
3 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# Script: updates-fedora
A script that shows if there are updates for Fedora or `dnf` based distributions.
![updates-fedora](screenshots/1.png)
## Configuration
You may need to add the `dnf` command to the `/etc/sudoers` NOPASSWD of your user:
```
user ALL=(ALL) NOPASSWD: /usr/bin/dnf
```
## Module
```ini
[module/updates-fedora]
type = custom/script
exec = ~/polybar-scripts/updates-fedora.sh
interval = 600
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,14 @@
#!/bin/sh
dnf=$(dnf upgrade --refresh --assumeno 2> /dev/null)
upgrade=$(echo "$dnf" | grep '^Upgrade' | awk '{ print $2 }')
install=$(echo "$dnf" | grep '^Install' | awk '{ print $2 }')
updates=$(( upgrade + install ))
if [ "$updates" -gt 0 ]; then
echo "# $updates"
else
echo ""
fi