add test for root user

This commit is contained in:
ray 2020-02-17 14:41:15 +00:00
parent dc3c53d7c8
commit fa471fdf9f
1 changed files with 6 additions and 0 deletions

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)