#!/bin/sh

# This is just a wrapper script to upgrade system AND update status bar module

# Don't try to sync if pacman is already running
if pidof pacman; then
  echo "pacman is already running"
  exit
fi

touch ~/.cache/pacupdatelive
killall -41 waybar

if [ "$1" = "-a" ]; then
	yay -Syu
else
	sudo pacman -Syu
fi


rm -f ~/.cache/pacupdatelive
killall -41 waybar