is_root_owned

This commit is contained in:
2025-08-08 12:22:47 -05:00
parent da533a8a09
commit 0584974538
2 changed files with 26 additions and 0 deletions

View File

@@ -66,6 +66,21 @@ echo_if_fail() {
return ${retval} return ${retval}
} }
is_root_owned() {
local path=$1
local uid
if stat --version >/dev/null 2>&1; then
# GNU coreutils (Linux)
uid=$(stat -c '%u' "$path")
else
# BSD/macOS
uid=$(stat -f '%u' "$path")
fi
test "$uid" -eq 0
}
dump_arr() { dump_arr() {
arr_name="$1" arr_name="$1"
declare -n arr declare -n arr

View File

@@ -87,6 +87,17 @@ docker_build_image() {
# specific file for evaluated package manager info # specific file for evaluated package manager info
distroPkgMgr="${DOCKER_DIR}/${distro}-pkg_mgr" distroPkgMgr="${DOCKER_DIR}/${distro}-pkg_mgr"
# get package manager info # get package manager info
# TODO REMOVE
if is_root_owned "${IGN_DIR}"; then
docker run \
--rm \
-v "${REPO_DIR}:${DOCKER_WORKDIR}" \
-w "${DOCKER_WORKDIR}" \
"${dockerDistro}" \
rm -rf "${DOCKER_WORKDIR}"/gitignore
fi
docker run \ docker run \
"${DOCKER_RUN_FLAGS[@]}" \ "${DOCKER_RUN_FLAGS[@]}" \
"${dockerDistro}" \ "${dockerDistro}" \