set PRIVILEGED in both cases, because now this variable is set before ". ${INCLUDEDIR}/consts" and needs not to be set in that file in order to not be reset to a default value.
Also fix typo:
PENTESTINGMODE is set when NO root privileges are used
Quote both "${WORKDIR}/include" and "${WORKDIR}/db" directory existence check in if-statements to avoid "Fatal error: can't find directory" in case of a space-character in the ${WORKDIR} path.