Skip to content

Commit 73c8a65

Browse files
commit
1 parent 5519fe2 commit 73c8a65

7 files changed

Lines changed: 51 additions & 24 deletions

File tree

docs/DeploymentGuide.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,10 @@ Run schema registration first to:
323323
**macOS/Linux:**
324324

325325
```bash
326-
if [ "$(uname)" = "Darwin" ]; then
327-
sed -i '' 's/\r$//' ./infra/scripts/register_schemas.sh
328-
else
329-
sed -i 's/\r$//' ./infra/scripts/register_schemas.sh
330-
fi
326+
for script in ./infra/scripts/register_schemas.sh ./infra/scripts/post_deployment.sh; do
327+
tmp="${script}.tmp"
328+
awk '{ sub(/\r$/, ""); print }' "$script" > "$tmp" && mv "$tmp" "$script"
329+
done
331330
bash ./infra/scripts/register_schemas.sh
332331
```
333332

@@ -351,11 +350,10 @@ After schema registration completes, upload the sample bundles as a separate exp
351350
**macOS/Linux:**
352351

353352
```bash
354-
if [ "$(uname)" = "Darwin" ]; then
355-
sed -i '' 's/\r$//' ./infra/scripts/upload_sample_data.sh
356-
else
357-
sed -i 's/\r$//' ./infra/scripts/upload_sample_data.sh
358-
fi
353+
for script in ./infra/scripts/upload_sample_data.sh ./infra/scripts/post_deployment.sh; do
354+
tmp="${script}.tmp"
355+
awk '{ sub(/\r$/, ""); print }' "$script" > "$tmp" && mv "$tmp" "$script"
356+
done
359357
bash ./infra/scripts/upload_sample_data.sh
360358
```
361359

@@ -372,11 +370,10 @@ Run authentication setup as an explicit step after post-deployment data setup:
372370
**macOS/Linux:**
373371

374372
```bash
375-
if [ "$(uname)" = "Darwin" ]; then
376-
sed -i '' 's/\r$//' ./infra/scripts/setup_auth.sh
377-
else
378-
sed -i 's/\r$//' ./infra/scripts/setup_auth.sh
379-
fi
373+
for script in ./infra/scripts/setup_auth.sh ./infra/scripts/configure_auth.sh; do
374+
tmp="${script}.tmp"
375+
awk '{ sub(/\r$/, ""); print }' "$script" > "$tmp" && mv "$tmp" "$script"
376+
done
380377
bash ./infra/scripts/setup_auth.sh
381378
```
382379

infra/scripts/configure_auth.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ _check() {
137137
case "$status" in
138138
PASS) printf " ✅ %-55s\n" "$label" ;;
139139
WARN) printf " ⚠️ %-54s\n" "$label"
140-
[[ -n "$detail" ]] && echo " $detail" ;;
140+
[[ -n "$detail" ]] && printf " %b\n" "$detail" ;;
141141
FAIL) printf " ❌ %-55s\n" "$label"
142-
[[ -n "$detail" ]] && echo " $detail" ;;
142+
[[ -n "$detail" ]] && printf " %b\n" "$detail" ;;
143143
esac
144144
}
145145

infra/scripts/register_schemas.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
set -euo pipefail
33

44
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5-
sed -i 's/\r$//' "$SCRIPT_DIR/post_deployment.sh"
5+
tmp_file="$(mktemp)" || { echo "Failed to create temp file" >&2; exit 1; }
6+
if ! tr -d '\r' < "$SCRIPT_DIR/post_deployment.sh" > "$tmp_file"; then
7+
rm -f "$tmp_file"
8+
echo "Failed to normalize line endings for: $SCRIPT_DIR/post_deployment.sh" >&2
9+
exit 1
10+
fi
11+
mv "$tmp_file" "$SCRIPT_DIR/post_deployment.sh"
612
chmod +x "$SCRIPT_DIR/post_deployment.sh"
713

