#!/bin/bash

if [ -f /usr/bin/rsstail ];then

  feed="https://github.com/voidlinux/void-packages/commits/master.atom"
  updatedpkgs="$(rsstail -1 -u ${feed} | grep -e "Update" -e "update" | wc -l)"
  newpkgs="$(rsstail -1 -u ${feed} | grep -e "New" -e "new" | wc -l)"
  sysupdates="$(xbps-install -Snu | wc -l)"


  notify-send """REPO COMMITS:
    Updated Packages: ${updatedpkgs}
    New Packages: ${newpkgs}

  SYSTEM UPDATES:
    Currently Available: ${sysupdates}"""

  echo """REPO COMMITS:
    Updated Packages: ${updatedpkgs}
    New Packages: ${newpkgs}

  SYSTEM UPDATES:
    Currently Available: ${sysupdates}"""
elif [ ! -f /usr/bin/rsstail ];then
  echo "[ERROR] This script requires the package: 'rsstail'"
  exit 0;
else
  echo "Something went wrong when checking for: /usr/bin/rsstail"
  exit 0;
fi
