Compare commits

...
22 Commits
Author SHA1 Message Date
Daniele Fucini 44dc555c18 Improve efficiency
Call checkupdates only once
2026-09-27 14:42:36 +02:00
Daniele Fucini 5c0995a23f Add reminder to check firmware updates 2025-12-19 10:30:22 +01:00
Daniele Fucini f9ee58b098 Update unit timer 2025-12-19 10:28:05 +01:00
Daniele Fucini 633c48431b Update url in PKGBUILD 2025-08-01 12:44:10 +02:00
Daniele Fucini aee4e886fd Update PKGBUILD 2025-06-10 21:08:20 +02:00
Daniele Fucini 2aee0b62bc Handle standard vs lts kernel update 2025-06-10 21:05:15 +02:00
Daniele Fucini 5894d7b889 Update PKGBUILD 2025-01-10 17:12:31 +01:00
Daniele Fucini 2449ee109e Fix kernel update detection 2025-01-10 17:09:52 +01:00
Daniele Fucini bb9012599c Add notifications about git packages 2025-01-09 16:03:54 +01:00
Daniele Fucini 77a83f1642 Update PKGBUILD 2024-11-25 17:26:06 +01:00
Daniele Fucini ba79773baa Revert "Remove (comment) kernel update detection"
This reverts commit 96eb881a28.
2024-11-25 17:21:13 +01:00
Daniele Fucini 96eb881a28 Remove (comment) kernel update detection 2024-11-24 12:12:16 +01:00
Daniele Fucini 38af0f8b6b Update sha256sum in PKGBUILD 2024-11-13 19:34:27 +01:00
Daniele Fucini 19102b3dbc Update PKGBUILD and make release 2024-11-13 19:32:57 +01:00
Daniele Fucini c208d4149b Fix kernel rebuild detection 2024-10-24 09:18:34 +02:00
Daniele Fucini 0039e8e6aa Check if new kernel has been built 2024-07-26 20:18:07 +02:00
Daniele Fucini 978fe39f79 Fix kernel update detection again 2024-07-14 18:39:42 +02:00
Daniele Fucini 4dc94c48ed Fix kernel update detection 2024-07-13 11:17:53 +02:00
Daniele Fucini dd90a176a6 Notify for kernel updates 2024-07-12 16:35:41 +02:00
Daniele Fucini 6ba9f65bd9 Specify explicitly aur-local repo 2024-04-12 10:05:58 +02:00
Daniele Fucini 3c176706d3 Add systemd timer 2024-03-23 11:42:22 +01:00
Daniele Fucini 5302d9d5ca Update PGKBUILD 2024-03-23 11:33:56 +01:00
4 changed files with 93 additions and 31 deletions
+14 -22
View File
@@ -2,33 +2,25 @@
# Maintainer: Daniele Fucini <dfucini [at] gmail [dot] com> # Maintainer: Daniele Fucini <dfucini [at] gmail [dot] com>
pkgname=update-notify-git pkgname=update-notify
_pkgname=update-notify pkgver=2.0
pkgdesc='Notify when updates are available'
pkgver=0.0.1
pkgrel=1 pkgrel=1
url="https://github.com/Fuxino/${_pkgname}" pkgdesc='Notify when updates are available'
arch=('any') arch=('any')
license=('GPL3') url="https://git.shouldnt.work/fuxino/${pkgname}"
license=('GPL-3.0-or-later')
depends=('pacman-contrib'
'aurutils')
makedepends=('git') makedepends=('git')
depends=('rsync') optdepends=('git-monitor: to check git repos for updates')
source=(git+${url}.git?signed#branch=master) source=(git+${url}?signed#tag=${pkgver})
validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514') validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514')
sha256sums=('SKIP') sha256sums=('907b2f1ad229096dc520a65e8e4319dba575a759d2e23248aff810e01d0c4a02')
pkgver()
{
cd ${_pkgname}
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare()
{
git -C ${srcdir}/${_pkgname} clean -dfx
}
package() package()
{ {
cd ${srcdir}/${_pkgname} cd ${srcdir}/${pkgname}
install -Dm755 ${_pkgname} ${pkgdir}/usr/bin/${_pkgname} install -Dm755 ${pkgname} ${pkgdir}/usr/bin/${pkgname}
install -Dm644 ${pkgname}.service ${pkgdir}/usr/lib/systemd/user/${pkgname}.service
install -Dm644 ${pkgname}.timer ${pkgdir}/usr/lib/systemd/user/${pkgname}.timer
} }
+62 -9
View File
@@ -1,16 +1,69 @@
#!/bin/bash #!/bin/bash
if [ "$#" -eq 1 ]; then # Default threshold or user argument
threshold=$1 threshold=${1:-30}
else
threshold=30 # Fetch checkupdates once to prevent multiple network/disk calls
mapfile -t arch_list < <(checkupdates 2>/dev/null)
arch_updates=${#arch_list[@]}
# Count AUR updates safely
aur_updates=$(aur repo -u -d aur-local 2>/dev/null | wc -l)
updates=$((arch_updates + aur_updates))
# Check kernel running environment
running_kernel=$(uname -r)
is_lts=0; [[ $running_kernel == *lts* ]] && is_lts=1
# Convert the array to a single string for quick regex matching
arch_str="${arch_list[*]}"
# Check for custom package updates in the list
has_custom=0; [[ $arch_str == *linux-custom* ]] && has_custom=1
has_custom_lts=0; [[ $arch_str == *linux-lts-custom* ]] && has_custom_lts=1
# Define localized logic for kernel checking
check_kernel_update() {
local pkg=$1
local item
# Precise array element matching (avoids false-positive substring matches)
for item in "${arch_list[@]}"; do
if [[ "$item" == "$pkg "* ]]; then
return 0 # Package found in the updates array, update is definitely available
fi
done
# Fallback to vercmp if running kernel doesn't match the sync repo
local repo_ver
repo_ver=$(pacman -Si "$pkg" 2>/dev/null | awk -F': ' '/Version/ {print $2}')
# Crucial Fix: vercmp returns > 0 ONLY if repo_ver is strictly newer than running_kernel
if [[ -n $repo_ver ]] && (( $(vercmp "$repo_ver" "$running_kernel") > 0 )); then
return 0
fi
return 1
}
# Evaluate Kernel notifications based on environment
if (( is_lts == 0 && has_custom == 0 )); then
check_kernel_update "linux" && notify-send "Kernel update available" "Rebuild custom kernel"
elif (( is_lts == 1 && has_custom_lts == 0 )); then
check_kernel_update "linux-lts" && notify-send "LTS Kernel update available" "Rebuild custom kernel"
fi fi
arch_updates=$(checkupdates | wc -l)
aur_updates=$(aur repo -u | wc -l)
updates=$(($arch_updates + $aur_updates)) # Main updates notification threshold logic
if (( updates >= threshold )); then
if [ "$updates" -ge "$threshold" ]; then
notify-send "Updates available" "Arch: $arch_updates, AUR: $aur_updates" notify-send "Updates available" "Arch: $arch_updates, AUR: $aur_updates"
# Directly check command availability inline (no function needed)
if command -v git-monitor >/dev/null 2>&1; then
notify-send "Check git packages" "Use git-monitor for git packages updates"
fi fi
if command -v fwupdmgr >/dev/null 2>&1; then
notify-send "Check firmware" "Use fwupdmgr to check for firmware updates"
fi
fi
+7
View File
@@ -0,0 +1,7 @@
[Unit]
Description=Notify if updates are available
[Service]
ExecStart=/usr/bin/update-notify 30
Type=simple
Restart=no
+10
View File
@@ -0,0 +1,10 @@
[Unit]
Description=Run update-notify every 6 hours
[Timer]
OnBootSec=5min
OnUnitActiveSec=12h
Persistent=true
[Install]
WantedBy=timers.target