From cbfd974f652a12c601a95ea6d364549f45cb87e3 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Mon, 6 Apr 2020 02:30:09 +0300 Subject: improved script for pacman package download cron job; waybar improvements --- dotfiles/.local/bin/pacsync | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 dotfiles/.local/bin/pacsync (limited to 'dotfiles/.local/bin/pacsync') diff --git a/dotfiles/.local/bin/pacsync b/dotfiles/.local/bin/pacsync new file mode 100755 index 0000000..30fc98c --- /dev/null +++ b/dotfiles/.local/bin/pacsync @@ -0,0 +1,27 @@ +#!/bin/sh + +if pidof pacman; then + exit +fi + +ping -q -c 1 1.1.1.1 > /dev/null || exit + +# Source the needed env variables so that it can function properly from cron +. ~/.cache/sessionenv + +notify-send " System upgrade" "Syncing repositories and downloading packages..." + +touch ~/.cache/pacsynclive +killall -41 waybar + +sudo pacman -Syuw --noconfirm || notify-send " System upgrade" \ + "Error downloading updates. Check your internet connection or that you have the required permissions" + +rm -f ~/.cache/pacsynclive +killall -41 waybar + +upno=$(pacman -Qu | wc -l) + +if [ $upno -lt 0 ]; then + notify-send " System upgrade" "Repository sync finished. $upno updates are available" +fi -- cgit v1.2.3