diff options
-rwxr-xr-x | mbuto | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -1159,7 +1159,14 @@ usage() { ################################################################################ -ARGS=${@} +# If we're not running as root, re-run with fakeroot +if [ "${LD_PRELOAD}" != "libfakeroot-sysv.so" ] && [ "$(id -u)" -ne 0 ]; then + if ! FAKEROOT="$(command -v fakeroot)"; then + err "Not root and no fakeroot available, exiting" + fi + PATH="${PATH}:/sbin:/usr/sbin" "${FAKEROOT}" "${0}" "${@}" + exit ${?} +fi # Parse options while getopts :c:df:k:m:p:s:vh __opt; do @@ -1182,15 +1189,6 @@ done shift $((OPTIND - 1)) [ -z "${PROFILE}" ] && PROFILE="base" -# If we're not running as root, re-run with fakeroot -if [ "${LD_PRELOAD}" != "libfakeroot-sysv.so" ] && [ "$(id -u)" -ne 0 ]; then - if ! FAKEROOT="$(command -v fakeroot)"; then - err "Not root and no fakeroot available, exiting" - fi - PATH="${PATH}:/sbin:/usr/sbin" "${FAKEROOT}" "${0}" ${ARGS} - exit ${?} -fi - # Check needed tools, exit if any is missing for __l in ${TOOLS}; do cmd_check "${__l}" |