From ed374973b7027c21fc5cdbf6b6626e59038bcc71 Mon Sep 17 00:00:00 2001 From: Daniele Fucini Date: Sat, 23 Mar 2024 11:24:42 +0100 Subject: [PATCH] Initial commit --- PKGBUILD | 34 ++++++++++++++++++++++++++++++++++ update-notify | 16 ++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 PKGBUILD create mode 100755 update-notify diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..7a23adc --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,34 @@ +# PKGBUILD + +# Maintainer: Daniele Fucini + +pkgname=update-notify-git +_pkgname=update-notify +pkgdesc='Notify when updates are available' +pkgver=0.0.1 +pkgrel=1 +url="https://github.com/Fuxino/${_pkgname}" +arch=('any') +license=('GPL3') +makedepends=('git') +depends=('rsync') +source=(git+${url}.git?signed#branch=master) +validpgpkeys=('7E12BC1FF3B6EDB2CD8053EB981A2B2A3BBF5514') +sha256sums=('SKIP') + +pkgver() +{ + cd ${_pkgname} + git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() +{ + git -C ${srcdir}/${_pkgname} clean -dfx +} + +package() +{ + cd ${srcdir}/${_pkgname} + install -Dm755 ${_pkgname} ${pkgdir}/usr/bin/${_pkgname} +} diff --git a/update-notify b/update-notify new file mode 100755 index 0000000..742d2c0 --- /dev/null +++ b/update-notify @@ -0,0 +1,16 @@ +#!/bin/bash + +if [ "$#" -eq 1 ]; then + threshold=$1 +else + threshold=30 +fi + +arch_updates=$(checkupdates | wc -l) +aur_updates=$(aur repo -u | wc -l) + +updates=$(($arch_updates + $aur_updates)) + +if [ "$updates" -ge "$threshold" ]; then + notify-send "Updates available" "Arch: $arch_updates, AUR: $aur_updates" +fi