aboutsummaryrefslogtreecommitdiff
path: root/auto-void-packages/who-needs-update.sh
diff options
context:
space:
mode:
authorclyhtsuriva <aimeric@adjutor.xyz>2022-11-02 22:20:50 +0100
committerclyhtsuriva <aimeric@adjutor.xyz>2022-11-02 22:20:50 +0100
commit852a96b3cf69bb80773f926921c9d3f6b0101faf (patch)
tree05d6560368527f4a766511be02634eba74f708b3 /auto-void-packages/who-needs-update.sh
parent0685ff941978dab274ff24e095de5c6a9e1931bb (diff)
Adding scripts to semi-automate void-packages updates
Diffstat (limited to 'auto-void-packages/who-needs-update.sh')
-rwxr-xr-xauto-void-packages/who-needs-update.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/auto-void-packages/who-needs-update.sh b/auto-void-packages/who-needs-update.sh
new file mode 100755
index 0000000..162e174
--- /dev/null
+++ b/auto-void-packages/who-needs-update.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+
+# Clyhsuriva
+
+### Colours
+
+NORMAL=$(tput sgr0)
+
+printf_red(){
+RED=$(tput setaf 1)
+ printf "%s%s%s\n" "$RED" "$1" "$NORMAL"
+}
+
+printf_green(){
+GREEN=$(tput setaf 2)
+BOLD=$(tput bold)
+ printf "%s%s%s%s\n" "$GREEN" "$BOLD" "$1" "$NORMAL"
+}
+
+printf_magenta(){
+MAGENTA=$(tput setaf 5)
+ printf "%s[%s]%s" "$MAGENTA" "$1" "$NORMAL"
+}
+
+####
+
+NEEDS_UPDATE="needs_update.txt"
+[ -f "$NEEDS_UPDATE" ] && rm "$NEEDS_UPDATE"
+
+CONTRIBUTED_TO_FILE="contributed-to.txt"
+
+VOID_UPDATES_URL="https://a-hel-fi.m.voidlinux.org/void-updates/void-updates.txt"
+VOID_UPDATES=$(curl --silent "$VOID_UPDATES_URL")
+
+# for each package that needs an update put it in the file
+# for every package, print its name with an icon depending on its status
+# x for not needing an update
+# v for needing one
+while read -r PKG;
+do
+ printf_magenta "$PKG"
+ UPDATES=$(echo "$VOID_UPDATES" | grep -e "^$PKG ")
+ if [ -z "$UPDATES" ];
+ then
+ printf_red "✖"
+ else
+ printf_green "✔️"
+ echo "$UPDATES" >> "$NEEDS_UPDATE"
+ fi
+done <$CONTRIBUTED_TO_FILE
+
+# print the file containing the packages needding an update
+[ -f "$NEEDS_UPDATE" ] && bat $NEEDS_UPDATE