rawiriblundell / sh_libpath

Making shell scripts more robust with libraries
Apache License 2.0
11 stars 2 forks source link

Add root privileges check to requires() #2

Closed rawiriblundell closed 2 years ago

rawiriblundell commented 2 years ago

This could technically be covered already e.g. requires "${EUID:-$(id -u)}"=0 or requires "${USER}"=root, but it would be good to have a shortcut argument for this. I'm not sure about how to syntactically lay that out yet, or maybe split this out to a separate function (a generic assert() perhaps?)

requires root_priv and/or requires root_privilege might be the simplest thing to do here...