Skip to content

Commit

Permalink
export: use su-exec when sudo is absent
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Di Maio <[email protected]>
  • Loading branch information
89luca89 committed Nov 19, 2023
1 parent 8fa9cd3 commit 35a45ad
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions distrobox-export
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,14 @@ if [ -z "${container_name}" ]; then
fi

#
if [ "${is_sudo}" -ne 0 ]; then
start_shell="$(command -v sudo) -i"
if [ "${is_sudo}" -ne 0 ]; then
if command -v su-exec > /dev/null2 >&1; then
start_shell="su-exec root su - root -c"
elif command -v sudo > /dev/null 2>&1; then
start_shell="$(command -v sudo) -i"
fi
else
start_shell="$(command -v sudo) -u ${USER} -i"
start_shell="/bin/sh -l -c"
fi

# Prefix to add to an existing command to work through the container
Expand Down

0 comments on commit 35a45ad

Please sign in to comment.