check that script is sourced and not run

This commit is contained in:
James Barnett 2016-04-26 11:03:47 -05:00
parent 8a0c325ee2
commit 2fb18c78f0

View file

@ -24,7 +24,12 @@
set -e set -e
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "snap-pac must be run as root." echo "snap-pac must be sourced as root."
exit
fi
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "This script is intended to be sourced from a pacman hook and not run on its own."
exit exit
fi fi