Requiring sudo for help script, it will change to other users as needed.

This commit is contained in:
Roland 2023-10-09 13:25:13 -06:00
parent dc70b40db9
commit b020fbfeee
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93

View file

@ -5,7 +5,11 @@ MEDIA_DIRECTORY=/media/wrolpi
# Source environment file after declaring globals.
[ -f /opt/wrolpi/.env ] && source /opt/wrolpi/.env
echo "This script is running as $(whoami)"
# Re-execute this script if it wasn't called with sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
function check_directory() {
directory=$1