updates-fedora: add script
parent
8a84a33d9c
commit
6dbd82b7cf
|
@ -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 |
|
@ -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
|
Loading…
Reference in New Issue