Skip to content

Commit 401c38f

Browse files
authored
Merge pull request #675 from rsksmart/local-script-fix
Update sed usage based on OS
2 parents 4ed5395 + 57a4892 commit 401c38f

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Luisfc68 @MaximStanciu8 @gsoares85 @Dominikkq @AndresQuijano

.github/workflows/e2e.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ jobs:
2727
run: cd docker-compose/local/ && ./gh-action-env.sh $GITHUB_TOKEN
2828

2929
- name: Building LPS environment...
30-
run: cd docker-compose/local/ && LPS_STAGE=regtest sh lps-env.sh up
30+
run: cd docker-compose/local/ && LPS_STAGE=regtest ./lps-env.sh up
31+
shell: bash
3132

3233
- name: Checking LPS health...
3334
run: curl -X GET http://localhost:8080/health
3435

3536
- name: Shutting LPS environment down...
36-
run: cd docker-compose/local/ && LPS_STAGE=regtest sh lps-env.sh down
37+
run: cd docker-compose/local/ && LPS_STAGE=regtest ./lps-env.sh down

docker-compose/local/lps-env.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ COMMIT_TAG=$(git describe --exact-match --tags || echo "")
77
export COMMIT_HASH
88
export COMMIT_TAG
99

10+
# Detect OS
11+
OS_TYPE="$(uname)"
12+
13+
if [[ "$OS_TYPE" == "Darwin" ]]; then
14+
# macOS
15+
echo "Running on macOS"
16+
SED_INPLACE=("sed" "-i" "")
17+
elif [[ "$OS_TYPE" == "Linux" ]]; then
18+
# Assume Ubuntu or other Linux
19+
echo "Running on Linux"
20+
SED_INPLACE=("sed" "-i")
21+
else
22+
echo "Unsupported OS: $OS_TYPE"
23+
exit 1
24+
fi
25+
1026
if [ -z "${LPS_STAGE}" ]; then
1127
echo "LPS_STAGE is not set. Exit 1"
1228
exit 1
@@ -33,7 +49,7 @@ echo "LPS_STAGE: $LPS_STAGE; ENV_FILE: $ENV_FILE; LPS_UID: $LPS_UID"
3349

3450
# Force Management API to be enabled
3551
if [ -f "$ENV_FILE" ]; then
36-
sed -i 's/^ENABLE_MANAGEMENT_API=.*/ENABLE_MANAGEMENT_API=true/' "$ENV_FILE"
52+
"${SED_INPLACE[@]}" 's/^ENABLE_MANAGEMENT_API=.*/ENABLE_MANAGEMENT_API=true/' "$ENV_FILE"
3753
fi
3854

3955
SCRIPT_CMD=$1

0 commit comments

Comments
 (0)