#!/bin/sh -e

##########################################################################
#   Script description:
#       Verify that we're running as root.
#       
#   History:
#   Date        Name        Modification
#   2019-07-16  Jason Bacon Begin
##########################################################################

usage()
{
    printf "Usage: $0 calling-script-name ['reason']\n"
    exit 1
}


##########################################################################
#   Main
##########################################################################

if [ $# != 1 ] && [ $# != 2 ]; then
    usage
fi

if [ $(id -un) != root ]; then
    printf "$1 requires root privileges.\n"
    if [ $# = 2 ]; then
	printf "$2\n"
    fi
    exit 1
fi
