Compare commits

..

2 Commits

Author SHA1 Message Date
ray fa471fdf9f add test for root user 2020-02-17 14:41:15 +00:00
ray dc3c53d7c8 improve error message 2020-02-17 14:34:22 +00:00
2 changed files with 8 additions and 1 deletions

View File

@ -8,7 +8,8 @@ _show_help=0
if ! [ -f "$_target_file" ] ; if ! [ -f "$_target_file" ] ;
then then
echo "Error - file not found: $_target_file" echo "notify-updates: cannot access '$_target_file': File not found"
echo "notify-updates: try executing 'pacman-update-count.sh'"
exit 1 exit 1
fi fi

View File

@ -3,6 +3,12 @@
_updates_available="0" _updates_available="0"
_target_file="/tmp/pacman-update-count" _target_file="/tmp/pacman-update-count"
_user="ray" _user="ray"
_user_id=$(id -u)
if ! [ "$_user_id" -eq 0 ] ; then
echo "pacman-update-count.sh: insufficient priviliges: must be run as root"
exit 1
fi
pacman -Sy pacman -Sy
_query_output=$(pacman -Qu) _query_output=$(pacman -Qu)