814
POST_DEPLOYMENT_MODE=schema bash "$SCRIPT_DIR/post_deployment.sh"

infra/scripts/run_post_deployment.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ step_ok() { echo ""; echo " ✅ Step $1 completed successfully."; }
5050
step_skip() { echo ""; echo " ⏭️ Step $1 skipped (${2})."; }
5151
step_fail() { echo ""; echo " ❌ Step $1 failed — see errors above."; }
5252

53+
normalize_line_endings() {
54+
local script_file="$1"
55+
local tmp_file
56+
tmp_file="$(mktemp)" || { echo " ❌ Failed to create temp file" >&2; exit 1; }
57+
if ! tr -d '\r' < "$script_file" > "$tmp_file"; then
58+
rm -f "$tmp_file"
59+
echo " ❌ Failed to normalize line endings for: $script_file" >&2
60+
exit 1
61+
fi
62+
mv "$tmp_file" "$script_file"
63+
}
64+
5365
print_banner
5466

5567
if ! command -v azd &>/dev/null; then
@@ -84,7 +96,7 @@ else
8496
exit 1
8597
fi
8698

87-
sed -i 's/\r$//' "$STEP1_SCRIPT"
99+
normalize_line_endings "$STEP1_SCRIPT"
88100
chmod +x "$STEP1_SCRIPT"
89101

90102
STEP1_EXIT=0
@@ -115,7 +127,7 @@ else
115127
exit 1
116128
fi
117129

118-
sed -i 's/\r$//' "$STEP2_SCRIPT"
130+
normalize_line_endings "$STEP2_SCRIPT"
119131
chmod +x "$STEP2_SCRIPT"
120132

121133
STEP2_EXIT=0
@@ -162,7 +174,7 @@ else
162174
exit 1
163175
fi
164176

165-
sed -i 's/\r$//' "$STEP3_SCRIPT"
177+
normalize_line_endings "$STEP3_SCRIPT"
166178
chmod +x "$STEP3_SCRIPT"
167179

168180
STEP3_EXIT=0

infra/scripts/setup_auth.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
set -euo pipefail
33

44
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5-
sed -i 's/\r$//' "$SCRIPT_DIR/configure_auth.sh"
5+
tmp_file="$(mktemp)" || { echo "Failed to create temp file" >&2; exit 1; }
6+
if ! tr -d '\r' < "$SCRIPT_DIR/configure_auth.sh" > "$tmp_file"; then
7+
rm -f "$tmp_file"
8+
echo "Failed to normalize line endings for: $SCRIPT_DIR/configure_auth.sh" >&2
9+
exit 1
10+
fi
11+
mv "$tmp_file" "$SCRIPT_DIR/configure_auth.sh"
612
chmod +x "$SCRIPT_DIR/configure_auth.sh"
713

814
bash "$SCRIPT_DIR/configure_auth.sh" "$@"

infra/scripts/test_configure_auth_preflight.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Version 5.1
1+
#Requires -Version 7.0
22
<#
33
.SYNOPSIS
44
Validates configure_auth.ps1 --preflight-only behavior under each

infra/scripts/upload_sample_data.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
set -euo pipefail
33

44
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5-
sed -i 's/\r$//' "$SCRIPT_DIR/post_deployment.sh"
5+
tmp_file="$(mktemp)" || { echo "Failed to create temp file" >&2; exit 1; }
6+
if ! tr -d '\r' < "$SCRIPT_DIR/post_deployment.sh" > "$tmp_file"; then
7+
rm -f "$tmp_file"
8+
echo "Failed to normalize line endings for: $SCRIPT_DIR/post_deployment.sh" >&2
9+
exit 1
10+
fi
11+
mv "$tmp_file" "$SCRIPT_DIR/post_deployment.sh"
612
chmod +x "$SCRIPT_DIR/post_deployment.sh"
713

814
POST_DEPLOYMENT_MODE=sample-data bash "$SCRIPT_DIR/post_deployment.sh"

0 commit comments

Comments
 (0)