diff --git a/upcheck b/upcheck new file mode 100755 index 0000000..323a4c0 --- /dev/null +++ b/upcheck @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +if ! command -v checkupdates > /dev/null || ! command -v notify-send > /dev/null ; then + echo "Error: You need to install the pacman-contrib and libnotify packages." + exit +fi + +available_updates="$(checkupdates)" + +if [[ -n $available_updates ]]; then + notify-send "The following updates are available:" --icon=dialog-information + notify-send "$available_updates" +fi diff --git a/upcheck.service b/upcheck.service new file mode 100644 index 0000000..7714e26 --- /dev/null +++ b/upcheck.service @@ -0,0 +1,12 @@ +[Unit] + Description=Automatically check updates and send notifications via libnotify + After=network-online.target + +[Service] + Type=simple + ExecStart=/home/sechacklabs/.local/bin/upcheck + KillMode=process + KillSignal=SIGINT + +[Install] + WantedBy=multi-user.target diff --git a/upcheck.timer b/upcheck.timer new file mode 100644 index 0000000..3b62257 --- /dev/null +++ b/upcheck.timer @@ -0,0 +1,10 @@ +[Unit] + Description=Check for ArchLinux available updates every 1.5 hours. + +[Timer] + OnBootSec=10min + OnUnitActiveSec=1h 30min + Unit=upcheck.service + +[Install] + WantedBy=timers.target