From 1695d600a000abf65ef6e5e0a176991c00773b31 Mon Sep 17 00:00:00 2001 From: Justine Smithies Date: Sun, 2 Jun 2024 13:18:49 +0100 Subject: Added Chimera Linux updates script ( Allowed wheel group to 'apk update' only in doas.conf ) --- .config/yambar/config.yml | 20 ++++++++-------- .config/yambar/scripts/chimera-updates.sh | 38 +++++++++++++++++++++++++++++++ .config/yambar/scripts/void-updates.sh | 38 ------------------------------- 3 files changed, 48 insertions(+), 48 deletions(-) create mode 100755 .config/yambar/scripts/chimera-updates.sh delete mode 100755 .config/yambar/scripts/void-updates.sh diff --git a/.config/yambar/config.yml b/.config/yambar/config.yml index 61f1bf8..0cb638b 100644 --- a/.config/yambar/config.yml +++ b/.config/yambar/config.yml @@ -82,16 +82,16 @@ bar: text: "{time}" right: - # - script: - # path: ~/.config/yambar/scripts/void-updates.sh - # args: [] - # content: - # string: - # margin: 0 - # text: "{updates}" - # font: *nerdfont - # foreground: 98971aff - # on-click: sh -c "~/.config/yambar/scripts/void-updates.sh update" + - script: + path: ~/.config/yambar/scripts/chimera-updates.sh + args: [] + content: + string: + margin: 0 + text: "{updates}" + font: *nerdfont + foreground: 98971aff + on-click: sh -c "~/.config/yambar/scripts/chimera-updates.sh update" - script: path: ~/.config/yambar/scripts/idleinhibit.sh args: [] diff --git a/.config/yambar/scripts/chimera-updates.sh b/.config/yambar/scripts/chimera-updates.sh new file mode 100755 index 0000000..2a948ae --- /dev/null +++ b/.config/yambar/scripts/chimera-updates.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +function update-yambar { +echo "updates|string|" +echo "" + +while true; do + +doas apk update +updates="$(apk -u list | awk '{ print $1 }')" +number="$(apk -u list | wc -l | awk '{$1=$1};1')" + +if [ "$number" -gt 0 ]; then + text=" $number" +else + text="" +fi + +echo "updates|string|$text" +echo "" +sleep 30m + +done +} + +function update { + foot bash -c "doas apk upgrade"; sh -c "~/.config/yambar/scripts/yambar-start.sh" +} + +case $1 in + update) + update + ;; + *) + update-yambar + ;; +esac +exit 0 diff --git a/.config/yambar/scripts/void-updates.sh b/.config/yambar/scripts/void-updates.sh deleted file mode 100755 index 98b3e0b..0000000 --- a/.config/yambar/scripts/void-updates.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -function update-yambar { -echo "updates|string|" -echo "" - -while true; do - -xbps-install -Mun 1> /tmp/void-updates -updates="$(cat /tmp/void-updates | awk '{ print $1 }')" -number="$(cat /tmp/void-updates | wc -l)" - -if [ "$number" -gt 0 ]; then - text=" $number" -else - text="" -fi - -echo "updates|string|$text" -echo "" -sleep 30m - -done -} - -function update { - foot bash -c "sudo xbps-install -Suv"; sh -c "~/.config/yambar/scripts/yambar-start.sh" -} - -case $1 in - update) - update - ;; - *) - update-yambar - ;; -esac -exit 0 -- cgit v1.2.3