Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions besu/src/main/scripts/besu-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
## SPDX-License-Identifier: Apache-2.0
##

# Construct the command as a single string
COMMAND="/opt/besu/bin/besu $@"

# Check if current user is not root. If not, run the command as is.
if [ "$(id -u)" -ne 0 ]; then
exec /bin/bash -c "$COMMAND"
fi

# Run Besu first to get paths needing permission adjustment
output=$(/opt/besu/bin/besu --print-paths-and-exit $BESU_USER_NAME "$@")

Expand Down Expand Up @@ -41,9 +49,5 @@ echo "$output" | while IFS=: read -r prefix path accessType; do
fi
done

# Finally, run Besu with the actual arguments passed to the container
# Construct the command as a single string
COMMAND="/opt/besu/bin/besu $@"

# Switch to the besu user and execute the command
exec su -s /bin/bash $BESU_USER_NAME -c "$COMMAND"
exec su -s /bin/bash "$BESU_USER_NAME" -c "$COMMAND"