From 5c4abe3c744856812b37d91b8547400974c79fa2 Mon Sep 17 00:00:00 2001 From: Savely Krasovsky Date: Mon, 18 Dec 2023 14:04:14 +0100 Subject: [PATCH 01/16] fix: closes #14 --- waybar-updates | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waybar-updates b/waybar-updates index 754562b..9ab5d82 100755 --- a/waybar-updates +++ b/waybar-updates @@ -69,7 +69,7 @@ function check_aur_updates() { new_aur_packages=$(cat "$tmp_aur_packages_file") fi - aur_updates=$(join <(echo "$old_aur_packages") <(echo "$new_aur_packages") | + aur_updates=$(LC_ALL=C join <(echo "$old_aur_packages") <(echo "$new_aur_packages") | while read -r pkg a b; do case "$(vercmp "$a" "$b")" in -1) printf "%s %s -> %s\n" "$pkg" "$a" "$b" ;; From 439b3d188ff68d98a628caf8c593083d5042e942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Sun, 24 Dec 2023 14:47:34 +0100 Subject: [PATCH 02/16] check devel with last commit --- waybar-updates | 101 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 93 insertions(+), 8 deletions(-) diff --git a/waybar-updates b/waybar-updates index 9ab5d82..fb3d7b2 100755 --- a/waybar-updates +++ b/waybar-updates @@ -4,15 +4,17 @@ usage() { echo "Usage: waybar-updates [options] -i, --interval Interval between checks -c, --cycles Cycles between online checks (e.g. 6s * 600 cycles = 3600s = 1h between online checks) - -l, --packages-limit Maximum number of packages to be shown in notifications and tooltip" + -l, --packages-limit Maximum number of packages to be shown in notifications and tooltip + -d, --devel Enable devel checks" exit 2 } interval=6 cycles_number=600 packages_limit=10 +devel=false -PARSED_ARGUMENTS=$(getopt -o "hi:c:l:" --long "help,interval,cycles,packages-limit" --name "waybar-updates" -- "$@") +PARSED_ARGUMENTS=$(getopt -o "hi:c:l:d::" --long "help,interval,cycles,packages-limit,devel::" --name "waybar-updates" -- "$@") eval set -- "$PARSED_ARGUMENTS" while :; do case "$1" in @@ -28,6 +30,10 @@ while :; do packages_limit="$2" shift 2 ;; + -d | --devel) + devel=true + shift 2 + ;; -h | --help) usage ;; --) shift @@ -51,6 +57,53 @@ function check_pacman_updates() { pacman_updates_count=$(echo "$pacman_updates" | grep -vc ^$) } +function check_devel_updates() { + ignored_packages=$(pacman-conf IgnorePkg) + if [ "$1" == "online" ]; then + develsuffixes="git" + develpackages=$(pacman -Qm | grep -Ee "$develsuffixes") + rm -f "$tmp_devel_packages_file" + tmp_devel_packages_file=$(mktemp --suffix -waybar-updates) + build_devel_list "$tmp_devel_packages_file" "$develpackages" + if [ -n "$ignored_packages" ]; then + devel_updates=$(grep -vF "$ignored_packages" < "$tmp_devel_packages_file") + else + devel_updates=$(cat "$tmp_devel_packages_file") + fi + elif [ "$1" == "offline" ]; then + new_devel_packages=$(pacman -Qm | grep -Ee "$develsuffixes") + old_devel_packages=$(awk {'printf ("%s %s\n", $1, $2)'} "$tmp_devel_packages_file") + + develpackages=$(LC_ALL=C join <(echo "$old_devel_packages") <(echo "$new_devel_packages")) + + build_devel_list "$tmp_devel_packages_file" "$develpackages" + # build_devel_list "$tmp_devel_packages_file" + devel_updates=$(cat "$tmp_devel_packages_file") + fi + devel_updates_checksum=$(echo "$devel_updates" | sha256sum) + devel_updates_count=$(echo "$devel_updates" | grep -vc ^$) +} + +function build_devel_list() { + custom_pkgbuild_vars="_gitname=\|_githubuser=\|_githubrepo=\|_gitcommit=\|url=\|_pkgname=\|_gitdir=\|_repo_name=\|_gitpkgname=\|source_dir=" + + rm -f "$tmp_devel_packages_file" + + i=0 + while read -r pkgname version + do + (( i++ )) + eval $(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | grep "$custom_pkgbuild_vars") + eval source=$(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | grep -zPo '(?s)source=\(.*?\)' | awk '/git/{print "source="$1}' | sed 's/source=//g' | sed '/http/p' | sed 's/(//;s/)//g' | tr -d '\0' | head -1) + source=$(sed 's/^\(.*\)\(http.*$\)/\2/;s/\"//;s/'\''//' <<< "$source") + source=$(cut -f1 -d"#" <<< "$source") + lastcommit=$(git ls-remote --heads "$source" | awk '{ print $1}' | cut -c1-7) + if ! echo "$version" | grep -q "$lastcommit"; then + echo "$pkgname $version -> latest-commit" >> "$1" + fi + done <<< "$2" +} + function check_aur_updates() { ignored_packages=$(pacman-conf IgnorePkg) if [ -n "$ignored_packages" ]; then @@ -70,7 +123,7 @@ function check_aur_updates() { fi aur_updates=$(LC_ALL=C join <(echo "$old_aur_packages") <(echo "$new_aur_packages") | - while read -r pkg a b; do + while LC_ALL=C read -r pkg a b; do case "$(vercmp "$a" "$b")" in -1) printf "%s %s -> %s\n" "$pkg" "$a" "$b" ;; esac @@ -84,12 +137,17 @@ function check_updates() { if [ "$1" == "online" ]; then check_pacman_updates online check_aur_updates online + if [ $devel == true ];then check_devel_updates online; fi elif [ "$1" == "offline" ]; then check_pacman_updates offline check_aur_updates offline + if [ $devel == true ];then check_devel_updates offline; fi + fi + if [ $devel == true ];then + total_updates_count=$((pacman_updates_count + aur_updates_count + devel_updates_count)) + else + total_updates_count=$((pacman_updates_count + aur_updates_count)) fi - - total_updates_count=$((pacman_updates_count + aur_updates_count)) } function json() { @@ -104,6 +162,7 @@ function json() { function cleanup() { echo "Cleaning up..." rm -f "$tmp_aur_packages_file" + rm -f "$tmp_devel_packages_file" exit 0 } @@ -111,6 +170,7 @@ function cleanup() { check_updates online pacman_updates_checksum="" aur_updates_checksum="" +devel_updates_checksum="" # count cycles to check updates using network sometime cycle=0 @@ -120,6 +180,7 @@ trap cleanup SIGINT SIGTERM while true; do previous_pacman_updates_checksum=$pacman_updates_checksum previous_aur_updates_checksum=$aur_updates_checksum + if [ $devel == true ];then previous_devel_updates_checksum=$devel_updates_checksum; fi if [ "$cycle" -ge "$cycles_number" ]; then check_updates online @@ -128,9 +189,19 @@ while true; do check_updates offline cycle=$((cycle + 1)) fi - - if [ "$previous_pacman_updates_checksum" == "$pacman_updates_checksum" ] && - [ "$previous_aur_updates_checksum" == "$aur_updates_checksum" ]; then + if [ $devel == true ];then + condition (){ + { [ "$previous_pacman_updates_checksum" == "$pacman_updates_checksum" ] && + [ "$previous_aur_updates_checksum" == "$aur_updates_checksum" ] && + [ "$previous_devel_updates_checksum" == "$devel_updates_checksum" ] ;} + } + else + condition (){ + { [ "$previous_pacman_updates_checksum" == "$pacman_updates_checksum" ] && + [ "$previous_aur_updates_checksum" == "$aur_updates_checksum" ] ;} + } + fi + if condition; then sleep "$interval" continue fi @@ -160,7 +231,21 @@ while true; do tooltip+="\n$aur_updates" fi fi + if [ $devel == true ];then + if [ "$devel_updates_count" -gt 0 ]; then + template=$(ngettext "waybar-updates" "%d update available from Devel" "%d updates available from Devel" "$devel_updates_count") + # shellcheck disable=SC2059 + notify-send -u normal -i software-update-available-symbolic \ + "$(printf "$template" "$devel_updates_count")" \ + "$(echo "$devel_updates" | head -n "$packages_limit")" + if [ -z "$tooltip" ]; then + tooltip+="$devel_updates" + else + tooltip+="\n$devel_updates" + fi + fi + fi if [ "$total_updates_count" -gt 0 ]; then json $total_updates_count "pending-updates" "$(echo -e "$tooltip" | head -n "$packages_limit")" "pending-updates" else From 41e971671e40bb64a71bfd93c965675655ffa6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Sun, 24 Dec 2023 15:06:44 +0100 Subject: [PATCH 03/16] Add translations --- po/fr.po | 5 +++++ po/ru.po | 6 ++++++ po/tr_TR.po | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/po/fr.po b/po/fr.po index f33784e..1b30e8e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -12,6 +12,11 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.2.2\n" +msgid "%d update available from Devel" +msgid_plural "%d updates available from Devel" +msgstr[0] "%d mise à jour disponible via Devel" +msgstr[1] "%d mises à jour disponibles via Devel" + msgid "%d update available from AUR" msgid_plural "%d updates available from AUR" msgstr[0] "%d mise à jour disponible via AUR" diff --git a/po/ru.po b/po/ru.po index 5cc356a..d5f7295 100644 --- a/po/ru.po +++ b/po/ru.po @@ -12,6 +12,12 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" "X-Generator: Poedit 3.2.2\n" +msgid "%d update available from Devel" +msgid_plural "%d updates available from Devel" +msgstr[0] "%d обновление доступно из Devel" +msgstr[1] "%d обновления доступно из Devel" +msgstr[2] "%d обновлений доступно из Devel" + msgid "%d update available from AUR" msgid_plural "%d updates available from AUR" msgstr[0] "%d обновление доступно из AUR" diff --git a/po/tr_TR.po b/po/tr_TR.po index 65c6f83..cc04b6a 100644 --- a/po/tr_TR.po +++ b/po/tr_TR.po @@ -12,6 +12,11 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 3.3.1\n" +msgid "%d update available from Devel" +msgid_plural "%d updates available from Devel" +msgstr[0] "Devel'dan %d güncelleme mevcut" +msgstr[1] "Devel'dan %d güncelleme mevcut" + # In Turkish, the plural suffix is not used if the number of the mentioned entity is specified. That's why singular and plural translations are the same. msgid "%d update available from AUR" msgid_plural "%d updates available from AUR" From a207f3aae33aa3f7f5612b6a8c4dbd19722263a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Mon, 25 Dec 2023 04:13:25 +0100 Subject: [PATCH 04/16] empty temp file instead of delete --- waybar-updates | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/waybar-updates b/waybar-updates index fb3d7b2..98f005d 100755 --- a/waybar-updates +++ b/waybar-updates @@ -76,8 +76,10 @@ function check_devel_updates() { develpackages=$(LC_ALL=C join <(echo "$old_devel_packages") <(echo "$new_devel_packages")) - build_devel_list "$tmp_devel_packages_file" "$develpackages" - # build_devel_list "$tmp_devel_packages_file" + if [[ $(echo "$develpackages" | grep -vc ^$) -ne 0 ]]; then + develpackages=$(awk {'printf ("%s %s\n", $1, $3)'} <<< "$develpackages") + build_devel_list "$tmp_devel_packages_file" "$develpackages" + fi devel_updates=$(cat "$tmp_devel_packages_file") fi devel_updates_checksum=$(echo "$devel_updates" | sha256sum) @@ -87,7 +89,7 @@ function check_devel_updates() { function build_devel_list() { custom_pkgbuild_vars="_gitname=\|_githubuser=\|_githubrepo=\|_gitcommit=\|url=\|_pkgname=\|_gitdir=\|_repo_name=\|_gitpkgname=\|source_dir=" - rm -f "$tmp_devel_packages_file" + echo > "$tmp_devel_packages_file" i=0 while read -r pkgname version From fc9872eb2a40224a6bba9f90b150199f23464c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Tue, 26 Dec 2023 01:33:01 +0100 Subject: [PATCH 05/16] keep source for git online to use offline --- waybar-updates | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/waybar-updates b/waybar-updates index 98f005d..3fdc4c8 100755 --- a/waybar-updates +++ b/waybar-updates @@ -62,26 +62,25 @@ function check_devel_updates() { if [ "$1" == "online" ]; then develsuffixes="git" develpackages=$(pacman -Qm | grep -Ee "$develsuffixes") - rm -f "$tmp_devel_packages_file" - tmp_devel_packages_file=$(mktemp --suffix -waybar-updates) - build_devel_list "$tmp_devel_packages_file" "$develpackages" if [ -n "$ignored_packages" ]; then - devel_updates=$(grep -vF "$ignored_packages" < "$tmp_devel_packages_file") - else - devel_updates=$(cat "$tmp_devel_packages_file") + develpackages=$(grep -vF "$ignored_packages" <<< "$develpackages") fi + rm -f "$tmp_devel_packages_file" + tmp_devel_packages_file=$(mktemp --suffix -waybar-updates) + build_devel_list "$develpackages" "online" elif [ "$1" == "offline" ]; then new_devel_packages=$(pacman -Qm | grep -Ee "$develsuffixes") - old_devel_packages=$(awk {'printf ("%s %s\n", $1, $2)'} "$tmp_devel_packages_file") + old_devel_packages=$(awk {'printf ("%s %s\n", $1, $3)'} "$tmp_devel_packages_file") develpackages=$(LC_ALL=C join <(echo "$old_devel_packages") <(echo "$new_devel_packages")) + echo "d:$develpackages" if [[ $(echo "$develpackages" | grep -vc ^$) -ne 0 ]]; then - develpackages=$(awk {'printf ("%s %s\n", $1, $3)'} <<< "$develpackages") - build_devel_list "$tmp_devel_packages_file" "$develpackages" + develpackages=$(awk {'printf ("%s %s %s\n", $1, $3, $2)'} <<< "$develpackages") + build_devel_list "$develpackages" "offline" fi - devel_updates=$(cat "$tmp_devel_packages_file") fi + devel_updates=$(awk {'printf ("%s %s\n", $1, $2)'} "$tmp_devel_packages_file") devel_updates_checksum=$(echo "$devel_updates" | sha256sum) devel_updates_count=$(echo "$devel_updates" | grep -vc ^$) } @@ -89,21 +88,23 @@ function check_devel_updates() { function build_devel_list() { custom_pkgbuild_vars="_gitname=\|_githubuser=\|_githubrepo=\|_gitcommit=\|url=\|_pkgname=\|_gitdir=\|_repo_name=\|_gitpkgname=\|source_dir=" - echo > "$tmp_devel_packages_file" + truncate -s 0 "$tmp_devel_packages_file" i=0 - while read -r pkgname version + while read -r pkgname version source do (( i++ )) - eval $(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | grep "$custom_pkgbuild_vars") - eval source=$(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | grep -zPo '(?s)source=\(.*?\)' | awk '/git/{print "source="$1}' | sed 's/source=//g' | sed '/http/p' | sed 's/(//;s/)//g' | tr -d '\0' | head -1) - source=$(sed 's/^\(.*\)\(http.*$\)/\2/;s/\"//;s/'\''//' <<< "$source") - source=$(cut -f1 -d"#" <<< "$source") + if [ -z "$source" ]; then + eval $(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | grep "$custom_pkgbuild_vars") + eval source=$(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | grep -zPo '(?s)source=\(.*?\)' | awk '/git/{print "source="$1}' | sed 's/source=//g' | sed '/http/p' | sed 's/(//;s/)//g' | tr -d '\0' | head -1) + source=$(sed 's/^\(.*\)\(http.*$\)/\2/;s/\"//;s/'\''//' <<< "$source") + source=$(cut -f1 -d"#" <<< "$source") + fi lastcommit=$(git ls-remote --heads "$source" | awk '{ print $1}' | cut -c1-7) if ! echo "$version" | grep -q "$lastcommit"; then - echo "$pkgname $version -> latest-commit" >> "$1" + echo "$pkgname $version $source ${lastcommit//$'\n'/ }" >> "$tmp_devel_packages_file" fi - done <<< "$2" + done <<< "$1" } function check_aur_updates() { From 8d9ecb16dd32c5d705b2c6bcf462875d8140d4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Tue, 26 Dec 2023 01:56:14 +0100 Subject: [PATCH 06/16] Add -app-name for notify-send --- waybar-updates | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/waybar-updates b/waybar-updates index 3fdc4c8..7ab0143 100755 --- a/waybar-updates +++ b/waybar-updates @@ -215,7 +215,7 @@ while true; do if [ "$pacman_updates_count" -gt 0 ]; then template=$(ngettext "waybar-updates" "%d update available from pacman" "%d updates available from pacman" "$pacman_updates_count") # shellcheck disable=SC2059 - notify-send -u normal -i software-update-available-symbolic \ + notify-send -a waybar-updates -u normal -i software-update-available-symbolic \ "$(printf "$template" "$pacman_updates_count")" \ "$(echo "$pacman_updates" | head -n "$packages_limit")" @@ -224,7 +224,7 @@ while true; do if [ "$aur_updates_count" -gt 0 ]; then template=$(ngettext "waybar-updates" "%d update available from AUR" "%d updates available from AUR" "$aur_updates_count") # shellcheck disable=SC2059 - notify-send -u normal -i software-update-available-symbolic \ + notify-send -a waybar-updates -u normal -i software-update-available-symbolic \ "$(printf "$template" "$aur_updates_count")" \ "$(echo "$aur_updates" | head -n "$packages_limit")" @@ -238,7 +238,7 @@ while true; do if [ "$devel_updates_count" -gt 0 ]; then template=$(ngettext "waybar-updates" "%d update available from Devel" "%d updates available from Devel" "$devel_updates_count") # shellcheck disable=SC2059 - notify-send -u normal -i software-update-available-symbolic \ + notify-send -a waybar-updates -u normal -i software-update-available-symbolic \ "$(printf "$template" "$devel_updates_count")" \ "$(echo "$devel_updates" | head -n "$packages_limit")" From ef222f9ab29f343b100255ce6e1e7933db106bfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Tue, 26 Dec 2023 16:42:18 +0100 Subject: [PATCH 07/16] Add _name in custom PKGBUILD vars --- waybar-updates | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waybar-updates b/waybar-updates index 7ab0143..61231d4 100755 --- a/waybar-updates +++ b/waybar-updates @@ -86,7 +86,7 @@ function check_devel_updates() { } function build_devel_list() { - custom_pkgbuild_vars="_gitname=\|_githubuser=\|_githubrepo=\|_gitcommit=\|url=\|_pkgname=\|_gitdir=\|_repo_name=\|_gitpkgname=\|source_dir=" + custom_pkgbuild_vars="_gitname=\|_githubuser=\|_githubrepo=\|_gitcommit=\|url=\|_pkgname=\|_gitdir=\|_repo_name=\|_gitpkgname=\|source_dir=\|_name=" truncate -s 0 "$tmp_devel_packages_file" From 0dd42d3cde4e358edb318c723eb00029b5a617ab Mon Sep 17 00:00:00 2001 From: Savely Krasovsky Date: Tue, 26 Dec 2023 18:21:38 +0100 Subject: [PATCH 08/16] feat: add shellcheck action --- .github/workflows/shellcheck.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..532f437 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,21 @@ +on: + push: + branches: + - master + pull_request: + branches: + - master + +name: "ShellCheck" +permissions: {} + +jobs: + shellcheck: + name: ShellCheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@2.0.0 + with: + additional_files: 'waybar-updates' From eec78723c0c302eaefb2504e975b968be5887a53 Mon Sep 17 00:00:00 2001 From: Savely Krasovsky Date: Tue, 26 Dec 2023 18:25:15 +0100 Subject: [PATCH 09/16] feat: add shellcheck badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 957594d..533a31d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # waybar-updates +[![ShellCheck](https://github.com/L11R/waybar-updates/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/L11R/waybar-updates/actions/workflows/shellcheck.yml) + Tiny Waybar module to check Arch Linux updates from official repositories and AUR. ## Features From a5d49b81d38c87d7e017289eec7ef1ff1db967cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Tue, 26 Dec 2023 18:55:57 +0100 Subject: [PATCH 10/16] fix shellckeck warnings --- waybar-updates | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/waybar-updates b/waybar-updates index 61231d4..01007bb 100755 --- a/waybar-updates +++ b/waybar-updates @@ -70,17 +70,17 @@ function check_devel_updates() { build_devel_list "$develpackages" "online" elif [ "$1" == "offline" ]; then new_devel_packages=$(pacman -Qm | grep -Ee "$develsuffixes") - old_devel_packages=$(awk {'printf ("%s %s\n", $1, $3)'} "$tmp_devel_packages_file") + old_devel_packages=$(awk '{printf ("%s %s\n", $1, $3)}' "$tmp_devel_packages_file") develpackages=$(LC_ALL=C join <(echo "$old_devel_packages") <(echo "$new_devel_packages")) echo "d:$develpackages" if [[ $(echo "$develpackages" | grep -vc ^$) -ne 0 ]]; then - develpackages=$(awk {'printf ("%s %s %s\n", $1, $3, $2)'} <<< "$develpackages") + develpackages=$(awk '{printf ("%s %s %s\n", $1, $3, $2)}' <<< "$develpackages") build_devel_list "$develpackages" "offline" fi fi - devel_updates=$(awk {'printf ("%s %s\n", $1, $2)'} "$tmp_devel_packages_file") + devel_updates=$(awk '{printf ("%s %s\n", $1, $2)}' "$tmp_devel_packages_file") devel_updates_checksum=$(echo "$devel_updates" | sha256sum) devel_updates_count=$(echo "$devel_updates" | grep -vc ^$) } @@ -95,8 +95,12 @@ function build_devel_list() { do (( i++ )) if [ -z "$source" ]; then - eval $(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | grep "$custom_pkgbuild_vars") - eval source=$(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | grep -zPo '(?s)source=\(.*?\)' | awk '/git/{print "source="$1}' | sed 's/source=//g' | sed '/http/p' | sed 's/(//;s/)//g' | tr -d '\0' | head -1) + eval "$(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | grep "$custom_pkgbuild_vars")" + eval source="$(curl -s "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$pkgname" | \ + grep -zPo '(?s)source=\(.*?\)' | \ + awk '/git/{print "source="$1}' | \ + sed 's/source=//g' | sed '/http/p' | \ + sed 's/(//;s/)//g' | tr -d '\0' | head -1)" source=$(sed 's/^\(.*\)\(http.*$\)/\2/;s/\"//;s/'\''//' <<< "$source") source=$(cut -f1 -d"#" <<< "$source") fi From c89dcc14d564a506bd5d2e8f89425ebdfbc501b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Tue, 26 Dec 2023 19:07:19 +0100 Subject: [PATCH 11/16] Devel is not a source, replace with AUR --- po/fr.po | 8 ++++---- po/ru.po | 10 +++++----- po/tr_TR.po | 8 ++++---- waybar-updates | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/po/fr.po b/po/fr.po index 1b30e8e..a9289ed 100644 --- a/po/fr.po +++ b/po/fr.po @@ -12,10 +12,10 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.2.2\n" -msgid "%d update available from Devel" -msgid_plural "%d updates available from Devel" -msgstr[0] "%d mise à jour disponible via Devel" -msgstr[1] "%d mises à jour disponibles via Devel" +msgid "%d devel-update available from AUR" +msgid_plural "%d devel-updates available from AUR" +msgstr[0] "%d mise à jour devel disponible via AUR" +msgstr[1] "%d mises à jour devel disponibles via AUR" msgid "%d update available from AUR" msgid_plural "%d updates available from AUR" diff --git a/po/ru.po b/po/ru.po index d5f7295..17eda05 100644 --- a/po/ru.po +++ b/po/ru.po @@ -12,11 +12,11 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" "X-Generator: Poedit 3.2.2\n" -msgid "%d update available from Devel" -msgid_plural "%d updates available from Devel" -msgstr[0] "%d обновление доступно из Devel" -msgstr[1] "%d обновления доступно из Devel" -msgstr[2] "%d обновлений доступно из Devel" +msgid "%d devel-update available from AUR" +msgid_plural "%d devel-updates available from AUR" +msgstr[0] "%d разработка - обновление доступно из AUR" +msgstr[1] "%d разработка - обновления доступно из AUR" +msgstr[2] "%d разработка - обновлений доступно из AUR" msgid "%d update available from AUR" msgid_plural "%d updates available from AUR" diff --git a/po/tr_TR.po b/po/tr_TR.po index cc04b6a..697f6a5 100644 --- a/po/tr_TR.po +++ b/po/tr_TR.po @@ -12,10 +12,10 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 3.3.1\n" -msgid "%d update available from Devel" -msgid_plural "%d updates available from Devel" -msgstr[0] "Devel'dan %d güncelleme mevcut" -msgstr[1] "Devel'dan %d güncelleme mevcut" +msgid "%d devel-update available from AUR" +msgid_plural "%d devel-updates available from AUR" +msgstr[0] "AUR'dan %d geliştirme-güncelleme mevcut" +msgstr[1] "AUR'dan %d geliştirme-güncelleme mevcut" # In Turkish, the plural suffix is not used if the number of the mentioned entity is specified. That's why singular and plural translations are the same. msgid "%d update available from AUR" diff --git a/waybar-updates b/waybar-updates index 01007bb..72add60 100755 --- a/waybar-updates +++ b/waybar-updates @@ -240,7 +240,7 @@ while true; do fi if [ $devel == true ];then if [ "$devel_updates_count" -gt 0 ]; then - template=$(ngettext "waybar-updates" "%d update available from Devel" "%d updates available from Devel" "$devel_updates_count") + template=$(ngettext "waybar-updates" "%d devel-update available from AUR" "%d devel-updates available from AUR" "$devel_updates_count") # shellcheck disable=SC2059 notify-send -a waybar-updates -u normal -i software-update-available-symbolic \ "$(printf "$template" "$devel_updates_count")" \ From 0d908c72000b1bc8810d6318dfc2e1e1ea59c7f7 Mon Sep 17 00:00:00 2001 From: Savely Krasovsky Date: Tue, 26 Dec 2023 20:54:43 +0100 Subject: [PATCH 12/16] fix: russian translation fixes --- po/ru.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/po/ru.po b/po/ru.po index 17eda05..7c4cd01 100644 --- a/po/ru.po +++ b/po/ru.po @@ -14,9 +14,9 @@ msgstr "" msgid "%d devel-update available from AUR" msgid_plural "%d devel-updates available from AUR" -msgstr[0] "%d разработка - обновление доступно из AUR" -msgstr[1] "%d разработка - обновления доступно из AUR" -msgstr[2] "%d разработка - обновлений доступно из AUR" +msgstr[0] "%d devel-обновление доступно из AUR" +msgstr[1] "%d devel-обновления доступно из AUR" +msgstr[2] "%d devel-обновлений доступно из AUR" msgid "%d update available from AUR" msgid_plural "%d updates available from AUR" From 5a523a141747361a476fc57696844579cff11e25 Mon Sep 17 00:00:00 2001 From: Savely Krasovsky Date: Tue, 26 Dec 2023 21:50:34 +0100 Subject: [PATCH 13/16] fix: turkish fixes Co-authored-by: ouztheone --- po/tr_TR.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/tr_TR.po b/po/tr_TR.po index 697f6a5..5bd4ee4 100644 --- a/po/tr_TR.po +++ b/po/tr_TR.po @@ -15,7 +15,7 @@ msgstr "" msgid "%d devel-update available from AUR" msgid_plural "%d devel-updates available from AUR" msgstr[0] "AUR'dan %d geliştirme-güncelleme mevcut" -msgstr[1] "AUR'dan %d geliştirme-güncelleme mevcut" +msgstr[1] "AUR'dan %d devel-güncellemesi mevcut" # In Turkish, the plural suffix is not used if the number of the mentioned entity is specified. That's why singular and plural translations are the same. msgid "%d update available from AUR" From 21c44a7430264844290b912b313b6d1bfa5027ee Mon Sep 17 00:00:00 2001 From: Savely Krasovsky Date: Tue, 26 Dec 2023 21:50:48 +0100 Subject: [PATCH 14/16] fix: turkish fixes Co-authored-by: ouztheone --- po/tr_TR.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/tr_TR.po b/po/tr_TR.po index 5bd4ee4..b3859d0 100644 --- a/po/tr_TR.po +++ b/po/tr_TR.po @@ -14,7 +14,7 @@ msgstr "" msgid "%d devel-update available from AUR" msgid_plural "%d devel-updates available from AUR" -msgstr[0] "AUR'dan %d geliştirme-güncelleme mevcut" +msgstr[0] "AUR'dan %d devel-güncellemesi mevcut" msgstr[1] "AUR'dan %d devel-güncellemesi mevcut" # In Turkish, the plural suffix is not used if the number of the mentioned entity is specified. That's why singular and plural translations are the same. From 3309b2735103a21862028e8de8f0b73774eee849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Tue, 26 Dec 2023 22:12:27 +0100 Subject: [PATCH 15/16] Update readme with devel-updates --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 533a31d..7c875c7 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Tiny Waybar module to check Arch Linux updates from official repositories and AU - Sends notifications about updates. - Supports GNU gettext localization (contribute new po-files!) - Checks updates from AUR using Aurweb RPC, so works independently. +- Can check for development packages upstream changes (see -d [options](#command-line-options)) - Shows updates in the tooltip. - Supports two states: `pending-updates` and `updated` to use different icons or hide module. - Uses infinite loop to supply Waybar JSON updates. @@ -25,6 +26,7 @@ Tiny Waybar module to check Arch Linux updates from official repositories and AU - curl - jq - libnotify +- git (if using --devel [option](#command-line-options)) ## Usage @@ -79,6 +81,7 @@ The following options are available: - `-i, --interval`: Interval between checks (default: 6 seconds) - `-c, --cycles`: Cycles between online checks (e.g. 6s * 600 cycles = 3600s = 1h between online checks) (default: 600 cycles) - `-l, --packages-limit`: Maximum number of packages to be shown in notifications and tooltip (default: 10) +- -d, --devel: Also check for development packages upstream changes (default:disabled) ## Localization From ee62caaccd19faec4a36b7f68874d7121428e694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Launay?= Date: Tue, 26 Dec 2023 22:15:55 +0100 Subject: [PATCH 16/16] Add missing code block --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c875c7..ca38449 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ The following options are available: - `-i, --interval`: Interval between checks (default: 6 seconds) - `-c, --cycles`: Cycles between online checks (e.g. 6s * 600 cycles = 3600s = 1h between online checks) (default: 600 cycles) - `-l, --packages-limit`: Maximum number of packages to be shown in notifications and tooltip (default: 10) -- -d, --devel: Also check for development packages upstream changes (default:disabled) +- `-d, --devel`: Also check for development packages upstream changes (default:disabled) ## Localization