-
Notifications
You must be signed in to change notification settings - Fork 867
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add besu CLI option to output dirs needing permission update
- Loading branch information
Bhanu Pulluri
committed
Sep 13, 2024
1 parent
822143e
commit a077985
Showing
8 changed files
with
137 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
## | ||
## Copyright contributors to Hyperledger Besu. | ||
## | ||
## Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
## the License. You may obtain a copy of the License at | ||
## | ||
## http://www.apache.org/licenses/LICENSE-2.0 | ||
## | ||
## Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
## an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
## specific language governing permissions and limitations under the License. | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
|
||
|
||
# Run Besu first to get paths needing permission adjustment | ||
output=$(/opt/besu/bin/besu --print-paths-and-exit "$@") | ||
|
||
# Parse the output to find the paths and their required access types | ||
echo "$output" | while IFS=: read -r prefix path accessType; do | ||
if [[ "$prefix" == "PERMISSION_CHECK_PATH" ]]; then | ||
# Change ownership to besu user and group | ||
chown -R besu:besu $path | ||
|
||
# Ensure read/write permissions for besu user | ||
|
||
echo "Setting permissions for: $path with access: $accessType" | ||
|
||
if [[ "$accessType" == "READ" ]]; then | ||
# Set read-only permissions for besu user | ||
chmod -R u+r $path | ||
elif [[ "$accessType" == "READ_WRITE" ]]; then | ||
# Set read/write permissions for besu user | ||
chmod -R u+rw $path | ||
fi | ||
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 -c "$COMMAND" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
# runtime docker tests | ||
file: | ||
/var/lib/besu: | ||
exists: true | ||
owner: besu | ||
mode: "0755" | ||
process: | ||
java: | ||
running: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.