This commit is contained in:
Liam Waldron 2022-11-27 15:21:45 -05:00
parent 27db74632d
commit 3599dc7f76
2 changed files with 27 additions and 12 deletions

View File

@ -17,6 +17,17 @@
#. /etc/emk.conf #. /etc/emk.conf
am_i_root() {
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "emk ${yellow}WARN${reset} | not running emk as root\n"
printf "emk ${yellow}WARN${reset} | THIS MAY PRODUCE UNEXPECTED RESULTS\n"
printf "emk ${yellow}WARN${reset} | however, this is NOT an error\n"
printf "emk ${yellow}WARN${reset} | and should not be treated as such.\n"
else
printf "emk ${blue}INFO${reset} | running emk as root\n"
fi
}
case $1 in case $1 in
-h|--help) -h|--help)
printf "emk - simple and concise build system\n" printf "emk - simple and concise build system\n"
@ -40,16 +51,11 @@ case $1 in
printf "emk ${red}ERR${reset} | failed to get help from emkfile.\n" printf "emk ${red}ERR${reset} | failed to get help from emkfile.\n"
exit 1 exit 1
fi fi
esac ;;
*)
# Check for root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
printf "emk ${yellow}WARN${reset} | not running emk as root\n"
printf "emk ${yellow}WARN${reset} | THIS MAY PRODUCE UNEXPECTED RESULTS\n"
printf "emk ${yellow}WARN${reset} | however, this is NOT an error\n"
printf "emk ${yellow}WARN${reset} | and should not be treated as such.\n"
else
printf "emk ${blue}INFO${reset} | running emk as root\n"
fi
./emkfile $2 ./emkfile $2
if [ "$?" != "0" ]; then
printf "emk ${red}ERR${reset} | subproccess finished with non-zero status.\n"
exit 1
fi
esac

9
src/emk/emk.conf Executable file
View File

@ -0,0 +1,9 @@
# /etc/emk.conf
# Colors
export red="\033[1;31m"
export green="\033[1;32m"
export blue="\033[1;34m"
export reset="\033[m"
# end /etc/emk.conf